Skip to content

Commit ec1e97e

Browse files
committed
feat: add workflow status title utility and enhance status handling in CICD components
1 parent aed5e24 commit ec1e97e

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

src/Shared/Components/CICDHistory/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { ReactComponent as ICDocker } from '../../../Assets/Icon/ic-docker.svg'
4242
import { GitTriggers } from '../../types'
4343
import { CiPipelineSourceConfig } from './CiPipelineSourceConfig'
4444
import { HISTORY_LABEL, FILTER_STYLE, statusColor as colorMap } from './constants'
45-
import { getTriggerStatusIcon } from './utils'
45+
import { getTriggerStatusIcon, getWorkflowNodeStatusTitle } from './utils'
4646

4747
const SummaryTooltipCard = React.memo(
4848
({
@@ -55,7 +55,7 @@ const SummaryTooltipCard = React.memo(
5555
}: SummaryTooltipCardType): JSX.Element => (
5656
<div className="build-card-popup p-16 br-4 w-400 bg__primary mxh-300 dc__overflow-scroll">
5757
<span className="fw-6 fs-16 mb-4" style={{ color: colorMap[status.toLowerCase()] }}>
58-
{status.toLowerCase() === 'cancelled' ? 'Aborted' : status}
58+
{getWorkflowNodeStatusTitle(status)}
5959
</span>
6060
<div className="flex column left">
6161
<div className="flex left fs-12 cn-7">

src/Shared/Components/CICDHistory/utils.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { ReactComponent as ICCheck } from '@Icons/ic-check.svg'
2727
import { ReactComponent as ICInProgress } from '@Icons/ic-in-progress.svg'
2828
import { isTimeStringAvailable } from '@Shared/Helpers'
2929
import { DEFAULT_CLUSTER_ID, TERMINAL_STATUS_MAP } from './constants'
30-
import { ResourceKindType } from '../../types'
30+
import { ResourceKindType, WorkflowStatusEnum } from '../../types'
3131
import {
3232
TriggerHistoryFilterCriteriaProps,
3333
DeploymentHistoryResultObject,
@@ -201,6 +201,7 @@ export const getTriggerStatusIcon = (triggerDetailStatus: string): JSX.Element =
201201
case TERMINAL_STATUS_MAP.PROGRESSING:
202202
case TERMINAL_STATUS_MAP.STARTING:
203203
case TERMINAL_STATUS_MAP.INITIATING:
204+
case WorkflowStatusEnum.WAITING_TO_START.toLowerCase():
204205
return renderProgressingTriggerIcon()
205206

206207
case TERMINAL_STATUS_MAP.SUCCEEDED:
@@ -288,3 +289,19 @@ export const sanitizeWorkflowExecutionStages = (
288289

289290
export const getWorkerPodBaseUrl = (clusterId: number = DEFAULT_CLUSTER_ID, podNamespace: string = 'devtron-ci') =>
290291
`/resource-browser/${clusterId}/${podNamespace}/pod/k8sEmptyGroup`
292+
293+
export const getWorkflowNodeStatusTitle = (status: string) => {
294+
if (!status) {
295+
return null
296+
}
297+
298+
if (status.toLowerCase() === 'cancelled') {
299+
return 'ABORTED'
300+
}
301+
302+
if (status === WorkflowStatusEnum.WAITING_TO_START) {
303+
return 'Waiting to start'
304+
}
305+
306+
return status
307+
}

src/Shared/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,3 +937,11 @@ export interface TargetPlatformItemDTO {
937937
export interface TargetPlatformsDTO {
938938
targetPlatforms: TargetPlatformItemDTO[]
939939
}
940+
941+
export enum WorkflowStatusEnum {
942+
STARTING = 'Starting',
943+
RUNNING = 'Running',
944+
PROGRESSING = 'Progressing',
945+
WAITING_TO_START = 'WaitingToStart',
946+
CANCELLED = 'CANCELLED',
947+
}

0 commit comments

Comments
 (0)