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:
parent
2b332ce110
commit
b92cebc9ff
|
@ -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,75 +1769,72 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (processInstance && (tasks || tasksCallHadError) && permissionsLoaded) {
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
const processModelId = unModifyProcessIdentifierForPathParam(
|
const getTabs = () => {
|
||||||
params.process_model_id ? params.process_model_id : ''
|
if (!processInstance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const canViewLogs = ability.can(
|
||||||
|
'GET',
|
||||||
|
targetUris.processInstanceLogListPath
|
||||||
);
|
);
|
||||||
|
const canViewMsgs = ability.can('GET', targetUris.messageInstanceListPath);
|
||||||
|
|
||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
const getMessageDisplay = () => {
|
||||||
const getTabs = () => {
|
if (canViewMsgs) {
|
||||||
const canViewLogs = ability.can(
|
return <MessageInstanceList processInstanceId={processInstance.id} />;
|
||||||
'GET',
|
}
|
||||||
targetUris.processInstanceLogListPath
|
return null;
|
||||||
);
|
|
||||||
const canViewMsgs = ability.can(
|
|
||||||
'GET',
|
|
||||||
targetUris.messageInstanceListPath
|
|
||||||
);
|
|
||||||
|
|
||||||
const getMessageDisplay = () => {
|
|
||||||
if (canViewMsgs) {
|
|
||||||
return <MessageInstanceList processInstanceId={processInstance.id} />;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Tabs selectedIndex={selectedTabIndex} onChange={updateSelectedTab}>
|
|
||||||
<TabList aria-label="List of tabs">
|
|
||||||
<Tab>Diagram</Tab>
|
|
||||||
<Tab disabled={!canViewLogs}>Milestones</Tab>
|
|
||||||
<Tab disabled={!canViewLogs}>Events</Tab>
|
|
||||||
<Tab disabled={!canViewMsgs}>Messages</Tab>
|
|
||||||
<Tab>Tasks</Tab>
|
|
||||||
</TabList>
|
|
||||||
<TabPanels>
|
|
||||||
<TabPanel>
|
|
||||||
{selectedTabIndex === 0 ? (
|
|
||||||
<TabPanel>{diagramArea(processModelId)}</TabPanel>
|
|
||||||
) : null}
|
|
||||||
</TabPanel>
|
|
||||||
<TabPanel>
|
|
||||||
{selectedTabIndex === 1 ? (
|
|
||||||
<ProcessInstanceLogList
|
|
||||||
variant={variant}
|
|
||||||
isEventsView={false}
|
|
||||||
processModelId={modifiedProcessModelId || ''}
|
|
||||||
processInstanceId={processInstance.id}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</TabPanel>
|
|
||||||
<TabPanel>
|
|
||||||
{selectedTabIndex === 2 ? (
|
|
||||||
<ProcessInstanceLogList
|
|
||||||
variant={variant}
|
|
||||||
isEventsView
|
|
||||||
processModelId={modifiedProcessModelId || ''}
|
|
||||||
processInstanceId={processInstance.id}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</TabPanel>
|
|
||||||
<TabPanel>
|
|
||||||
{selectedTabIndex === 3 ? getMessageDisplay() : null}
|
|
||||||
</TabPanel>
|
|
||||||
<TabPanel>
|
|
||||||
{selectedTabIndex === 4 ? taskTabSubTabs() : null}
|
|
||||||
</TabPanel>
|
|
||||||
</TabPanels>
|
|
||||||
</Tabs>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tabs selectedIndex={selectedTabIndex} onChange={updateSelectedTab}>
|
||||||
|
<TabList aria-label="List of tabs">
|
||||||
|
<Tab>Diagram</Tab>
|
||||||
|
<Tab disabled={!canViewLogs}>Milestones</Tab>
|
||||||
|
<Tab disabled={!canViewLogs}>Events</Tab>
|
||||||
|
<Tab disabled={!canViewMsgs}>Messages</Tab>
|
||||||
|
<Tab>Tasks</Tab>
|
||||||
|
</TabList>
|
||||||
|
<TabPanels>
|
||||||
|
<TabPanel>
|
||||||
|
{selectedTabIndex === 0 ? (
|
||||||
|
<TabPanel>{diagramArea()}</TabPanel>
|
||||||
|
) : null}
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel>
|
||||||
|
{selectedTabIndex === 1 ? (
|
||||||
|
<ProcessInstanceLogList
|
||||||
|
variant={variant}
|
||||||
|
isEventsView={false}
|
||||||
|
processModelId={modifiedProcessModelId || ''}
|
||||||
|
processInstanceId={processInstance.id}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel>
|
||||||
|
{selectedTabIndex === 2 ? (
|
||||||
|
<ProcessInstanceLogList
|
||||||
|
variant={variant}
|
||||||
|
isEventsView
|
||||||
|
processModelId={modifiedProcessModelId || ''}
|
||||||
|
processInstanceId={processInstance.id}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel>
|
||||||
|
{selectedTabIndex === 3 ? getMessageDisplay() : null}
|
||||||
|
</TabPanel>
|
||||||
|
<TabPanel>
|
||||||
|
{selectedTabIndex === 4 ? taskTabSubTabs() : null}
|
||||||
|
</TabPanel>
|
||||||
|
</TabPanels>
|
||||||
|
</Tabs>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (processInstance && permissionsLoaded) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProcessBreadcrumb
|
<ProcessBreadcrumb
|
||||||
|
@ -1879,5 +1883,5 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue