From 871bac4e77e0507a971bdf21492d77efcfac5194 Mon Sep 17 00:00:00 2001 From: burnettk Date: Wed, 21 Feb 2024 17:22:34 -0500 Subject: [PATCH] shortcut to view diagram from instance show --- .../src/routes/ProcessInstanceShow.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index a848b28e..5064c9b9 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -64,6 +64,7 @@ import { PermissionsToCheck, ProcessData, ProcessInstance, + ProcessModel, Task, TaskDefinitionPropertiesJson, User, @@ -157,6 +158,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { [targetUris.processInstanceSendEventPath]: ['POST'], [targetUris.processInstanceCompleteTaskPath]: ['POST'], [targetUris.processModelShowPath]: ['PUT'], + [targetUris.processModelFileCreatePath]: ['GET'], [taskListPath]: ['GET'], }; const { ability, permissionsLoaded } = usePermissionFetcher( @@ -195,11 +197,30 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { } }; + const shortcutLoadPrimaryFile = () => { + if (ability.can('GET', targetUris.processInstanceActionPath)) { + const processResult = (result: ProcessModel) => { + const primaryFileName = result.primary_file_name; + navigate( + `/editor/process-models/${modifiedProcessModelId}/files/${primaryFileName}` + ); + }; + HttpService.makeCallToBackend({ + path: `/process-models/${modifiedProcessModelId}?include_file_references=true`, + successCallback: processResult, + }); + } + }; + const keyboardShortcuts: KeyboardShortcuts = { 'f,r,enter': { function: forceRunProcessInstance, label: 'Force run process instance', }, + 'd,enter': { + function: shortcutLoadPrimaryFile, + label: 'View diagram', + }, }; const keyboardShortcutArea = useKeyboardShortcut(keyboardShortcuts);