- 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">
|
<template name="worklist">
|
||||||
<ul class="nav noselect" role="tablist" id="tablist">
|
<ul class="nav noselect" role="tablist" id="tablist">
|
||||||
<li role="presentation" class="tabTitle active">
|
{{#if showStudyListTab }}
|
||||||
<a data-target="#worklistTab" role="tab" data-toggle="tab">Study List</a>
|
<li role="presentation" class="tabTitle active">
|
||||||
</li>
|
<a data-target="#worklistTab" role="tab" data-toggle="tab">Study List</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
{{#each worklistTabs }}
|
{{#each worklistTabs }}
|
||||||
{{>tabTitle }}
|
{{>tabTitle }}
|
||||||
{{/each }}
|
{{/each }}
|
||||||
</ul>
|
</ul>
|
||||||
<div id="worklistTabs" class="tab-content">
|
<div id="worklistTabs" class="tab-content">
|
||||||
<div role="tabpanel" class="tab-pane active" id="worklistTab">
|
{{#if showStudyListTab }}
|
||||||
<div class="worklistContainer">
|
<div role="tabpanel" class="tab-pane active" id="worklistTab">
|
||||||
{{> worklistResult }}
|
<div class="worklistContainer">
|
||||||
|
{{> worklistResult }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{/if}}
|
||||||
{{#each worklistTabs }}
|
{{#each worklistTabs }}
|
||||||
{{>tabContent }}
|
{{>tabContent }}
|
||||||
{{/each }}
|
{{/each }}
|
||||||
|
|||||||
@ -43,6 +43,20 @@ Template.worklist.helpers({
|
|||||||
*/
|
*/
|
||||||
worklistTabs: function() {
|
worklistTabs: function() {
|
||||||
return WorklistTabs.find();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the stored ViewerData global object to retrieve the studyInstanceUid
|
var studies = ViewerData[contentId].studies;
|
||||||
// related to this tab
|
|
||||||
var studyInstanceUids = ViewerData[contentId].studyInstanceUids;
|
|
||||||
|
|
||||||
// Attempt to retrieve the meta data (it might be cached)
|
if (studies) {
|
||||||
getStudiesMetadata(studyInstanceUids, function(studies) {
|
// ViewerData already has the meta data (in cases when worklist is launched externally)
|
||||||
// Tab closed while study data was being retrieved, stop here
|
viewStudiesInTab(contentId, studies);
|
||||||
if (!ViewerData[contentId]) {
|
} else {
|
||||||
log.warn('Tab closed while study data was being retrieved');
|
// Use the stored ViewerData global object to retrieve the studyInstanceUid
|
||||||
return;
|
// related to this tab
|
||||||
}
|
var studyInstanceUids = ViewerData[contentId].studyInstanceUids;
|
||||||
|
|
||||||
// Once we have the study data, store it in a structure with
|
// Attempt to retrieve the meta data (it might be cached)
|
||||||
// any other saved data about this tab (e.g. layout structure)
|
getStudiesMetadata(studyInstanceUids, function(studies) {
|
||||||
var data = jQuery.extend({}, ViewerData[contentId]);
|
viewStudiesInTab(contentId, studies);
|
||||||
data.studies = studies;
|
});
|
||||||
data.contentId = contentId;
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (ViewerData[contentId].studies && ViewerData[contentId].studies.length) {
|
function viewStudiesInTab(contentId, studies) {
|
||||||
data.studies = ViewerData[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
|
if (ViewerData[contentId].studies && ViewerData[contentId].studies.length) {
|
||||||
data.studies.forEach(function(study) {
|
data.studies = ViewerData[contentId].studies;
|
||||||
var worklistStudy = WorklistStudies.findOne({
|
}
|
||||||
studyInstanceUid: study.studyInstanceUid
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!worklistStudy) {
|
// Add additional metadata to our study from the worklist
|
||||||
return;
|
data.studies.forEach(function(study) {
|
||||||
}
|
var worklistStudy = WorklistStudies.findOne({
|
||||||
|
studyInstanceUid: study.studyInstanceUid
|
||||||
$.extend(study, worklistStudy);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get tab content container given the contentId string
|
if (!worklistStudy) {
|
||||||
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the loading text template that is inside the tab container by default
|
$.extend(study, worklistStudy);
|
||||||
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';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
// 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