Remove tabbed layout in favour of current Lesion Tracker design (OHIF-49)

This commit is contained in:
Erik Ziegler committed 2016-07-23 20:11:01 +02:00
1 parent 8b364ce9d0
commit 82e374b1e3
48 files changed
+371 -511

No files matched your search

@@ -8,8 +8,8 @@ Template.worklistResult.helpers({
* Returns a sorted instance of the WorklistStudies Collection
* by Patient name and Study Date in Ascending order.
*/
studies: function() {
var sortOption = Session.get('sortOption');
studies() {
const sortOption = Session.get('sortOption');
if (sortOption) {
return WorklistStudies.find({}, {
sort: sortOption
@@ -24,22 +24,24 @@ Template.worklistResult.helpers({
});
},
numberOfStudies: function() {
numberOfStudies() {
return WorklistStudies.find().count();
},
showLoadingText: function() {
showLoadingText() {
return Session.get('searchResults').showLoadingText;
},
showNotFoundMessage: function() {
showNotFoundMessage() {
return Session.get('searchResults').showNotFoundMessage;
},
sortingColumnsIcons: function() {
var sortingColumnsIcons = {};
Object.keys(Template.instance().sortingColumns.keys).forEach(function(key) {
var value = Template.instance().sortingColumns.get(key);
sortingColumnsIcons() {
const instance = Template.instance();
let sortingColumnsIcons = {};
Object.keys(instance.sortingColumns.keys).forEach(key => {
const value = instance.sortingColumns.get(key);
if (value === 1) {
sortingColumnsIcons[key] = 'fa fa-fw fa-sort-up';
@@ -102,10 +104,10 @@ function replaceUndefinedColumnValue(text) {
* Convert string to study date
*/
function convertStringToStudyDate(dateStr) {
var y = dateStr.substring(0, 4);
var m = dateStr.substring(4, 6);
var d = dateStr.substring(6, 8);
var newDateStr = m + '/' + d + '/' + y;
const y = dateStr.substring(0, 4);
const m = dateStr.substring(4, 6);
const d = dateStr.substring(6, 8);
const newDateStr = m + '/' + d + '/' + y;
return new Date(newDateStr);
}
@@ -115,7 +117,7 @@ function convertStringToStudyDate(dateStr) {
*/
function search() {
// Show loading message
var searchResults = Session.get('searchResults');
let searchResults = Session.get('searchResults');
searchResults.showLoadingText = true;
searchResults.showNotFoundMessage = false;
Session.set('searchResults', searchResults);
@@ -130,12 +132,12 @@ function search() {
// Make sure that modality has a reasonable value, since it is occasionally
// returned as 'undefined'
var modality = replaceUndefinedColumnValue($('input#modality').val());
const modality = replaceUndefinedColumnValue($('input#modality').val());
// Clear all current studies
WorklistStudies.remove({});
Meteor.call('WorklistSearch', filter, function(error, studies) {
Meteor.call('WorklistSearch', filter, (error, studies) => {
if (error) {
log.warn(error);
return;
@@ -150,7 +152,7 @@ function search() {
}
// Loop through all identified studies
studies.forEach(function(study) {
studies.forEach(study => {
// Search the rest of the parameters that aren't done via the server call
if (isIndexOf(study.modalities, modality) &&
(new Date(studyDateFrom).setHours(0, 0, 0, 0) <= convertStringToStudyDate(study.studyDate) || !studyDateFrom || studyDateFrom === '') &&
@@ -173,36 +175,38 @@ function search() {
});
}
Template.worklistResult.onCreated(function() {
this.sortOption = new ReactiveVar();
this.sortingColumns = new ReactiveDict();
Template.worklistResult.onCreated(() => {
let instance = Template.instance();
instance.sortOption = new ReactiveVar();
instance.sortingColumns = new ReactiveDict();
// Retrieve all studies
search();
// Set sortOption
var sortOptionSession = Session.get('sortOption');
const sortOptionSession = Session.get('sortOption');
if (sortOptionSession) {
this.sortingColumns.set(sortOptionSession);
instance.sortingColumns.set(sortOptionSession);
} else {
this.sortingColumns.set('patientName', 1);
this.sortingColumns.set('studyDate', 1);
this.sortingColumns.set('patientId', 0);
this.sortingColumns.set('accessionNumber', 0);
this.sortingColumns.set('studyDescription', 0);
this.sortingColumns.set('modality', 0);
this.sortingColumns.set('numberOfStudyRelatedInstances', 0);
instance.sortingColumns.set({
patientName: 1,
studyDate: 1,
patientId: 0,
accessionNumber: 0,
studyDescription: 0,
modality: 0,
numberOfStudyRelatedInstances: 0
});
}
var self = this;
if (Worklist.subscriptions) {
Worklist.subscriptions.forEach(function(collectionName) {
self.subscribe(collectionName);
Worklist.subscriptions.forEach(collectionName => {
instance.subscribe(collectionName);
});
}
});
Template.worklistResult.onRendered(function() {
Template.worklistResult.onRendered(() => {
const instance = Template.instance();
// Initialize daterangepicker
@@ -215,29 +219,33 @@ Template.worklistResult.onRendered(function() {
});
});
function resetSortingColumns(template, sortingColumn) {
Object.keys(template.sortingColumns.keys).forEach(function(key) {
function resetSortingColumns(instance, sortingColumn) {
Object.keys(instance.sortingColumns.keys).forEach(key => {
if (key !== sortingColumn) {
template.sortingColumns.set(key, null);
instance.sortingColumns.set(key, null);
}
});
}
Template.worklistResult.events({
'keydown input': function(e) {
if (e.which === 13) { // Enter
'keydown input'(event) {
if (event.which === 13) { // Enter
search();
}
},
'onsearch input': function() {
'onsearch input'() {
search();
},
'change #studyDate': function(e, template) {
var dateRange = $(e.currentTarget).val();
'change #studyDate'(event) {
let dateRange = $(event.currentTarget).val();
// Remove all space chars
dateRange = dateRange.replace(/ /g, '');
// Split dateRange into subdates
var dates = dateRange.split('-');
const dates = dateRange.split('-');
studyDateFrom = dates[0];
studyDateTo = dates[1];
@@ -245,23 +253,26 @@ Template.worklistResult.events({
search();
}
},
'click div.sortingCell': function(e, template) {
var elementId = e.currentTarget.id;
// Remove _ from id
var columnName = elementId.replace('_', '');
var sortOption = {};
resetSortingColumns(template, columnName);
var columnObject = template.sortingColumns.get(columnName);
'click div.sortingCell'(event, instance) {
const elementId = event.currentTarget.id;
// Remove _ from id
const columnName = elementId.replace('_', '');
let sortOption = {};
resetSortingColumns(instance, columnName);
const columnObject = instance.sortingColumns.get(columnName);
if (columnObject) {
template.sortingColumns.set(columnName, columnObject * -1);
instance.sortingColumns.set(columnName, columnObject * -1);
sortOption[columnName] = columnObject * -1;
} else {
template.sortingColumns.set(columnName, 1);
instance.sortingColumns.set(columnName, 1);
sortOption[columnName] = 1;
}
template.sortOption.set(sortOption);
instance.sortOption.set(sortOption);
Session.set('sortOption', sortOption);
}
});