Fixing baseline saving on LesionTracker
This commit is contained in:
parent
b4bb44625c
commit
6edd34ea5e
@ -1,6 +1,5 @@
|
|||||||
import { Blaze } from 'meteor/blaze';
|
import { Blaze } from 'meteor/blaze';
|
||||||
import { Template } from 'meteor/templating';
|
import { Template } from 'meteor/templating';
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
|
||||||
import { _ } from 'meteor/underscore';
|
import { _ } from 'meteor/underscore';
|
||||||
import { $ } from 'meteor/jquery';
|
import { $ } from 'meteor/jquery';
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { Tracker } from 'meteor/tracker';
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
import { _ } from 'meteor/underscore';
|
import { _ } from 'meteor/underscore';
|
||||||
|
|
||||||
@ -315,13 +316,24 @@ export const unsavedChanges = {
|
|||||||
|
|
||||||
rootNode: rootNode,
|
rootNode: rootNode,
|
||||||
|
|
||||||
|
observer: new Tracker.Dependency(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a reactive dependency on every change any path suffers
|
||||||
|
*/
|
||||||
|
depend: function() {
|
||||||
|
return this.observer.depend();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal an unsaved change for a given namespace.
|
* Signal an unsaved change for a given namespace.
|
||||||
* @param {String} path A string (e.g., "viewer.studyViewer.measurements.targets") that identifies the namespace of the signaled changes.
|
* @param {String} path A string (e.g., "viewer.studyViewer.measurements.targets") that identifies the namespace of the signaled changes.
|
||||||
* @return {Boolean} Returns false if the signal could not be saved or the supplied namespace is invalid. Otherwise, true is returned.
|
* @return {Boolean} Returns false if the signal could not be saved or the supplied namespace is invalid. Otherwise, true is returned.
|
||||||
*/
|
*/
|
||||||
set: function(path) {
|
set: function(path) {
|
||||||
return rootNode.appendPath(path, 1);
|
const result = rootNode.appendPath(path, 1);
|
||||||
|
this.observer.changed();
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,7 +346,9 @@ export const unsavedChanges = {
|
|||||||
* @return {Boolean} Returns false if the signal could not be removed or the supplied namespace is invalid. Otherwise, true is returned.
|
* @return {Boolean} Returns false if the signal could not be removed or the supplied namespace is invalid. Otherwise, true is returned.
|
||||||
*/
|
*/
|
||||||
clear: function(path, recursively) {
|
clear: function(path, recursively) {
|
||||||
return rootNode.clearPath(path, typeof recursively === UNDEFINED ? true : recursively);
|
const result = rootNode.clearPath(path, typeof recursively === UNDEFINED ? true : recursively);
|
||||||
|
this.observer.changed();
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template name="caseProgress">
|
<template name="caseProgress">
|
||||||
<div class="caseProgress">
|
{{#form (extend class='caseProgress' api=instance.api)}}
|
||||||
{{#unless progressComplete}}
|
{{#unless progressComplete}}
|
||||||
{{>radialProgressBar isLocked=isLocked progressPercent=progressPercent progressText=progressText}}
|
{{>radialProgressBar isLocked=isLocked progressPercent=progressPercent progressText=progressText}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
@ -10,8 +10,8 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if progressComplete}}
|
{{#if progressComplete}}
|
||||||
<div class="caseProgressStatus">
|
<div class="caseProgressStatus">
|
||||||
<button class="btn js-finish-case {{valueIf isFinishDisabled 'disabled' ''}}">Save</button>
|
{{#button class='btn' action='save' disabled=(isFinishDisabled)}}Save{{/button}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
{{/form}}
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -13,7 +13,8 @@ Template.caseProgress.onCreated(() => {
|
|||||||
instance.path = 'viewer.studyViewer.measurements';
|
instance.path = 'viewer.studyViewer.measurements';
|
||||||
instance.saveObserver = new Tracker.Dependency();
|
instance.saveObserver = new Tracker.Dependency();
|
||||||
|
|
||||||
instance.saveData = () => {
|
instance.api = {
|
||||||
|
save() {
|
||||||
// Clear signaled unsaved changes...
|
// Clear signaled unsaved changes...
|
||||||
const successHandler = () => {
|
const successHandler = () => {
|
||||||
OHIF.ui.unsavedChanges.clear(`${instance.path}.*`);
|
OHIF.ui.unsavedChanges.clear(`${instance.path}.*`);
|
||||||
@ -31,12 +32,13 @@ Template.caseProgress.onCreated(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.unsavedChangesHandler = () => {
|
instance.unsavedChangesHandler = () => {
|
||||||
const isNotDisabled = !instance.$('.js-finish-case').hasClass('disabled');
|
const isNotDisabled = !instance.$('.js-finish-case').hasClass('disabled');
|
||||||
if (isNotDisabled && instance.progressPercent.get() === 100) {
|
if (isNotDisabled && instance.progressPercent.get() === 100) {
|
||||||
instance.saveData();
|
instance.api.save();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -171,22 +173,10 @@ Template.caseProgress.helpers({
|
|||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
// Run this computation on save or every time any measurement / timepoint suffer changes
|
// Run this computation on save or every time any measurement / timepoint suffer changes
|
||||||
|
OHIF.ui.unsavedChanges.depend();
|
||||||
instance.saveObserver.depend();
|
instance.saveObserver.depend();
|
||||||
Session.get('LayoutManagerUpdated');
|
Session.get('LayoutManagerUpdated');
|
||||||
|
|
||||||
return OHIF.ui.unsavedChanges.probe('viewer.*') === 0;
|
return OHIF.ui.unsavedChanges.probe('viewer.*') === 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.caseProgress.events({
|
|
||||||
'click .js-finish-case'(event, instance) {
|
|
||||||
const $this = $(event.currentTarget);
|
|
||||||
|
|
||||||
// Stop here if the tool is disabled
|
|
||||||
if ($this.hasClass('disabled')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
instance.saveData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|||||||
@ -88,6 +88,9 @@ Template.measurementTableRow.events({
|
|||||||
|
|
||||||
// Repaint the images on all viewports without the removed measurements
|
// Repaint the images on all viewports without the removed measurements
|
||||||
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
||||||
|
|
||||||
|
// Notify that viewer suffered changes
|
||||||
|
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.deleted');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -52,6 +52,9 @@ OHIF.measurements.toggleLabelButton = options => {
|
|||||||
});
|
});
|
||||||
options.measurement.location = location;
|
options.measurement.location = location;
|
||||||
options.measurement.description = description;
|
options.measurement.description = description;
|
||||||
|
|
||||||
|
// Notify that viewer suffered changes
|
||||||
|
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.renamed');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
buttonView = Blaze.renderWithData(Template.measureFlow, data, options.element);
|
buttonView = Blaze.renderWithData(Template.measureFlow, data, options.element);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user