load what can be loaded on the pi show page while task-info loads w/ burnettk (#1600)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-05-23 15:57:58 +00:00 committed by GitHub
parent 2b332ce110
commit b92cebc9ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 71 additions and 67 deletions

View File

@ -138,7 +138,11 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
const unModifiedProcessModelId = unModifyProcessIdentifierForPathParam(
`${params.process_model_id}`
);
const modifiedProcessModelId = params.process_model_id;
const processModelId = unModifyProcessIdentifierForPathParam(
params.process_model_id ? params.process_model_id : ''
);
const { targetUris } = useUriListForPermissions();
const taskListPath =
@ -1655,10 +1659,13 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
);
};
const diagramArea = (processModelId: string) => {
const diagramArea = () => {
if (!processInstance) {
return null;
}
if (!tasks && !tasksCallHadError) {
return <Loading className="some-class" withOverlay={false} small />;
}
const detailsComponent = (
<>
@ -1762,21 +1769,17 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
);
};
if (processInstance && (tasks || tasksCallHadError) && permissionsLoaded) {
const processModelId = unModifyProcessIdentifierForPathParam(
params.process_model_id ? params.process_model_id : ''
);
// eslint-disable-next-line sonarjs/cognitive-complexity
const getTabs = () => {
if (!processInstance) {
return null;
}
const canViewLogs = ability.can(
'GET',
targetUris.processInstanceLogListPath
);
const canViewMsgs = ability.can(
'GET',
targetUris.messageInstanceListPath
);
const canViewMsgs = ability.can('GET', targetUris.messageInstanceListPath);
const getMessageDisplay = () => {
if (canViewMsgs) {
@ -1797,7 +1800,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
<TabPanels>
<TabPanel>
{selectedTabIndex === 0 ? (
<TabPanel>{diagramArea(processModelId)}</TabPanel>
<TabPanel>{diagramArea()}</TabPanel>
) : null}
</TabPanel>
<TabPanel>
@ -1831,6 +1834,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
);
};
if (processInstance && permissionsLoaded) {
return (
<>
<ProcessBreadcrumb
@ -1879,5 +1883,5 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
</>
);
}
return null;
return <Loading />;
}