* workflow changes * Cherry pick OHIF-310 into this PR. * fix label bug and dead code * remove comment * Wire up CreateReportButton * fix additionalFindingTypes + save interaction * Remove unused createReportAsync call * stub for report hydration prompt * Update PR * Remove debuggers * push updated code * Push updates * push * fix sidebar save * enable tracking of new study or series * fix for duplicate created report series in sidebard * fix for unexpected viewport dialog after visiting study list then a new study * Fix for hydration not marking multiple series as active * Reviewer changes. * Respond to final review comment, add series description setting for export. Co-authored-by: James A. Petts <jamesapetts@gmail.com>
83 lines
2.0 KiB
JavaScript
83 lines
2.0 KiB
JavaScript
import hydrateStructuredReport from './_hydrateStructuredReport.js';
|
|
|
|
const RESPONSE = {
|
|
NO_NEVER: -1,
|
|
CANCEL: 0,
|
|
CREATE_REPORT: 1,
|
|
ADD_SERIES: 2,
|
|
SET_STUDY_AND_SERIES: 3,
|
|
NO_NOT_FOR_SERIES: 4,
|
|
HYDRATE_REPORT: 5,
|
|
};
|
|
|
|
function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
|
const { UIViewportDialogService } = servicesManager.services;
|
|
const { viewportIndex, displaySetInstanceUID } = evt;
|
|
|
|
return new Promise(async function(resolve, reject) {
|
|
const promptResult = await _askTrackMeasurements(
|
|
UIViewportDialogService,
|
|
viewportIndex
|
|
);
|
|
|
|
// Need to do action here... So we can set state...
|
|
let StudyInstanceUID, SeriesInstanceUIDs;
|
|
|
|
if (promptResult === RESPONSE.HYDRATE_REPORT) {
|
|
console.warn('!! HYDRATING STRUCTURED REPORT');
|
|
const hydrationResult = hydrateStructuredReport(
|
|
{ servicesManager, extensionManager },
|
|
displaySetInstanceUID
|
|
);
|
|
|
|
StudyInstanceUID = hydrationResult.StudyInstanceUID;
|
|
SeriesInstanceUIDs = hydrationResult.SeriesInstanceUIDs;
|
|
}
|
|
|
|
resolve({
|
|
userResponse: promptResult,
|
|
displaySetInstanceUID: evt.displaySetInstanceUID,
|
|
viewportIndex,
|
|
StudyInstanceUID,
|
|
SeriesInstanceUIDs,
|
|
});
|
|
});
|
|
}
|
|
|
|
function _askTrackMeasurements(UIViewportDialogService, viewportIndex) {
|
|
return new Promise(function(resolve, reject) {
|
|
const message =
|
|
'Do you want to continue tracking measurements for this study?';
|
|
const actions = [
|
|
{
|
|
type: 'secondary',
|
|
text: 'No',
|
|
value: RESPONSE.CANCEL,
|
|
},
|
|
{
|
|
type: 'primary',
|
|
text: 'Yes',
|
|
value: RESPONSE.HYDRATE_REPORT,
|
|
},
|
|
];
|
|
const onSubmit = result => {
|
|
UIViewportDialogService.hide();
|
|
resolve(result);
|
|
};
|
|
|
|
UIViewportDialogService.show({
|
|
viewportIndex,
|
|
type: 'info',
|
|
message,
|
|
actions,
|
|
onSubmit,
|
|
onOutsideClick: () => {
|
|
UIViewportDialogService.hide();
|
|
resolve(RESPONSE.CANCEL);
|
|
},
|
|
});
|
|
});
|
|
}
|
|
|
|
export default promptUser;
|