LT-326: Show all series of a study after loading it in Studies Sidebar
This commit is contained in:
parent
fd31849bd3
commit
e70cc254ad
@ -16,14 +16,22 @@ Template.studyTimepointStudy.onCreated(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize the study wrapper max-height to enable CSS transition
|
const initializeStudyWrapper = instance => {
|
||||||
Template.studyTimepointStudy.onRendered(() => {
|
|
||||||
const instance = Template.instance();
|
|
||||||
const $study = instance.$('.studyTimepointStudy');
|
const $study = instance.$('.studyTimepointStudy');
|
||||||
const $thumbnails = instance.$('.studyTimepointThumbnails');
|
const $thumbnails = instance.$('.studyTimepointThumbnails');
|
||||||
$study.addClass('active');
|
$study.addClass('active');
|
||||||
|
// If element already has max-height property set, .height()
|
||||||
|
// will return that value, so remove it to recalculate
|
||||||
|
$thumbnails.css('max-height', '');
|
||||||
$thumbnails.css('max-height', $thumbnails.height());
|
$thumbnails.css('max-height', $thumbnails.height());
|
||||||
$study.removeClass('active');
|
$study.removeClass('active');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initialize the study wrapper max-height to enable CSS transition
|
||||||
|
Template.studyTimepointStudy.onRendered(() => {
|
||||||
|
const instance = Template.instance();
|
||||||
|
|
||||||
|
initializeStudyWrapper(instance);
|
||||||
|
|
||||||
// Here we add, remove, and add the active class again because this way
|
// Here we add, remove, and add the active class again because this way
|
||||||
// the max-height animation appears smooth to the user.
|
// the max-height animation appears smooth to the user.
|
||||||
@ -85,7 +93,7 @@ Template.studyTimepointStudy.events({
|
|||||||
const $study = $(event.currentTarget).closest('.studyTimepointStudy');
|
const $study = $(event.currentTarget).closest('.studyTimepointStudy');
|
||||||
|
|
||||||
const studyData = instance.data.study;
|
const studyData = instance.data.study;
|
||||||
const studyInstanceUid = studyData.studyInstanceUid;
|
const { studyInstanceUid, _id } = studyData;
|
||||||
|
|
||||||
const isQuickSwitch = !_.isUndefined(instance.data.viewportIndex);
|
const isQuickSwitch = !_.isUndefined(instance.data.viewportIndex);
|
||||||
|
|
||||||
@ -93,15 +101,20 @@ Template.studyTimepointStudy.events({
|
|||||||
// and if not, retrieve it.
|
// and if not, retrieve it.
|
||||||
if (!studyData.seriesList) {
|
if (!studyData.seriesList) {
|
||||||
const alreadyLoaded = ViewerStudies.findOne({
|
const alreadyLoaded = ViewerStudies.findOne({
|
||||||
studyInstanceUid
|
_id
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!alreadyLoaded) {
|
if (!alreadyLoaded) {
|
||||||
$study.addClass('loading');
|
$study.addClass('loading');
|
||||||
getStudyMetadata(studyInstanceUid, study => {
|
getStudyMetadata(studyInstanceUid, study => {
|
||||||
study.displaySets = createStacks(study);
|
study.displaySets = createStacks(study);
|
||||||
ViewerStudies.insert(study);
|
instance.data.study = study;
|
||||||
instance.select(isQuickSwitch);
|
ViewerStudies.insert(study, () => {
|
||||||
|
// To make sure studies are rendered in the DOM
|
||||||
|
// use minimongo insert callback
|
||||||
|
initializeStudyWrapper(instance);
|
||||||
|
instance.select(isQuickSwitch);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
studyData.seriesList = alreadyLoaded.seriesList;
|
studyData.seriesList = alreadyLoaded.seriesList;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user