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';
1818import { Link } from '@backstage/core-components' ;
1919import { 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
2326import {
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} ;
0 commit comments