Skip to content

Commit

Permalink
feat(orchestrator): add Variables card (#2305)
Browse files Browse the repository at this point in the history
A temporary solution till we have proper Input Parameters card (tracked in FLPATH-1736)

Fixes: FLPATH-1737
  • Loading branch information
mareklibra authored Oct 6, 2024
1 parent 167acc8 commit 1e520dd
Showing 1 changed file with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { WorkflowProgress } from './WorkflowProgress';
import { WorkflowResult } from './WorkflowResult';
import { WorkflowRunDetail } from './WorkflowRunDetail';
import { WorkflowRunDetails } from './WorkflowRunDetails';
import { WorkflowVariablesViewer } from './WorkflowVariablesViewer';

export const mapProcessInstanceToDetails = (
instance: ProcessInstanceDTO,
Expand Down Expand Up @@ -48,9 +49,10 @@ const useStyles = makeStyles(_ => ({
height: '20rem',
},
middleRowCard: {
height: 'calc(2 * 20rem)',
height: '20rem',
},
bottomRowCard: {
minHeight: '40rem',
height: '100%',
},
autoOverflow: { overflow: 'auto' },
Expand All @@ -72,10 +74,22 @@ export const WorkflowInstancePageContent: React.FC<{
[assessedInstance.instance],
);

const workflowdata = assessedInstance.instance?.workflowdata;
let instanceVariables;
if (workflowdata) {
instanceVariables = {
/* Since we are about to remove just the top-level property, shallow copy of the object is sufficient */
...workflowdata,
};
if (instanceVariables.hasOwnProperty('result')) {
delete instanceVariables.result;
}
}

return (
<Content noPadding>
<Grid container spacing={2}>
<Grid item xs={6}>
<Grid item xs={12}>
<InfoCard
title="Details"
divider={false}
Expand All @@ -84,16 +98,29 @@ export const WorkflowInstancePageContent: React.FC<{
<WorkflowRunDetails
details={details}
assessedBy={assessedInstance.assessedBy}
completedWith={
assessedInstance.instance?.workflowdata?.result?.completedWith
}
completedWith={workflowdata?.result?.completedWith}
/>
</InfoCard>
</Grid>

<Grid item xs={6}>
<InfoCard
title="Variables"
divider={false}
className={styles.middleRowCard}
>
{instanceVariables && (
<WorkflowVariablesViewer variables={instanceVariables} />
)}
{!instanceVariables && (
<div>The workflow instance has no variables</div>
)}
</InfoCard>
</Grid>
<Grid item xs={6}>
<WorkflowResult
assessedInstance={assessedInstance}
className={styles.topRowCard}
className={styles.middleRowCard}
cardClassName={styles.autoOverflow}
/>
</Grid>
Expand All @@ -102,7 +129,7 @@ export const WorkflowInstancePageContent: React.FC<{
<InfoCard
title="Workflow definition"
divider={false}
className={styles.middleRowCard}
className={styles.bottomRowCard}
>
<WorkflowEditor
workflowId={assessedInstance.instance.processId}
Expand All @@ -116,7 +143,7 @@ export const WorkflowInstancePageContent: React.FC<{
<InfoCard
title="Workflow progress"
divider={false}
className={styles.middleRowCard}
className={styles.bottomRowCard}
cardClassName={styles.autoOverflow}
>
<WorkflowProgress
Expand Down

0 comments on commit 1e520dd

Please sign in to comment.