shortcut to view diagram from instance show

This commit is contained in:
burnettk 2024-02-21 17:22:34 -05:00
parent 802d80883c
commit 871bac4e77
No known key found for this signature in database
1 changed files with 21 additions and 0 deletions

View File

@ -64,6 +64,7 @@ import {
PermissionsToCheck, PermissionsToCheck,
ProcessData, ProcessData,
ProcessInstance, ProcessInstance,
ProcessModel,
Task, Task,
TaskDefinitionPropertiesJson, TaskDefinitionPropertiesJson,
User, User,
@ -157,6 +158,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
[targetUris.processInstanceSendEventPath]: ['POST'], [targetUris.processInstanceSendEventPath]: ['POST'],
[targetUris.processInstanceCompleteTaskPath]: ['POST'], [targetUris.processInstanceCompleteTaskPath]: ['POST'],
[targetUris.processModelShowPath]: ['PUT'], [targetUris.processModelShowPath]: ['PUT'],
[targetUris.processModelFileCreatePath]: ['GET'],
[taskListPath]: ['GET'], [taskListPath]: ['GET'],
}; };
const { ability, permissionsLoaded } = usePermissionFetcher( 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 = { const keyboardShortcuts: KeyboardShortcuts = {
'f,r,enter': { 'f,r,enter': {
function: forceRunProcessInstance, function: forceRunProcessInstance,
label: 'Force run process instance', label: 'Force run process instance',
}, },
'd,enter': {
function: shortcutLoadPrimaryFile,
label: 'View diagram',
},
}; };
const keyboardShortcutArea = useKeyboardShortcut(keyboardShortcuts); const keyboardShortcutArea = useKeyboardShortcut(keyboardShortcuts);