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