Skip to content

Commit 4842b37

Browse files
authored
fix(orchestrator):Add status icons (#613)
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
1 parent e5d0be3 commit 4842b37

4 files changed

Lines changed: 55 additions & 12 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
3+
---
4+
5+
Add status icons

workspaces/orchestrator/plugins/orchestrator/src/components/OrchestratorPage/WorkflowRunsTabContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export const WorkflowRunsTabContent = () => {
265265
},
266266
]),
267267
{
268-
title: 'Status',
268+
title: 'Run Status',
269269
field: 'state',
270270
render: (data: WorkflowRunDetail) => (
271271
<WorkflowInstanceStatusIndicator

workspaces/orchestrator/plugins/orchestrator/src/components/WorkflowInstanceStatusIndicator.tsx

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,10 @@ import React from 'react';
1818
import { Link } from '@backstage/core-components';
1919
import { useRouteRef } from '@backstage/core-plugin-api';
2020

21-
import DotIcon from '@material-ui/icons/FiberManualRecord';
21+
import { CircularProgress } from '@material-ui/core';
22+
import CheckCircleOutlinedIcon from '@material-ui/icons/CheckCircleOutlined';
23+
import ErrorOutlineOutlinedIcon from '@material-ui/icons/ErrorOutlineOutlined';
24+
import HourglassEmptyOutlinedIcon from '@material-ui/icons/HourglassEmptyOutlined';
2225

2326
import {
2427
capitalize,
@@ -43,16 +46,50 @@ export const WorkflowInstanceStatusIndicator = ({
4346
return VALUE_UNAVAILABLE;
4447
}
4548

49+
let icon: React.ReactNode;
50+
let title: string = '';
51+
switch (status) {
52+
case ProcessInstanceStatusDTO.Active:
53+
icon = <CircularProgress size="1.15rem" className={iconColor} />;
54+
title = 'Running';
55+
break;
56+
case ProcessInstanceStatusDTO.Completed:
57+
icon = <CheckCircleOutlinedIcon className={iconColor} />;
58+
title = 'Completed';
59+
break;
60+
case ProcessInstanceStatusDTO.Suspended:
61+
icon = <b className={iconColor}>--</b>;
62+
title = 'Suspended';
63+
break;
64+
case ProcessInstanceStatusDTO.Aborted:
65+
icon = <b className={iconColor}>--</b>;
66+
title = 'Aborted';
67+
break;
68+
case ProcessInstanceStatusDTO.Error:
69+
icon = <ErrorOutlineOutlinedIcon className={iconColor} />;
70+
title = 'Failed';
71+
break;
72+
case ProcessInstanceStatusDTO.Pending:
73+
icon = <HourglassEmptyOutlinedIcon className={iconColor} />;
74+
title = 'Pending';
75+
break;
76+
default:
77+
icon = VALUE_UNAVAILABLE;
78+
break;
79+
}
80+
4681
return (
47-
<>
48-
<DotIcon style={{ fontSize: '0.75rem' }} className={iconColor} />{' '}
82+
<div
83+
style={{ display: 'inline-flex', alignItems: 'center', gap: '0.25rem' }}
84+
>
85+
{icon}
4986
{lastRunId ? (
5087
<Link to={workflowInstanceLink({ instanceId: lastRunId })}>
51-
{capitalize(status)}
88+
{capitalize(title)}
5289
</Link>
5390
) : (
54-
<>{capitalize(status)}</>
91+
<>{capitalize(title)}</>
5592
)}
56-
</>
93+
</div>
5794
);
5895
};

workspaces/orchestrator/plugins/orchestrator/src/hooks/useWorkflowInstanceStatusColors.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
import { makeStyles } from '@material-ui/core';
1718

1819
import { ProcessInstanceStatusDTO } from '@red-hat-developer-hub/backstage-plugin-orchestrator-common';
@@ -21,16 +22,16 @@ const useStyles = makeStyles(
2122
theme =>
2223
({
2324
[ProcessInstanceStatusDTO.Active]: {
24-
color: theme.palette.primary.main,
25+
color: theme.palette.grey[500],
2526
},
2627
[ProcessInstanceStatusDTO.Completed]: {
2728
color: theme.palette.success.main,
2829
},
2930
[ProcessInstanceStatusDTO.Suspended]: {
30-
color: theme.palette.warning.main,
31+
color: theme.palette.grey[500],
3132
},
3233
[ProcessInstanceStatusDTO.Aborted]: {
33-
color: theme.palette.error.main,
34+
color: theme.palette.grey[500],
3435
},
3536
[ProcessInstanceStatusDTO.Error]: {
3637
color: theme.palette.error.main,

0 commit comments

Comments
 (0)