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:
Danny Brown 2020-09-16 21:56:51 -04:00 committed by GitHub
parent cae54b0779
commit 5a66920d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 21 deletions

View File

@ -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)
);

View File

@ -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({

View File

@ -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({