@@ -35,8 +35,16 @@ const getDefaultDeploymentStatusTimeline = (
3535 isCollapsed : true ,
3636 }
3737
38+ const deploymentStatus = WFR_STATUS_DTO_TO_DEPLOYMENT_STATUS_MAP [ data ?. wfrStatus ] || DEPLOYMENT_STATUS . INPROGRESS
39+ // Incase of git commit failed or argocd sync failed, DEPLOYMENT_STATUS.FAILED won't come from BE
40+ const deploymentErrorMessage =
41+ deploymentStatus === DEPLOYMENT_STATUS . FAILED
42+ ? data ?. timelines ?. find ( ( timeline ) => timeline . status === TIMELINE_STATUS . DEPLOYMENT_FAILED )
43+ ?. statusDetail || ''
44+ : ''
45+
3846 return {
39- deploymentStatus : WFR_STATUS_DTO_TO_DEPLOYMENT_STATUS_MAP [ data ?. wfrStatus ] || DEPLOYMENT_STATUS . INPROGRESS ,
47+ deploymentStatus,
4048 deploymentTriggerTime : data ?. deploymentStartedOn || '' ,
4149 deploymentEndTime : data ?. deploymentFinishedOn || '' ,
4250 triggeredBy : data ?. triggeredBy || '' ,
@@ -65,6 +73,12 @@ const getDefaultDeploymentStatusTimeline = (
6573 displayText : 'Propagate manifest to Kubernetes resources' ,
6674 } ,
6775 } ,
76+ errorBarConfig : deploymentErrorMessage
77+ ? {
78+ deploymentErrorMessage,
79+ nextTimelineToProcess : TIMELINE_STATUS . GIT_COMMIT ,
80+ }
81+ : null ,
6882 }
6983}
7084
@@ -85,9 +99,7 @@ const getPredicate =
8599 return timelineItem . status . includes ( TIMELINE_STATUS . KUBECTL_APPLY )
86100
87101 case TIMELINE_STATUS . APP_HEALTH :
88- return [ TIMELINE_STATUS . HEALTHY , TIMELINE_STATUS . DEGRADED , TIMELINE_STATUS . DEPLOYMENT_FAILED ] . includes (
89- timelineItem . status ,
90- )
102+ return [ TIMELINE_STATUS . HEALTHY , TIMELINE_STATUS . DEGRADED ] . includes ( timelineItem . status )
91103
92104 default :
93105 return false
@@ -247,6 +259,7 @@ export const processDeploymentStatusDetailsData = (
247259 }
248260
249261 const isProgressing = PROGRESSING_DEPLOYMENT_STATUS . includes ( deploymentStatus )
262+ const hasDeploymentFailed = deploymentStatus === DEPLOYMENT_STATUS . FAILED
250263 // This key will be used since argocd sync is manual or auto based on flag on BE.
251264 // And in old data as well this timeline won't be present so in KUBECTL_APPLY timeline we will set the icon to success
252265 const isArgoCDSyncAvailable = data . timelines . some ( ( timeline ) =>
@@ -255,7 +268,6 @@ export const processDeploymentStatusDetailsData = (
255268
256269 PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER . forEach ( ( timelineStatusType , index ) => {
257270 const element = findRight ( data . timelines , getPredicate ( timelineStatusType ) )
258-
259271 const timelineData = deploymentData . deploymentStatusBreakdown [ timelineStatusType ]
260272
261273 if ( ! element ) {
@@ -265,6 +277,7 @@ export const processDeploymentStatusDetailsData = (
265277 timelineData . displaySubText = 'Waiting'
266278 }
267279
280+ // We don't even need to clean this in final loop since deployment status won't be in progress if next timeline is progressing
268281 if ( isProgressing && timelineStatusType === TIMELINE_STATUS . KUBECTL_APPLY ) {
269282 timelineData . subSteps = [
270283 { icon : '' , message : 'Waiting to be started by Argo CD' } ,
@@ -273,9 +286,13 @@ export const processDeploymentStatusDetailsData = (
273286 timelineData . isCollapsed = false
274287 }
275288
276- if ( deploymentStatus === DEPLOYMENT_STATUS . FAILED ) {
277- timelineData . displaySubText = ''
278- timelineData . icon = 'unreachable'
289+ if ( hasDeploymentFailed ) {
290+ const hasCurrentTimelineFailed =
291+ timelineStatusType === TIMELINE_STATUS . APP_HEALTH &&
292+ deploymentData . deploymentStatusBreakdown . KUBECTL_APPLY . icon === 'success'
293+
294+ timelineData . displaySubText = hasCurrentTimelineFailed ? 'Failed' : ''
295+ timelineData . icon = hasCurrentTimelineFailed ? 'failed' : 'unreachable'
279296 }
280297
281298 if (
@@ -291,7 +308,6 @@ export const processDeploymentStatusDetailsData = (
291308 statusFetchCount : data ?. statusFetchCount ,
292309 } )
293310 }
294-
295311 return
296312 }
297313
@@ -327,18 +343,8 @@ export const processDeploymentStatusDetailsData = (
327343
328344 case TIMELINE_STATUS . APP_HEALTH :
329345 timelineData . time = element . statusTime
330- if ( element . status === TIMELINE_STATUS . DEPLOYMENT_FAILED ) {
331- // TODO: Check why its icon is not failed in earlier implementation
332- timelineData . icon = 'failed'
333- timelineData . displaySubText = 'Failed'
334- timelineData . timelineStatus = element . statusDetail
335- break
336- }
337-
338- if ( element . status === TIMELINE_STATUS . HEALTHY || element . status === TIMELINE_STATUS . DEGRADED ) {
339- timelineData . icon = 'success'
340- timelineData . displaySubText = element . status === TIMELINE_STATUS . HEALTHY ? '' : 'Degraded'
341- }
346+ timelineData . icon = 'success'
347+ timelineData . displaySubText = element . status === TIMELINE_STATUS . HEALTHY ? '' : 'Degraded'
342348 break
343349
344350 default :
@@ -350,6 +356,10 @@ export const processDeploymentStatusDetailsData = (
350356 const nextTimelineStatus = PHYSICAL_ENV_DEPLOYMENT_TIMELINE_ORDER [ index + 1 ]
351357 const nextTimeline = deploymentData . deploymentStatusBreakdown [ nextTimelineStatus ]
352358
359+ if ( deploymentData . errorBarConfig ) {
360+ deploymentData . errorBarConfig . nextTimelineToProcess = nextTimelineStatus
361+ }
362+
353363 nextTimeline . icon = 'inprogress'
354364 nextTimeline . displaySubText = 'In progress'
355365 }
0 commit comments