- Do not attempt to get studies metadata if ViewerData already has studies property and use it to view studies in tab (for cases when a tab is opened with metadata externally)
- Add showStudyListTab helper whether to show StudyListTab in worklist template - it is shown by default (it is not shown only if "data.showStudyListTab" is set to false when rendering worklist template)
This commit is contained in:
parent
7c64341284
commit
5a680261c7
@ -1,18 +1,22 @@
|
||||
<template name="worklist">
|
||||
<ul class="nav noselect" role="tablist" id="tablist">
|
||||
<li role="presentation" class="tabTitle active">
|
||||
<a data-target="#worklistTab" role="tab" data-toggle="tab">Study List</a>
|
||||
</li>
|
||||
{{#if showStudyListTab }}
|
||||
<li role="presentation" class="tabTitle active">
|
||||
<a data-target="#worklistTab" role="tab" data-toggle="tab">Study List</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#each worklistTabs }}
|
||||
{{>tabTitle }}
|
||||
{{/each }}
|
||||
</ul>
|
||||
<div id="worklistTabs" class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="worklistTab">
|
||||
<div class="worklistContainer">
|
||||
{{> worklistResult }}
|
||||
{{#if showStudyListTab }}
|
||||
<div role="tabpanel" class="tab-pane active" id="worklistTab">
|
||||
<div class="worklistContainer">
|
||||
{{> worklistResult }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#each worklistTabs }}
|
||||
{{>tabContent }}
|
||||
{{/each }}
|
||||
|
||||
@ -43,6 +43,20 @@ Template.worklist.helpers({
|
||||
*/
|
||||
worklistTabs: function() {
|
||||
return WorklistTabs.find();
|
||||
},
|
||||
showStudyListTab: function() {
|
||||
// StudyListTab is shown by default
|
||||
const instance = Template.instance();
|
||||
if (!instance.data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var showStudyListTab = instance.data.showStudyListTab;
|
||||
if (showStudyListTab === undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return showStudyListTab;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -47,72 +47,82 @@ switchToTab = function(contentId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the stored ViewerData global object to retrieve the studyInstanceUid
|
||||
// related to this tab
|
||||
var studyInstanceUids = ViewerData[contentId].studyInstanceUids;
|
||||
var studies = ViewerData[contentId].studies;
|
||||
|
||||
// Attempt to retrieve the meta data (it might be cached)
|
||||
getStudiesMetadata(studyInstanceUids, function(studies) {
|
||||
// Tab closed while study data was being retrieved, stop here
|
||||
if (!ViewerData[contentId]) {
|
||||
log.warn('Tab closed while study data was being retrieved');
|
||||
return;
|
||||
}
|
||||
if (studies) {
|
||||
// ViewerData already has the meta data (in cases when worklist is launched externally)
|
||||
viewStudiesInTab(contentId, studies);
|
||||
} else {
|
||||
// Use the stored ViewerData global object to retrieve the studyInstanceUid
|
||||
// related to this tab
|
||||
var studyInstanceUids = ViewerData[contentId].studyInstanceUids;
|
||||
|
||||
// Once we have the study data, store it in a structure with
|
||||
// any other saved data about this tab (e.g. layout structure)
|
||||
var data = jQuery.extend({}, ViewerData[contentId]);
|
||||
data.studies = studies;
|
||||
data.contentId = contentId;
|
||||
// Attempt to retrieve the meta data (it might be cached)
|
||||
getStudiesMetadata(studyInstanceUids, function(studies) {
|
||||
viewStudiesInTab(contentId, studies);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (ViewerData[contentId].studies && ViewerData[contentId].studies.length) {
|
||||
data.studies = ViewerData[contentId].studies;
|
||||
}
|
||||
function viewStudiesInTab(contentId, studies) {
|
||||
// Tab closed while study data was being retrieved, stop here
|
||||
if (!ViewerData[contentId]) {
|
||||
log.warn('Tab closed while study data was being retrieved');
|
||||
return;
|
||||
}
|
||||
|
||||
// Once we have the study data, store it in a structure with
|
||||
// any other saved data about this tab (e.g. layout structure)
|
||||
var data = jQuery.extend({}, ViewerData[contentId]);
|
||||
data.studies = studies;
|
||||
data.contentId = contentId;
|
||||
|
||||
// Add additional metadata to our study from the worklist
|
||||
data.studies.forEach(function(study) {
|
||||
var worklistStudy = WorklistStudies.findOne({
|
||||
studyInstanceUid: study.studyInstanceUid
|
||||
});
|
||||
if (ViewerData[contentId].studies && ViewerData[contentId].studies.length) {
|
||||
data.studies = ViewerData[contentId].studies;
|
||||
}
|
||||
|
||||
if (!worklistStudy) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.extend(study, worklistStudy);
|
||||
// Add additional metadata to our study from the worklist
|
||||
data.studies.forEach(function(study) {
|
||||
var worklistStudy = WorklistStudies.findOne({
|
||||
studyInstanceUid: study.studyInstanceUid
|
||||
});
|
||||
|
||||
// Get tab content container given the contentId string
|
||||
// If no such container exists, stop here because something is wrong
|
||||
var container = $('.tab-content').find('#' + contentId).get(0);
|
||||
if (!container) {
|
||||
log.warn('No container present with the contentId: ' + contentId);
|
||||
if (!worklistStudy) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the loading text template that is inside the tab container by default
|
||||
var viewerContainer = document.createElement('div');
|
||||
viewerContainer.classList.add('viewerContainer');
|
||||
container.innerHTML = '';
|
||||
container.appendChild(viewerContainer);
|
||||
|
||||
// Use Blaze to render the Viewer Template into the container
|
||||
Blaze.renderWithData(Template.viewer, data, viewerContainer);
|
||||
|
||||
// Retrieve the DOM element of the viewer
|
||||
var imageViewer = $('#viewer');
|
||||
|
||||
// If it is present in the DOM (it should be), then apply
|
||||
// styles to prevent page scrolling and overscrolling on mobile devices
|
||||
if (imageViewer) {
|
||||
document.body.style.overflow = 'hidden';
|
||||
document.body.style.height = '100%';
|
||||
document.body.style.width = '100%';
|
||||
document.body.style.minWidth = 0;
|
||||
|
||||
// Prevent overscroll on mobile devices
|
||||
document.body.style.position = 'fixed';
|
||||
}
|
||||
$.extend(study, worklistStudy);
|
||||
});
|
||||
};
|
||||
|
||||
// Get tab content container given the contentId string
|
||||
// If no such container exists, stop here because something is wrong
|
||||
var container = $('.tab-content').find('#' + contentId).get(0);
|
||||
if (!container) {
|
||||
log.warn('No container present with the contentId: ' + contentId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the loading text template that is inside the tab container by default
|
||||
var viewerContainer = document.createElement('div');
|
||||
viewerContainer.classList.add('viewerContainer');
|
||||
container.innerHTML = '';
|
||||
container.appendChild(viewerContainer);
|
||||
|
||||
// Use Blaze to render the Viewer Template into the container
|
||||
Blaze.renderWithData(Template.viewer, data, viewerContainer);
|
||||
|
||||
// Retrieve the DOM element of the viewer
|
||||
var imageViewer = $('#viewer');
|
||||
|
||||
// If it is present in the DOM (it should be), then apply
|
||||
// styles to prevent page scrolling and overscrolling on mobile devices
|
||||
if (imageViewer) {
|
||||
document.body.style.overflow = 'hidden';
|
||||
document.body.style.height = '100%';
|
||||
document.body.style.width = '100%';
|
||||
document.body.style.minWidth = 0;
|
||||
|
||||
// Prevent overscroll on mobile devices
|
||||
document.body.style.position = 'fixed';
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user