16
16
import { ReactElement } from 'react'
17
17
import moment from 'moment'
18
18
import { ALL_RESOURCE_KIND_FILTER } from '@Shared/constants'
19
- import { ReactComponent as ICAborted } from '@Icons/ic-aborted.svg'
20
19
import { ReactComponent as Close } from '@Icons/ic-close.svg'
21
20
import { ReactComponent as Check } from '@Icons/ic-check-grey.svg'
22
21
import { ReactComponent as ICHelpOutline } from '@Icons/ic-help-outline.svg'
@@ -26,9 +25,6 @@ import { ReactComponent as Disconnect } from '@Icons/ic-disconnected.svg'
26
25
import { ReactComponent as TimeOut } from '@Icons/ic-timeout-red.svg'
27
26
import { ReactComponent as ICCheck } from '@Icons/ic-check.svg'
28
27
import { ReactComponent as ICInProgress } from '@Icons/ic-in-progress.svg'
29
- import { ReactComponent as ICHelpFilled } from '@Icons/ic-help-filled.svg'
30
- import { ReactComponent as ICWarningY5 } from '@Icons/ic-warning-y5.svg'
31
- import { ReactComponent as ICSuccess } from '@Icons/ic-success.svg'
32
28
import { isTimeStringAvailable } from '@Shared/Helpers'
33
29
import { DATE_TIME_FORMATS } from '@Common/Constants'
34
30
import {
@@ -54,7 +50,7 @@ import {
54
50
NodeFilters ,
55
51
} from './types'
56
52
import { Icon } from '../Icon'
57
- import { AppStatus , StatusType } from '../StatusComponent'
53
+ import { AppStatus , DeploymentStatus , StatusType } from '../StatusComponent'
58
54
59
55
export const getTriggerHistoryFilterCriteria = ( {
60
56
appId,
@@ -224,40 +220,30 @@ export const sanitizeWorkflowExecutionStages = (
224
220
}
225
221
}
226
222
227
- export const getIconFromWorkflowStageStatusType = (
228
- status : WorkflowStageStatusType ,
229
- baseClass : string = 'icon-dim-20 dc__no-shrink' ,
230
- ) : ReactElement => {
231
- switch ( status ) {
232
- case WorkflowStageStatusType . TIMEOUT :
233
- return < TimeOut className = { baseClass } />
234
-
235
- case WorkflowStageStatusType . ABORTED :
236
- return < ICAborted className = { baseClass } />
237
-
238
- case WorkflowStageStatusType . FAILED :
239
- return < Icon name = "ic-failure" size = { 20 } color = { null } />
240
-
241
- case WorkflowStageStatusType . SUCCEEDED :
242
- return < ICSuccess className = { baseClass } />
243
-
244
- case WorkflowStageStatusType . NOT_STARTED :
245
- case WorkflowStageStatusType . RUNNING :
246
- return < Icon name = "ic-in-progress" size = { 20 } color = { null } />
247
-
248
- default :
249
- return < ICHelpFilled className = { baseClass } />
223
+ export const getIconFromWorkflowStageStatusType = ( status : WorkflowStageStatusType ) : ReactElement => {
224
+ const deploymentStatusMap = {
225
+ [ WorkflowStageStatusType . TIMEOUT ] : StatusType . TIMED_OUT ,
226
+ [ WorkflowStageStatusType . ABORTED ] : StatusType . ABORTED ,
227
+ [ WorkflowStageStatusType . FAILED ] : StatusType . FAILED ,
228
+ [ WorkflowStageStatusType . SUCCEEDED ] : StatusType . SUCCEEDED ,
229
+ [ WorkflowStageStatusType . NOT_STARTED ] : StatusType . PROGRESSING ,
230
+ [ WorkflowStageStatusType . RUNNING ] : StatusType . INPROGRESS ,
250
231
}
232
+
233
+ return deploymentStatusMap [ status ] ? (
234
+ < DeploymentStatus status = { deploymentStatusMap [ status ] } iconSize = { 20 } />
235
+ ) : (
236
+ < Icon name = "ic-help-outline" size = { 20 } color = "N500" />
237
+ )
251
238
}
252
239
253
240
export const getHistoryItemStatusIconFromWorkflowStages = (
254
241
workflowExecutionStages : WorkflowExecutionStagesMapDTO [ 'workflowExecutionStages' ] ,
255
242
) : ReactElement => {
256
243
const executionInfo = sanitizeWorkflowExecutionStages ( workflowExecutionStages )
257
- const baseClass = 'icon-dim-20 dc__no-shrink'
258
244
259
245
if ( ! executionInfo ) {
260
- return < ICHelpFilled className = { baseClass } />
246
+ return < Icon name = "ic-help-outline" size = { 20 } color = "N500" />
261
247
}
262
248
263
249
if ( ! executionInfo . finishedOn ) {
@@ -268,10 +254,10 @@ export const getHistoryItemStatusIconFromWorkflowStages = (
268
254
! FAILED_WORKFLOW_STAGE_STATUS_MAP [ executionInfo . currentStatus ] &&
269
255
FAILED_WORKFLOW_STAGE_STATUS_MAP [ executionInfo . workerDetails . status ]
270
256
) {
271
- return < ICWarningY5 className = { baseClass } />
257
+ return < Icon name = "ic-warning" size = { 20 } color = { null } />
272
258
}
273
259
274
- return getIconFromWorkflowStageStatusType ( executionInfo . workerDetails . status , baseClass )
260
+ return getIconFromWorkflowStageStatusType ( executionInfo . workerDetails . status )
275
261
}
276
262
277
263
export const getWorkerPodBaseUrl = ( clusterId : number = DEFAULT_CLUSTER_ID , podNamespace : string = DEFAULT_NAMESPACE ) =>
@@ -381,6 +367,8 @@ export const getTriggerStatusIcon = (status: string) => {
381
367
case TERMINAL_STATUS_MAP . INITIATING :
382
368
case TERMINAL_STATUS_MAP . WAITING_TO_START :
383
369
return StatusType . INPROGRESS
370
+ case TERMINAL_STATUS_MAP . CANCELLED :
371
+ return StatusType . ABORTED
384
372
default :
385
373
return status
386
374
}
0 commit comments