fix: Misc. workflow fixes [OHIF-363] (#2040)
* fix: "Adding measurements to existing report" portion of issue * fix: notes from investigation to fix "Creating a new report while tracking measurements" * fix: "Measurements spanning multiple studies" * chore: comments explaining isDirty behavior
This commit is contained in:
parent
cae54b0779
commit
5a66920d1d
@ -292,12 +292,9 @@ const defaultOptions = {
|
||||
setIsDirtyToClean: assign((ctx, evt) => ({
|
||||
isDirty: false,
|
||||
})),
|
||||
setIsDirty: assign((ctx, evt) => {
|
||||
debugger;
|
||||
return {
|
||||
isDirty: true,
|
||||
};
|
||||
}),
|
||||
setIsDirty: assign((ctx, evt) => ({
|
||||
isDirty: true,
|
||||
})),
|
||||
ignoreSeries: assign((ctx, evt) => ({
|
||||
prevIgnoredSeries: [...ctx.ignoredSeries],
|
||||
ignoredSeries: [...ctx.ignoredSeries, evt.data.SeriesInstanceUID],
|
||||
@ -316,9 +313,26 @@ const defaultOptions = {
|
||||
})),
|
||||
},
|
||||
guards: {
|
||||
// We set dirty any time we performan an action that:
|
||||
// - Tracks a new study
|
||||
// - Tracks a new series
|
||||
// - Adds a measurement to an already tracked study/series
|
||||
//
|
||||
// We set clean any time we restore from an SR
|
||||
//
|
||||
// This guard/condition is specific to "new measurements"
|
||||
// to make sure we only track dirty when the new measurement is specific
|
||||
// to a series we're already tracking
|
||||
//
|
||||
// tl;dr
|
||||
// Any report change, that is not a hydration of an existing report, should
|
||||
// result in a "dirty" report
|
||||
//
|
||||
// Where dirty means there would be "loss of data" if we blew away measurements
|
||||
// without creating a new SR.
|
||||
shouldSetDirty: (ctx, evt) => {
|
||||
debugger;
|
||||
return (
|
||||
// When would this happen?
|
||||
evt.SeriesInstanceUID === undefined ||
|
||||
ctx.trackedSeries.includes(evt.SeriesInstanceUID)
|
||||
);
|
||||
|
||||
@ -17,13 +17,10 @@ function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
||||
viewportIndex
|
||||
);
|
||||
|
||||
if (ctx.isDirty && promptResult === RESPONSE.CREATE_REPORT) {
|
||||
promptResult = await _askSaveDiscardOrCancel(
|
||||
UIViewportDialogService,
|
||||
viewportIndex
|
||||
);
|
||||
} else {
|
||||
promptResult = RESPONSE.SET_STUDY_AND_SERIES;
|
||||
if (promptResult === RESPONSE.CREATE_REPORT) {
|
||||
promptResult = ctx.isDirty
|
||||
? await _askSaveDiscardOrCancel(UIViewportDialogService, viewportIndex)
|
||||
: RESPONSE.SET_STUDY_AND_SERIES;
|
||||
}
|
||||
|
||||
resolve({
|
||||
|
||||
@ -17,13 +17,10 @@ function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
||||
viewportIndex
|
||||
);
|
||||
|
||||
if (ctx.isDirty && promptResult === RESPONSE.SET_STUDY_AND_SERIES) {
|
||||
promptResult = await _askSaveDiscardOrCancel(
|
||||
UIViewportDialogService,
|
||||
viewportIndex
|
||||
);
|
||||
} else {
|
||||
promptResult = RESPONSE.SET_STUDY_AND_SERIES;
|
||||
if (promptResult === RESPONSE.SET_STUDY_AND_SERIES) {
|
||||
promptResult = ctx.isDirty
|
||||
? await _askSaveDiscardOrCancel(UIViewportDialogService, viewportIndex)
|
||||
: RESPONSE.SET_STUDY_AND_SERIES;
|
||||
}
|
||||
|
||||
resolve({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user