Skip to content

Commit

Permalink
fix(orchestrator): remove completedWith status (#2570)
Browse files Browse the repository at this point in the history
fix(orchestrator): remove completedWith status  (#2511)

fix(orchestrator): remove completedWith status

FLPATH-1845

Signed-off-by: Marek Libra <mlibra@redhat.com>
Co-authored-by: Marek Libra <marek.libra@gmail.com>
  • Loading branch information
batzionb and mareklibra authored Nov 27, 2024
1 parent b05d144 commit 8ac72a1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .changeset/unlucky-jars-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export const WorkflowInstancePageContent: React.FC<{
<WorkflowRunDetails
details={details}
assessedBy={assessedInstance.assessedBy}
completedWith={workflowdata?.result?.completedWith}
/>
</InfoCard>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import DotIcon from '@material-ui/icons/FiberManualRecord';
import {
capitalize,
ProcessInstanceStatusDTO,
WorkflowResultDTOCompletedWithEnum,
} from '@janus-idp/backstage-plugin-orchestrator-common';

import { VALUE_UNAVAILABLE } from '../constants';
Expand All @@ -18,40 +17,26 @@ import { workflowInstanceRouteRef } from '../routes';
export const WorkflowInstanceStatusIndicator = ({
status,
lastRunId,
completedWith,
}: {
status?: ProcessInstanceStatusDTO;
lastRunId?: string;
completedWith?: WorkflowResultDTOCompletedWithEnum;
}) => {
const iconColor = useWorkflowInstanceStateColors(
status === ProcessInstanceStatusDTO.Completed && completedWith === 'error'
? ProcessInstanceStatusDTO.Error
: status,
);
const iconColor = useWorkflowInstanceStateColors(status);
const workflowInstanceLink = useRouteRef(workflowInstanceRouteRef);

if (!status) {
return VALUE_UNAVAILABLE;
}

let statusText: string = status;
if (
status === ProcessInstanceStatusDTO.Completed &&
completedWith === 'error'
) {
statusText = 'Completed with error';
}

return (
<>
<DotIcon style={{ fontSize: '0.75rem' }} className={iconColor} />{' '}
{lastRunId ? (
<Link to={workflowInstanceLink({ instanceId: lastRunId })}>
{capitalize(statusText)}
{capitalize(status)}
</Link>
) : (
<>{capitalize(statusText)}</>
<>{capitalize(status)}</>
)}
</>
);
Expand Down
4 changes: 0 additions & 4 deletions plugins/orchestrator/src/components/WorkflowRunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
capitalize,
ProcessInstanceDTO,
ProcessInstanceStatusDTO,
WorkflowResultDTOCompletedWithEnum,
} from '@janus-idp/backstage-plugin-orchestrator-common';

import { VALUE_UNAVAILABLE } from '../constants';
Expand All @@ -21,7 +20,6 @@ import { WorkflowRunDetail } from './WorkflowRunDetail';
type WorkflowDetailsCardProps = {
assessedBy?: ProcessInstanceDTO;
details: WorkflowRunDetail;
completedWith?: WorkflowResultDTOCompletedWithEnum;
};

const useStyles = makeStyles({
Expand All @@ -34,7 +32,6 @@ const useStyles = makeStyles({
export const WorkflowRunDetails: React.FC<WorkflowDetailsCardProps> = ({
assessedBy,
details,
completedWith,
}) => {
const styles = useStyles();
const workflowInstanceLink = useRouteRef(workflowInstanceRouteRef);
Expand All @@ -54,7 +51,6 @@ export const WorkflowRunDetails: React.FC<WorkflowDetailsCardProps> = ({
<b>
<WorkflowInstanceStatusIndicator
status={details.status as ProcessInstanceStatusDTO}
completedWith={completedWith}
/>
</b>
</Typography>
Expand Down

0 comments on commit 8ac72a1

Please sign in to comment.