feat(STOW-RS) Save DICOM Structured Reports from Measurement Table back to archive (#236)

* Small refactor into Table Class setting events as static object into class

* feature(STOW-SR) : Initial changes to stow when we have Server.

* Improvements into requests and small fix into style

* Small fix for jumpToRow without refheshing page

* Handling STOW-SR once we don't have server

* feature(STOW-SR) Refactor

* Merge request with makeRequest and delete old file

* Expose wadoproxy to client and update measurement-table to start using wadoproxy.getServerUrl

* Move WADOProxy.getServerUrl to Measurement-table package. Fix querystring issue.

* Remove proxy:enabled in favour of requestOptions.requestFromBrowser

* Bcrypt 2.0.0 to fix Travis
This commit is contained in:
Gustavo André Lelis authored and Erik Ziegler committed 2018-07-31 15:01:26 +02:00
1 parent 13e4dc25e1
commit 26b14f1dab
26 files changed
+1079 -179

No files matched your search

@@ -9,4 +9,21 @@
{{/each}}
{{/each}}
{{/let}}
{{#if hasAnyMeasurement}}
<div class="report-area">
{{#if saveEnabled}}
{{#if hasUnsavedChanges}}
<div class="unsaved-changes-alert">
You have unsaved changes
</div>
{{/if}}
{{/if}}
{{#form (extend api=instance.api)}}
{{#button class='btn p-x-2' action='exportCSV'}}Export CSV{{/button}}
{{#if saveEnabled}}
{{#button class='btn p-x-2' action='save' disabled=(not hasUnsavedChanges)}}Save to Archive{{/button}}
{{/if}}
{{/form}}
</div>
{{/if}}
</template>
@@ -8,9 +8,68 @@ Template.measurementLightTableView.onCreated(() => {
instance.data.measurementGroups = new ReactiveVar();
instance.path = 'viewer.studyViewer.measurements';
instance.saveObserver = new Tracker.Dependency();
instance.api = {
save() {
const successHandler = () => {
OHIF.ui.unsavedChanges.clear(`${instance.path}.*`);
instance.saveObserver.changed();
};
// Display the error messages
const errorHandler = data => {
OHIF.ui.showDialog('dialogInfo', Object.assign({ class: 'themed' }, data));
};
const promise = instance.data.measurementApi.storeMeasurements();
promise.then(successHandler).catch(errorHandler);
OHIF.ui.showDialog('dialogLoading', {
promise,
text: 'Measurements saved.'
});
return promise;
},
exportCSV() {
const { measurementApi, timepointApi } = instance.data;
OHIF.measurements.exportCSV(measurementApi, timepointApi);
}
};
instance.autorun(() => {
measurementApi.changeObserver.depend();
const data = OHIF.measurements.getMeasurementsGroupedByNumber(measurementApi, timepointApi);
instance.data.measurementGroups.set(data);
});
});
Template.measurementLightTableView.helpers({
hasUnsavedChanges() {
const instance = Template.instance();
// Run this computation on save or every time any measurement / timepoint suffer changes
OHIF.ui.unsavedChanges.depend();
instance.saveObserver.depend();
return OHIF.ui.unsavedChanges.probe('viewer.*') !== 0;
},
hasAnyMeasurement() {
const instance = Template.instance();
const groups = instance.data.measurementGroups.get();
if (!groups) {
return false;
}
const group = groups.find(item => item.measurementRows.length > 0);
return group;
},
saveEnabled() {
const server = OHIF.servers.getCurrentServer();
return (server && server.type === 'dicomWeb');
}
});
@@ -11,3 +11,9 @@
theme('background-color', '$activeColor')
theme('border', '1px solid $uiBorderColorActive')
color: #000
.unsaved-changes-alert
padding-bottom: 10px;
font-size: 11px;
color: #FF0;
font-weight: 100;