Improving "Add/Edit Description" workflow

This commit is contained in:
Bruno Alves de Faria committed 2018-03-07 08:25:59 -03:00
1 parent d486ebd551
commit 3bd44fd7bc
12 files changed
+69 -19

No files matched your search

@@ -0,0 +1,23 @@
import { OHIF } from 'meteor/ohif:core';
/**
* Updates the measurements' description for a measurement number across all timepoints
*
* @param measurementData base measurement data that must contain toolType and measurementNumber
* @param description measurement description that will be used
*/
OHIF.measurements.updateMeasurementsDescription = (measurementData, description) => {
const { toolType, measurementNumber } = measurementData;
measurementData.description = description;
const filter = { measurementNumber };
const operator = { $set: { description } };
const options = { multi: true };
const { toolGroup } = OHIF.measurements.getToolConfiguration(toolType);
toolGroup.childTools.forEach(childTool => {
const collection = OHIF.viewer.measurementApi.tools[childTool.id];
collection.update(filter, operator, options);
});
// Notify that viewer suffered changes
OHIF.measurements.triggerTimepointUnsavedChanges('relabel');
};