feat(hangingProtocols): added selection of the HangingProtocol stage from the url (#4310)
This commit is contained in:
1 parent
e8f9345b93
commit
fa2435d5e9
4 files changed
+26
-6
No files matched your search
@@ -66,6 +66,7 @@ export default function ModeRoute({
|
||||
const { extensions, sopClassHandlers, hotkeys: hotkeyObj, hangingProtocol } = mode;
|
||||
|
||||
const runTimeHangingProtocolId = lowerCaseSearchParams.get('hangingprotocolid');
|
||||
const runTimeStageId = lowerCaseSearchParams.get('stageid');
|
||||
const token = lowerCaseSearchParams.get('token');
|
||||
|
||||
if (token) {
|
||||
@@ -216,6 +217,16 @@ export default function ModeRoute({
|
||||
? runTimeHangingProtocolId
|
||||
: hangingProtocol;
|
||||
|
||||
// Determine the index of the stageId if the hangingProtocolIdToUse is defined
|
||||
const stageIndex = hangingProtocolIdToUse
|
||||
? hangingProtocolService.getStageIndex(hangingProtocolIdToUse, {
|
||||
stageId: runTimeStageId || undefined,
|
||||
})
|
||||
: -1;
|
||||
// Ensure that the stage index is never negative
|
||||
// If stageIndex is negative (e.g., if stage wasn't found), use 0 as the default
|
||||
const stageIndexToUse = Math.max(0, stageIndex);
|
||||
|
||||
// Sets the active hanging protocols - if hangingProtocol is undefined,
|
||||
// resets to default. Done before the onModeEnter to allow the onModeEnter
|
||||
// to perform custom hanging protocol actions
|
||||
@@ -265,7 +276,8 @@ export default function ModeRoute({
|
||||
dataSource,
|
||||
filters,
|
||||
},
|
||||
hangingProtocolIdToUse
|
||||
hangingProtocolIdToUse,
|
||||
stageIndexToUse
|
||||
);
|
||||
}
|
||||
|
||||
@@ -277,7 +289,8 @@ export default function ModeRoute({
|
||||
filters,
|
||||
appConfig,
|
||||
},
|
||||
hangingProtocolIdToUse
|
||||
hangingProtocolIdToUse,
|
||||
stageIndexToUse
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user