LT-357: Thumbnails were not showing when loading study firstly from quick switch
This commit is contained in:
parent
927df49f5d
commit
70aa9e9012
@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
|
|||||||
import { Template } from 'meteor/templating';
|
import { Template } from 'meteor/templating';
|
||||||
import { ReactiveVar } from 'meteor/reactive-var';
|
import { ReactiveVar } from 'meteor/reactive-var';
|
||||||
import { _ } from 'meteor/underscore';
|
import { _ } from 'meteor/underscore';
|
||||||
|
import { $ } from 'meteor/jquery';
|
||||||
|
|
||||||
Template.studyTimepointStudy.onCreated(() => {
|
Template.studyTimepointStudy.onCreated(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
@ -9,9 +10,15 @@ Template.studyTimepointStudy.onCreated(() => {
|
|||||||
instance.loading = new ReactiveVar(false);
|
instance.loading = new ReactiveVar(false);
|
||||||
|
|
||||||
// Get the current study element
|
// Get the current study element
|
||||||
instance.getStudyElement = () => {
|
instance.getStudyElement = (isGlobal=false) => {
|
||||||
const studyInstanceUid = instance.data.study.studyInstanceUid;
|
const studyInstanceUid = instance.data.study.studyInstanceUid;
|
||||||
return instance.$browser.find(`.studyTimepointStudy[data-uid='${studyInstanceUid}']`);
|
const selector = `.studyTimepointStudy[data-uid='${studyInstanceUid}']`;
|
||||||
|
return isGlobal ? $(selector) : instance.$browser.find(selector);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set all the studies with the same uid to loading state
|
||||||
|
instance.setLoading = () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the current study as selected in the studies list
|
// Set the current study as selected in the studies list
|
||||||
@ -76,6 +83,17 @@ Template.studyTimepointStudy.events({
|
|||||||
instance.select(true);
|
instance.select(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Set loading state
|
||||||
|
'loadStarted .studyTimepointStudy'(event, instance) {
|
||||||
|
instance.loading.set(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Remove loading state and fix the thumbnails wrappers height
|
||||||
|
'loadEnded .studyTimepointStudy'(event, instance) {
|
||||||
|
instance.loading.set(false);
|
||||||
|
instance.initializeStudyWrapper();
|
||||||
|
},
|
||||||
|
|
||||||
// Changes the current study selection for the clicked study
|
// Changes the current study selection for the clicked study
|
||||||
'click .studyModality'(event, instance) {
|
'click .studyModality'(event, instance) {
|
||||||
const studyData = instance.data.study;
|
const studyData = instance.data.study;
|
||||||
@ -89,14 +107,15 @@ Template.studyTimepointStudy.events({
|
|||||||
const alreadyLoaded = ViewerStudies.findOne({ _id });
|
const alreadyLoaded = ViewerStudies.findOne({ _id });
|
||||||
|
|
||||||
if (!alreadyLoaded) {
|
if (!alreadyLoaded) {
|
||||||
instance.loading.set(true);
|
const $studies = instance.getStudyElement(true);
|
||||||
|
$studies.trigger('loadStarted');
|
||||||
getStudyMetadata(studyInstanceUid, study => {
|
getStudyMetadata(studyInstanceUid, study => {
|
||||||
study.displaySets = createStacks(study);
|
study.displaySets = createStacks(study);
|
||||||
instance.data.study = study;
|
instance.data.study = study;
|
||||||
ViewerStudies.insert(study, () => {
|
ViewerStudies.insert(study, () => {
|
||||||
// To make sure studies are rendered in the DOM
|
// To make sure studies are rendered in the DOM
|
||||||
// use minimongo insert callback
|
// use minimongo insert callback
|
||||||
instance.initializeStudyWrapper();
|
$studies.trigger('loadEnded');
|
||||||
instance.select(isQuickSwitch);
|
instance.select(isQuickSwitch);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user