Skip to content

Commit 6e33ba6

Browse files
committed
Add icons to wf operation status
This adds icons in front of the status text in the workflow operation list. This is supposed to make the state of the workflow more easily identifiable at a glance.
1 parent bd3aba5 commit 6e33ba6

3 files changed

Lines changed: 38 additions & 2 deletions

File tree

src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const EventDetailsWorkflowDetails = ({
4545
const isFetching = useAppSelector(state => isFetchingWorkflowDetails(state));
4646

4747
useEffect(() => {
48+
// Get latest workflow. Ideally we would have an endpoint that gives us the latest workflow straight up.
4849
if (!workflowId) {
4950
dispatch(fetchWorkflows(eventId)).unwrap()
5051
.then(workflows => {

src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowOperations.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { WorkflowTabHierarchy } from "../modals/EventDetails";
1414
import ButtonLikeAnchor from "../../../shared/ButtonLikeAnchor";
1515
import { ParseKeys } from "i18next";
1616
import ModalContentTable from "../../../shared/modals/ModalContentTable";
17+
import { LuCheck, LuEllipsis, LuLoader, LuPause, LuRotateCcw, LuX } from "react-icons/lu";
18+
import { GoDash } from "react-icons/go";
1719

1820
/**
1921
* This component manages the workflow operations for the workflows tab of the event details modal
@@ -149,7 +151,10 @@ export const Operation = ({
149151

150152
return (
151153
<tr>
152-
<td>{t(item.status as ParseKeys)}</td>
154+
<td style={{ display: "flex", alignItems: "center" }}>
155+
<OperationStatusIcon status={item.status} />
156+
{t(item.status as ParseKeys)}
157+
</td>
153158
<td>{item.title}</td>
154159
<td>{item.description}</td>
155160

@@ -172,4 +177,34 @@ export const Operation = ({
172177
);
173178
};
174179

180+
const OperationStatusIcon = ({
181+
status,
182+
}: {
183+
status: string
184+
}) => {
185+
// Parse translation key to state
186+
const state = status.split(".").pop();
187+
188+
const iconStyle = { marginRight: "5px"};
189+
190+
switch (state) {
191+
case "INSTANTIATED":
192+
return <LuEllipsis style={{ ...iconStyle, color: "#666"}}/>;
193+
case "RUNNING":
194+
return <LuLoader className="fa-spin" style={{ ...iconStyle, color: "#666"}}/>;
195+
case "PAUSED":
196+
return <LuPause style={{ ...iconStyle, color: "#666"}}/>;
197+
case "SUCCEEDED":
198+
return <LuCheck style={{ ...iconStyle, color: "#37c180"}}/>;
199+
case "FAILED":
200+
return <LuX style={{ ...iconStyle, color: "#fa1919"}}/>;
201+
case "SKIPPED":
202+
return <GoDash style={{ ...iconStyle, color: "#378dd4"}}/>;
203+
case "RETRY":
204+
return <LuRotateCcw className="fa-spin" style={{ ...iconStyle, color: "#666"}}/>;
205+
default:
206+
return <></>;
207+
}
208+
}
209+
175210
export default EventDetailsWorkflowOperations;

src/slices/eventDetailsSlice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ type EventDetailsState = {
323323
configuration: { [key: string]: string },
324324
description: string,
325325
id: number,
326-
status: string, // translation key
326+
status: string, // translation key, ending on INSTANTIATED, RUNNING, PAUSED, SUCCEEDED, FAILED, SKIPPED, RETRY
327327
title: string,
328328
}[]
329329
},

0 commit comments

Comments
 (0)