updated process instance show page to change metdata to details w/ burnettk

This commit is contained in:
jasquat 2023-03-08 14:45:12 -05:00
parent d45b9d1ff5
commit 6e363eb7fc
1 changed files with 36 additions and 87 deletions

View File

@ -80,7 +80,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
const [eventPayload, setEventPayload] = useState<string>('{}'); const [eventPayload, setEventPayload] = useState<string>('{}');
const [eventTextEditorEnabled, setEventTextEditorEnabled] = const [eventTextEditorEnabled, setEventTextEditorEnabled] =
useState<boolean>(false); useState<boolean>(false);
const [displayDetails, setDisplayDetails] = useState<boolean>(false);
const [showProcessInstanceMetadata, setShowProcessInstanceMetadata] = const [showProcessInstanceMetadata, setShowProcessInstanceMetadata] =
useState<boolean>(false); useState<boolean>(false);
@ -304,92 +303,26 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
}); });
}; };
const detailedViewElement = () => {
if (!processInstance) {
return null;
}
if (displayDetails) {
return (
<>
<Grid condensed fullWidth>
<Button
kind="ghost"
className="button-link"
onClick={() => setDisplayDetails(false)}
title="Hide Details"
>
&laquo; Hide Details
</Button>
</Grid>
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title">
Updated At:{' '}
</Column>
<Column sm={3} md={3} lg={3} className="grid-date">
{convertSecondsToFormattedDateTime(
processInstance.updated_at_in_seconds
)}
</Column>
</Grid>
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title">
Created At:{' '}
</Column>
<Column sm={3} md={3} lg={3} className="grid-date">
{convertSecondsToFormattedDateTime(
processInstance.created_at_in_seconds
)}
</Column>
</Grid>
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title">
Process model revision:{' '}
</Column>
<Column sm={3} md={3} lg={3} className="grid-date">
{processInstance.bpmn_version_control_identifier} (
{processInstance.bpmn_version_control_type})
</Column>
</Grid>
</>
);
}
return (
<Grid condensed fullWidth>
<Button
kind="ghost"
className="button-link"
onClick={() => setDisplayDetails(true)}
title="Show Details"
>
View Details &raquo;
</Button>
</Grid>
);
};
const getInfoTag = () => { const getInfoTag = () => {
if (!processInstance) { if (!processInstance) {
return null; return null;
} }
const currentEndDate = convertSecondsToFormattedDateTime( let lastUpdatedTimeLabel = 'Updated At';
processInstance.end_in_seconds || 0 let lastUpdatedTime = processInstance.updated_at_in_seconds;
); if (processInstance.end_in_seconds) {
let currentEndDateTag; lastUpdatedTimeLabel = 'Completed';
if (currentEndDate) { lastUpdatedTime = processInstance.end_in_seconds;
currentEndDateTag = ( }
const lastUpdatedTimeTag = (
<Grid condensed fullWidth> <Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title"> <Column sm={1} md={1} lg={2} className="grid-list-title">
Completed:{' '} {lastUpdatedTimeLabel}:{' '}
</Column> </Column>
<Column sm={3} md={3} lg={3} className="grid-date"> <Column sm={3} md={3} lg={3} className="grid-date">
{convertSecondsToFormattedDateTime( {convertSecondsToFormattedDateTime(lastUpdatedTime || 0) || 'N/A'}
processInstance.end_in_seconds || 0
) || 'N/A'}
</Column> </Column>
</Grid> </Grid>
); );
}
let statusIcon = <InProgress />; let statusIcon = <InProgress />;
if (processInstance.status === 'suspended') { if (processInstance.status === 'suspended') {
@ -433,13 +366,30 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
<Column sm={1} md={1} lg={2} className="grid-list-title"> <Column sm={1} md={1} lg={2} className="grid-list-title">
Started:{' '} Started:{' '}
</Column> </Column>
<Column sm={3} md={3} lg={3} className="grid-date"> <Column
sm={3}
md={3}
lg={3}
className="grid-date"
title={`Created At: ${convertSecondsToFormattedDateTime(
processInstance.created_at_in_seconds
)}`}
>
{convertSecondsToFormattedDateTime( {convertSecondsToFormattedDateTime(
processInstance.start_in_seconds || 0 processInstance.start_in_seconds || 0
)} )}
</Column> </Column>
</Grid> </Grid>
{currentEndDateTag} {lastUpdatedTimeTag}
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title">
Process model revision:{' '}
</Column>
<Column sm={3} md={3} lg={3} className="grid-date">
{processInstance.bpmn_version_control_identifier} (
{processInstance.bpmn_version_control_type})
</Column>
</Grid>
<Grid condensed fullWidth> <Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title"> <Column sm={1} md={1} lg={2} className="grid-list-title">
Status:{' '} Status:{' '}
@ -450,7 +400,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
</Tag> </Tag>
</Column> </Column>
</Grid> </Grid>
{detailedViewElement()}
<br /> <br />
<Grid condensed fullWidth> <Grid condensed fullWidth>
<Column sm={2} md={2} lg={2}> <Column sm={2} md={2} lg={2}>
@ -493,7 +442,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
setShowProcessInstanceMetadata(true); setShowProcessInstanceMetadata(true);
}} }}
> >
Metadata Details
</Button> </Button>
) : null} ) : null}
</ButtonSet> </ButtonSet>
@ -1012,7 +961,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
return ( return (
<Modal <Modal
open={showProcessInstanceMetadata} open={showProcessInstanceMetadata}
modalHeading="Metadata" modalHeading="Details"
passiveModal passiveModal
onRequestClose={() => setShowProcessInstanceMetadata(false)} onRequestClose={() => setShowProcessInstanceMetadata(false)}
> >