Final adjustments to routing behaviors

This commit is contained in:
Bruno Alves de Faria committed 2017-03-21 10:16:47 -03:00
1 parent 9ccebb76bd
commit e12fb0de35
24 files changed
+226 -362

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@
{{/section}}
{{#section 'headerAfterBrand'}}
{{#if studyListToggleText}}
<a class="btn studyListLinkSection pull-left js-toggle-studyList" id="{{dasherize studyListToggleText}}-btn">
<a href="#" class="btn studyListLinkSection pull-left js-toggle-studyList" id="{{dasherize studyListToggleText}}-btn">
{{studyListToggleText}}
</a>
{{/if}}
+40 -37
View File
@@ -4,16 +4,10 @@ import { Router } from 'meteor/iron:router';
import { ReactiveVar } from 'meteor/reactive-var';
import { OHIF } from 'meteor/ohif:core';
const studylistContentId = 'studylistTab';
const viewerContentId = 'viewerTab';
// Define the OHIF.viewer.data global object
Template.app.onCreated(() => {
const instance = Template.instance();
instance.headerClasses = new ReactiveVar('');
OHIF.viewer.data = instance.data.viewerData || {};
OHIF.header.dropdown.setItems([{
action: OHIF.user.audit,
text: 'View Audit Log',
@@ -50,6 +44,9 @@ Template.app.onCreated(() => {
const routeName = currentRoute.route.getName();
const isViewer = routeName.indexOf('viewer') === 0;
// Define the OHIF.viewer.data global object
OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {};
// Add or remove the strech class from body
$(document.body)[isViewer ? 'addClass' : 'removeClass']('stretch');
@@ -62,23 +59,41 @@ Template.app.onCreated(() => {
});
Template.app.events({
'click .js-toggle-studyList'(event) {
OHIF.ui.unsavedChanges.presentProactiveDialog('viewer.*', (hasChanges, userChoice) => {
if (hasChanges) {
switch (userChoice) {
case 'abort-action':
return;
case 'save-changes':
OHIF.ui.unsavedChanges.trigger('viewer', 'save', false);
OHIF.ui.unsavedChanges.clear('viewer.*');
break;
case 'abandon-changes':
OHIF.ui.unsavedChanges.clear('viewer.*');
break;
}
'click .js-toggle-studyList'(event, instance) {
event.preventDefault();
event.stopPropagation();
const isViewer = Session.get('ViewerOpened');
if (!isViewer) {
const timepointId = OHIF.viewer.data.currentTimepointId;
if (timepointId) {
Router.go('viewerTimepoint', { timepointId });
} else {
const { studyInstanceUids } = OHIF.viewer.data;
Router.go('viewerStudies', { studyInstanceUids });
}
return;
}
OHIF.ui.unsavedChanges.presentProactiveDialog('viewer.*', (hasChanges, userChoice) => {
if (!hasChanges) {
return Router.go('studylist');
}
switch (userChoice) {
case 'abort-action':
return;
case 'save-changes':
OHIF.ui.unsavedChanges.trigger('viewer', 'save', false);
OHIF.ui.unsavedChanges.clear('viewer.*');
break;
case 'abandon-changes':
OHIF.ui.unsavedChanges.clear('viewer.*');
break;
}
Router.go('studylist');
}, {
position: {
x: event.clientX + 15,
@@ -92,24 +107,12 @@ Template.app.helpers({
userName: OHIF.user.getName,
studyListToggleText() {
const contentId = Session.get('activeContentId');
const isViewer = Session.get('ViewerOpened');
// If the Viewer has not been opened yet, 'Back to viewer' should
// not be displayed
const viewerContentExists = !!Object.keys(OHIF.viewer.data).length;
if (!viewerContentExists) {
return;
}
// Return empty if viewer was not opened yet
if (!OHIF.viewer.data.studyInstanceUids) return;
if (contentId === studylistContentId) {
return 'Back to viewer';
} else if (contentId === viewerContentId) {
return 'Study list';
}
},
onStudyList() {
return (Session.get('activeContentId') === 'studylistTab');
return isViewer ? 'Study list' : 'Back to viewer';
},
dasherize(text) {
@@ -86,12 +86,3 @@ body>.header
padding: 0
position: absolute
top: 0
#studylistTabs
height: "calc(100% - %s)" % $topBarHeight
.tab-pane
.viewerContainer
.loadingTextDiv
theme('color', '$textSecondaryColor')
font-size: 30px
@@ -1,15 +1,17 @@
<template name="viewer">
{{#if and Template.subscriptionsReady dataSourcesReady}}
<div class="viewerDialogs">
<div class="viewerDialogs">
{{#if and Template.subscriptionsReady dataSourcesReady}}
{{>confirmDeleteDialog}}
{{>measurementTableHUD (clone this)}}
{{>cineDialog}}
</div>
<div id="viewer">
{{/if}}
</div>
<div id="viewer">
{{#if and Template.subscriptionsReady dataSourcesReady}}
{{>toolbarSection (clone this)}}
{{>viewerSection (clone this)}}
</div>
{{else}}
{{>loadingText}}
{{/if}}
{{else}}
{{>loadingText}}
{{/if}}
</div>
</template>
@@ -36,7 +36,8 @@ Template.viewer.onCreated(() => {
const instance = Template.instance();
const { TimepointApi, MeasurementApi, ConformanceCriteria } = OHIF.measurements;
const currentTimepointId = instance.data.currentTimepointId;
const currentTimepointId = OHIF.viewer.data.currentTimepointId;
const timepointApi = new TimepointApi(currentTimepointId);
const measurementApi = new MeasurementApi(timepointApi);
const conformanceCriteria = new ConformanceCriteria(measurementApi, timepointApi);
@@ -88,6 +89,9 @@ Template.viewer.onCreated(() => {
OHIF.viewer.data.loadedSeriesData = {};
}
// Store the viewer data in session for further user
Session.setPersistent('ViewerData', OHIF.viewer.data);
Session.set('activeViewport', OHIF.viewer.data.activeViewport || false);
// Set lesion tool buttons as disabled if pixel spacing is not available for active element
@@ -156,13 +160,8 @@ Template.viewer.onCreated(() => {
measurementApi.priorTimepointId = prior.timepointId;
}
if (instance.data.currentTimepointId) {
// Enable Lesion Tracker Tools if the opened study is associated
OHIF.lesiontracker.toggleLesionTrackerToolsButtons(true);
} else {
// Disable Lesion Tracker Tools if the opened study is not associated
OHIF.lesiontracker.toggleLesionTrackerToolsButtons(false);
}
// Enable/Disable Lesion Tracker Tools if the opened study is associated or not
OHIF.lesiontracker.toggleLesionTrackerToolsButtons(!!currentTimepointId);
let firstMeasurementActivated = false;
instance.autorun(() => {
@@ -311,7 +310,7 @@ const initHangingProtocol = () => {
const layoutManager = OHIF.viewerbase.layoutManager;
// Instantiate StudyMetadataSource: necessary for Hanging Protocol to get study metadata
const studyMetadataSource = new StudyList.classes.OHIFStudyMetadataSource();
const studyMetadataSource = new OHIF.studylist.classes.OHIFStudyMetadataSource();
// Creates Protocol Engine object with required arguments
const ProtocolEngine = new HP.ProtocolEngine(layoutManager, studyMetadataList, [], studyMetadataSource);