fix: Several new worklist issues (#6130)
* fix: Several new worklist issues * refactor: Export a single OnStudyDoubleClick type from the StudyList barrel Addresses PR review feedback: the double-click handler signature was written out in both TableProps and the WorkList customization cast, so the two could drift apart. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat: Run worklist study double-click as a command, registrable by modes - Modes can now export getCommandsModule on their definition; appInit registers it (via the new ExtensionManager.registerCommandsModule) before the mode is instantiated, in a new 'WORKLIST' commands context, so the commands are available on the worklist before any mode route is entered. - The workList.onStudyDoubleClick customization is now a command run input (name/options) instead of a bare function, defaulting to the new launchDefaultMode command, which launches the default workflow falling back to the first applicable one. commandOptions.workflowId overrides it to a specific mode. - Duplicate mode ids are now skipped before running their modeFactory rather than after. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dbb8b1526e
commit
6b6761088b
11 files changed
+230
-27
No files matched your search
@@ -842,6 +842,33 @@ const commandsModule = ({
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Launches a workflow (mode) for a study from the worklist. This is the
|
||||
* default `workList.onStudyDoubleClick` command.
|
||||
*
|
||||
* @param study - the StudyRow the action applies to
|
||||
* @param workflows - the workflows applicable to the study, in menu order;
|
||||
* each has `id`, `displayName`, `isDefault` and `launchWithStudy(study)`
|
||||
* @param defaultWorkflow - the user's default workflow when it applies to
|
||||
* the study
|
||||
* @param workflowId - command option to force a specific workflow (mode id)
|
||||
* instead of the default/first applicable one
|
||||
*/
|
||||
launchDefaultMode: ({ study, workflows = [], defaultWorkflow, workflowId }) => {
|
||||
const workflow = workflowId
|
||||
? workflows.find(w => w.id === workflowId)
|
||||
: (defaultWorkflow ?? workflows[0]);
|
||||
if (!workflow) {
|
||||
console.warn(
|
||||
workflowId
|
||||
? `launchDefaultMode: workflow '${workflowId}' is not applicable to the study`
|
||||
: 'launchDefaultMode: no workflow is applicable to the study'
|
||||
);
|
||||
return;
|
||||
}
|
||||
workflow.launchWithStudy(study);
|
||||
},
|
||||
};
|
||||
|
||||
const definitions = {
|
||||
@@ -871,6 +898,10 @@ const commandsModule = ({
|
||||
addDisplaySetAsLayer: actions.addDisplaySetAsLayer,
|
||||
removeDisplaySetLayer: actions.removeDisplaySetLayer,
|
||||
createStoreFunction: actions.createStoreFunction,
|
||||
launchDefaultMode: {
|
||||
commandFn: actions.launchDefaultMode,
|
||||
context: 'WORKLIST',
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user