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) => ({
|
setIsDirtyToClean: assign((ctx, evt) => ({
|
||||||
isDirty: false,
|
isDirty: false,
|
||||||
})),
|
})),
|
||||||
setIsDirty: assign((ctx, evt) => {
|
setIsDirty: assign((ctx, evt) => ({
|
||||||
debugger;
|
isDirty: true,
|
||||||
return {
|
})),
|
||||||
isDirty: true,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
ignoreSeries: assign((ctx, evt) => ({
|
ignoreSeries: assign((ctx, evt) => ({
|
||||||
prevIgnoredSeries: [...ctx.ignoredSeries],
|
prevIgnoredSeries: [...ctx.ignoredSeries],
|
||||||
ignoredSeries: [...ctx.ignoredSeries, evt.data.SeriesInstanceUID],
|
ignoredSeries: [...ctx.ignoredSeries, evt.data.SeriesInstanceUID],
|
||||||
@ -316,9 +313,26 @@ const defaultOptions = {
|
|||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
guards: {
|
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) => {
|
shouldSetDirty: (ctx, evt) => {
|
||||||
debugger;
|
|
||||||
return (
|
return (
|
||||||
|
// When would this happen?
|
||||||
evt.SeriesInstanceUID === undefined ||
|
evt.SeriesInstanceUID === undefined ||
|
||||||
ctx.trackedSeries.includes(evt.SeriesInstanceUID)
|
ctx.trackedSeries.includes(evt.SeriesInstanceUID)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -17,13 +17,10 @@ function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
|||||||
viewportIndex
|
viewportIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ctx.isDirty && promptResult === RESPONSE.CREATE_REPORT) {
|
if (promptResult === RESPONSE.CREATE_REPORT) {
|
||||||
promptResult = await _askSaveDiscardOrCancel(
|
promptResult = ctx.isDirty
|
||||||
UIViewportDialogService,
|
? await _askSaveDiscardOrCancel(UIViewportDialogService, viewportIndex)
|
||||||
viewportIndex
|
: RESPONSE.SET_STUDY_AND_SERIES;
|
||||||
);
|
|
||||||
} else {
|
|
||||||
promptResult = RESPONSE.SET_STUDY_AND_SERIES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
|
|||||||
@ -17,13 +17,10 @@ function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
|||||||
viewportIndex
|
viewportIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ctx.isDirty && promptResult === RESPONSE.SET_STUDY_AND_SERIES) {
|
if (promptResult === RESPONSE.SET_STUDY_AND_SERIES) {
|
||||||
promptResult = await _askSaveDiscardOrCancel(
|
promptResult = ctx.isDirty
|
||||||
UIViewportDialogService,
|
? await _askSaveDiscardOrCancel(UIViewportDialogService, viewportIndex)
|
||||||
viewportIndex
|
: RESPONSE.SET_STUDY_AND_SERIES;
|
||||||
);
|
|
||||||
} else {
|
|
||||||
promptResult = RESPONSE.SET_STUDY_AND_SERIES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user