@@ -31,7 +31,12 @@ import { ReactComponent as ICHelpFilled } from '@Icons/ic-help-filled.svg'
31
31
import { ReactComponent as ICWarningY5 } from '@Icons/ic-warning-y5.svg'
32
32
import { isTimeStringAvailable } from '@Shared/Helpers'
33
33
import { DATE_TIME_FORMATS } from '@Common/Constants'
34
- import { DEFAULT_CLUSTER_ID , FAILED_WORKFLOW_STAGE_STATUS_MAP , TERMINAL_STATUS_MAP } from './constants'
34
+ import {
35
+ DEFAULT_CLUSTER_ID ,
36
+ DEFAULT_NAMESPACE ,
37
+ FAILED_WORKFLOW_STAGE_STATUS_MAP ,
38
+ TERMINAL_STATUS_MAP ,
39
+ } from './constants'
35
40
import { ResourceKindType , WorkflowStatusEnum } from '../../types'
36
41
import {
37
42
TriggerHistoryFilterCriteriaProps ,
@@ -154,14 +159,14 @@ export const getStageStatusIcon = (status: StageStatusType): JSX.Element => {
154
159
}
155
160
156
161
const renderAbortedTriggerIcon = ( ) : JSX . Element => < ICAborted className = "icon-dim-20 dc__no-shrink" />
157
- const renderFailedTriggerIcon = ( ) : JSX . Element => (
158
- < ICErrorCross className = "icon-dim-20 dc__no-shrink ic-error-cross-red" />
162
+ const renderFailedTriggerIcon = ( baseClass : string = 'icon-dim-20' ) : JSX . Element => (
163
+ < ICErrorCross className = { ` ${ baseClass } dc__no-shrink ic-error-cross-red` } />
159
164
)
160
- const renderProgressingTriggerIcon = ( ) : JSX . Element => (
161
- < ICInProgress className = " dc__no-shrink icon-dim-20 ic-in-progress-orange" />
165
+ const renderProgressingTriggerIcon = ( baseClass : string = 'icon-dim-20' ) : JSX . Element => (
166
+ < ICInProgress className = { ` ${ baseClass } dc__no-shrink ic-in-progress-orange` } />
162
167
)
163
- const renderSuccessTriggerIcon = ( ) : JSX . Element => (
164
- < div className = " dc__app-summary__icon dc__no-shrink icon-dim-20 succeeded" />
168
+ const renderSuccessTriggerIcon = ( baseClass : string = 'icon-dim-20' ) : JSX . Element => (
169
+ < div className = { ` ${ baseClass } dc__app-summary__icon dc__no-shrink succeeded` } />
165
170
)
166
171
167
172
export const getTriggerStatusIcon = ( triggerDetailStatus : string ) : JSX . Element => {
@@ -221,15 +226,10 @@ const getWorkerInfoFromExecutionStages = (
221
226
workflowExecutionStages : WorkflowExecutionStagesMapDTO [ 'workflowExecutionStages' ] ,
222
227
) : ExecutionInfoType [ 'workerDetails' ] => {
223
228
const workerInfo : PodExecutionStageDTO = workflowExecutionStages ?. [ WorkflowExecutionStageType . POD ] ?. [ 0 ]
224
-
225
- if ( ! workerInfo ) {
226
- return null
227
- }
228
-
229
- const { status, message, endTime, metadata } = workerInfo
229
+ const { status, message, endTime, metadata } = workerInfo || { }
230
230
231
231
return {
232
- status,
232
+ status : status || WorkflowStageStatusType . UNKNOWN ,
233
233
message : message || '' ,
234
234
clusterId : metadata ?. clusterId || DEFAULT_CLUSTER_ID ,
235
235
endTime : isTimeStringAvailable ( endTime ) ? endTime : '' ,
@@ -253,7 +253,7 @@ export const sanitizeWorkflowExecutionStages = (
253
253
)
254
254
255
255
const isOldData = ! preparationStage
256
- const computedTriggedOn = isOldData ? executionStage ?. startTime : preparationStage ?. startTime
256
+ const computedTriggeredOn = isOldData ? executionStage ?. startTime : preparationStage ?. startTime
257
257
258
258
let lastStatus : WorkflowStageStatusType = WorkflowStageStatusType . UNKNOWN
259
259
workflowExecutionSteps . forEach ( ( { status } ) => {
@@ -272,7 +272,7 @@ export const sanitizeWorkflowExecutionStages = (
272
272
} )
273
273
274
274
return {
275
- triggeredOn : isTimeStringAvailable ( computedTriggedOn ) ? computedTriggedOn : '' ,
275
+ triggeredOn : isTimeStringAvailable ( computedTriggeredOn ) ? computedTriggeredOn : '' ,
276
276
executionStartedOn : isOldData ? null : executionStage ?. startTime ,
277
277
finishedOn : isTimeStringAvailable ( finishedOn ) ? finishedOn : '' ,
278
278
currentStatus : lastStatus ,
@@ -292,15 +292,15 @@ export const getIconFromWorkflowStageStatusType = (
292
292
return < ICAborted className = { baseClass } />
293
293
294
294
case WorkflowStageStatusType . FAILED :
295
- return renderFailedTriggerIcon ( )
295
+ return renderFailedTriggerIcon ( baseClass )
296
296
297
297
case WorkflowStageStatusType . SUCCEEDED :
298
- return renderSuccessTriggerIcon ( )
298
+ return renderSuccessTriggerIcon ( baseClass )
299
299
300
300
// NOT_STARTED case is not expected
301
301
case WorkflowStageStatusType . NOT_STARTED :
302
302
case WorkflowStageStatusType . RUNNING :
303
- return renderProgressingTriggerIcon ( )
303
+ return renderProgressingTriggerIcon ( baseClass )
304
304
305
305
default :
306
306
return < ICHelpFilled className = { baseClass } />
@@ -318,7 +318,7 @@ export const getHistoryItemStatusIconFromWorkflowStages = (
318
318
}
319
319
320
320
if ( ! executionInfo . finishedOn ) {
321
- return renderProgressingTriggerIcon ( )
321
+ return renderProgressingTriggerIcon ( baseClass )
322
322
}
323
323
324
324
if ( FAILED_WORKFLOW_STAGE_STATUS_MAP [ executionInfo . workerDetails ?. status ] ) {
@@ -328,7 +328,7 @@ export const getHistoryItemStatusIconFromWorkflowStages = (
328
328
return getIconFromWorkflowStageStatusType ( executionInfo . currentStatus , baseClass )
329
329
}
330
330
331
- export const getWorkerPodBaseUrl = ( clusterId : number = DEFAULT_CLUSTER_ID , podNamespace : string = 'devtron-ci' ) =>
331
+ export const getWorkerPodBaseUrl = ( clusterId : number = DEFAULT_CLUSTER_ID , podNamespace : string = DEFAULT_NAMESPACE ) =>
332
332
`/resource-browser/${ clusterId } /${ podNamespace } /pod/k8sEmptyGroup`
333
333
334
334
export const getWorkflowNodeStatusTitle = ( status : string ) => {
0 commit comments