Remove some subscription / reactivity / caching bugs and the unnecessary PatientLocations collection

This commit is contained in:
Erik Ziegler committed 2016-02-10 16:38:49 +01:00
1 parent 7d42456f57
commit 9cde04bcfe
43 files changed
+321 -234

No files matched your search

@@ -1,5 +1,10 @@
<template name="tabContent">
<div role="tabpanel" class="tab-pane {{active}}" id="{{contentid}}">
{{ >loadingText }}
{{>loadingText}}
<div class="viewerContainer">
<!-- This extra viewerContainer div only exists to be destroyed when switching tabs.
It is a workaround because Meteor's onDestroyed and destruction handlers don't fire
when removing the actual template from the DOM.-->
</div>
</div>
</template>
@@ -1,4 +1,8 @@
.tab-pane
.loadingTextDiv
h5
color: #777
color: #777
.viewerContainer
height: 100%
width: 100%
@@ -7,9 +7,9 @@
{{ >tabTitle }}
{{ /each }}
</ul>
<div class="tab-content">
<div id="worklistTabs" class="tab-content">
<div role="tabpanel" class="tab-pane active" id="worklistTab">
<div id="worklistContainer" class="container">
<div class="worklistContainer">
{{> worklistResult }}
</div>
</div>
@@ -11,20 +11,13 @@ ViewerData = Session.get('ViewerData') || {};
// Create the WorklistTabs collection
WorklistTabs = new Meteor.Collection(null);
WorklistTabs._debugName = 'WorklistTabs';
// Define the WorklistStudies Collection
// This is a client-side only Collection which
// Stores the list of studies in the Worklist
WorklistStudies = new Meteor.Collection(null);
Template.worklist.onCreated(function() {
var self = this;
if (Worklist.subscriptions) {
Worklist.subscriptions.forEach(function(collectionName) {
self.subscribe(collectionName);
});
}
});
WorklistStudies._debugName = 'WorklistStudies';
Template.worklist.onRendered(function() {
// If there is a tab set as active in the Session,
@@ -9,37 +9,18 @@ body
-ms-user-select: none
user-select: none
input.worklist-search
height: 25px
background-color: #888888
width: 100%
#tblStudyList
tr
height: 20px
.patient-name-input
width: 100%
.worklist-input
width: 100%
.modality-input
width: 100%
.patientid-input
width: 100%
.study-description-input
width: 100%
#worklistTab
background-color: #202020
#worklistContainer
.worklistContainer
background-color: #202020
margin: 0 auto
color: white
width:90%
width: 90%
padding-top: 10px
#tabs
@@ -99,7 +80,7 @@ input.worklist-search
.tab-content
width: 100%
height: calc(100% - 91px)
.tab-pane
width: 100%
height: 100%
@@ -1,5 +1,5 @@
<template name="worklistResult">
<table id="tblStudyList" class="table table-striped noselect">
<table id="tblStudyList" class="worklistResult table table-striped noselect">
<thead>
<tr>
<th>
@@ -115,6 +115,20 @@ function search() {
});
}
Template.worklistResult.onCreated(function() {
console.log('WorklistResult onCreated!');
var self = this;
if (Worklist.subscriptions) {
Worklist.subscriptions.forEach(function(collectionName) {
self.subscribe(collectionName);
});
}
});
Template.worklistResult.onDestroyed(function() {
console.log('WorklistResult onDestroyed!');
});
Template.worklistResult.events({
'keydown input': function(e) {
if (e.which === 13) { // Enter
@@ -15,8 +15,14 @@ table#tblStudyList
#numImages.worklist-search, #modality.worklist-search
visibility: hidden
input.worklist-search
height: 25px
background-color: #888888
width: 100%
tbody
tr
height: 20px
padding: 4px
border: 1px solid #282828
background-color: black
@@ -1,5 +1,6 @@
// Maybe we should use regular Worklist collection?
WorklistSelectedStudies = new Meteor.Collection(null);
WorklistSelectedStudies._debugName = 'WorklistSelectedStudies';
function handleShiftClick(studyRow, data) {
log.info('shiftKey');
+2 -2
View File
@@ -12,8 +12,6 @@ var StudyMetaData = {};
* @param failCallback The callback function to be executed when the study retrieval has failed
*/
getStudyMetadata = function(studyInstanceUid, doneCallback, failCallback) {
log.info('worklistStudy getStudyMetadata');
// If the StudyMetaData cache already has data related to this
// studyInstanceUid, then we should fire the doneCallback with this data
// and stop here.
@@ -26,6 +24,8 @@ getStudyMetadata = function(studyInstanceUid, doneCallback, failCallback) {
// If no study metadata is in the cache variable, we need to retrieve it from
// the server with a call.
Meteor.call('GetStudyMetadata', studyInstanceUid, function(error, study) {
log.info('worklistStudy getStudyMetadata: ' + studyInstanceUid);
if (error) {
log.warn(error);
failCallback(error);
+17 -3
View File
@@ -8,6 +8,7 @@ switchToTab = function(contentId) {
if (!contentId) {
return;
}
log.info('Switching to tab: ' + contentId);
// Use Bootstrap's Tab JavaScript to show the contents of the current tab
@@ -15,7 +16,8 @@ switchToTab = function(contentId) {
$('.tabTitle a[data-target="#' + contentId + '"]').tab('show');
// Remove any previous Viewers from the DOM
$('#viewer').remove();
$('.viewerContainer').remove();
$('.worklistContainer').remove();
// Update the 'activeContentId' variable in Session
Session.set('activeContentId', contentId);
@@ -23,7 +25,16 @@ switchToTab = function(contentId) {
// If we are switching to the Worklist tab, reset any CSS styles
// that have been applied to prevent scrolling in the Viewer.
// Then stop here, since nothing needs to be re-rendered.
var container;
if (contentId === 'worklistTab') {
container = $('.tab-content').find('#worklistTab').get(0);
var worklistContainer = document.createElement('div');
worklistContainer.classList.add('worklistContainer');
container.appendChild(worklistContainer);
// Use Blaze to render the WorklistResult Template into the container
Blaze.render(Template.worklistResult, worklistContainer);
document.body.style.overflow = null;
document.body.style.height = null;
document.body.style.minWidth = null;
@@ -67,10 +78,13 @@ switchToTab = function(contentId) {
}
// 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
UI.renderWithData(Template.viewer, data, container);
Blaze.renderWithData(Template.viewer, data, viewerContainer);
// Retrieve the DOM element of the viewer
var imageViewer = $('#viewer');
@@ -87,4 +101,4 @@ switchToTab = function(contentId) {
document.body.style.position = 'fixed';
}
});
};
};