@@ -58,6 +58,7 @@ import {
58
58
terminalStatus ,
59
59
History ,
60
60
HistoryLogsProps ,
61
+ WorkflowStageStatusType ,
61
62
} from './types'
62
63
import { getTagDetails , getTriggerDetails , cancelCiTrigger , cancelPrePostCdTrigger } from './service'
63
64
import { DEFAULT_CLUSTER_ID , DEFAULT_ENV , TIMEOUT_VALUE } from './constants'
@@ -72,19 +73,22 @@ import { ConfirmationModal, ConfirmationModalVariantType } from '../Confirmation
72
73
import { getWorkerPodBaseUrl , sanitizeWorkflowExecutionStages } from './utils'
73
74
import './cicdHistory.scss'
74
75
75
- const Finished = React . memo (
76
- ( { status, finishedOn, artifact, type } : FinishedType ) : JSX . Element => (
76
+ const Finished = React . memo ( ( { status, finishedOn, artifact, type, executionInfo } : FinishedType ) : JSX . Element => {
77
+ const finishedOnTime = executionInfo ?. finishedOn || finishedOn
78
+ const computedStatus = executionInfo ?. currentStatus || status
79
+
80
+ return (
77
81
< div className = "flexbox pt-12 dc__gap-8 left dc__min-width-fit-content dc__align-items-center" >
78
82
< div
79
- className = { `${ status } fs-13 fw-6 ${ TERMINAL_STATUS_COLOR_CLASS_MAP [ status . toLowerCase ( ) ] || 'cn-5' } ` }
83
+ className = { `${ computedStatus } fs-13 fw-6 ${ TERMINAL_STATUS_COLOR_CLASS_MAP [ computedStatus . toLowerCase ( ) ] || 'cn-5' } ` }
80
84
data-testid = "deployment-status-text"
81
85
>
82
- { status && status . toLowerCase ( ) === 'cancelled' ? 'Aborted' : status }
86
+ { computedStatus && computedStatus . toLowerCase ( ) === 'cancelled' ? 'Aborted' : computedStatus }
83
87
</ div >
84
88
85
- { finishedOn && finishedOn !== ZERO_TIME_STRING && (
89
+ { finishedOnTime && finishedOnTime !== ZERO_TIME_STRING && (
86
90
< time className = "dc__vertical-align-middle fs-13" >
87
- { moment ( finishedOn , 'YYYY-MM-DDTHH:mm:ssZ' ) . format ( DATE_TIME_FORMATS . TWELVE_HOURS_FORMAT ) }
91
+ { moment ( finishedOnTime , 'YYYY-MM-DDTHH:mm:ssZ' ) . format ( DATE_TIME_FORMATS . TWELVE_HOURS_FORMAT ) }
88
92
</ time >
89
93
) }
90
94
@@ -95,11 +99,19 @@ const Finished = React.memo(
95
99
</ >
96
100
) }
97
101
</ div >
98
- ) ,
99
- )
102
+ )
103
+ } )
100
104
101
105
const WorkerStatus = React . memo (
102
- ( { message, podStatus, stage, workerPodName, finishedOn, clusterId } : WorkerStatusType ) : JSX . Element | null => {
106
+ ( {
107
+ message,
108
+ podStatus,
109
+ stage,
110
+ workerPodName,
111
+ finishedOn,
112
+ clusterId,
113
+ namespace,
114
+ } : WorkerStatusType ) : JSX . Element | null => {
103
115
if ( ! message && ! podStatus ) {
104
116
return null
105
117
}
@@ -111,8 +123,7 @@ const WorkerStatus = React.memo(
111
123
const getViewWorker = ( ) =>
112
124
showLink ? (
113
125
< NavLink
114
- // TODO: Ask for namespace as well
115
- to = { `${ getWorkerPodBaseUrl ( clusterId ) } /${ workerPodName } /logs` }
126
+ to = { `${ getWorkerPodBaseUrl ( clusterId , namespace ) } /${ workerPodName } /logs` }
116
127
target = "_blank"
117
128
className = "anchor"
118
129
>
@@ -145,7 +156,7 @@ const WorkerStatus = React.memo(
145
156
} ,
146
157
)
147
158
148
- const ProgressingStatus = React . memo ( ( { status , stage, type } : ProgressingStatusType ) : JSX . Element => {
159
+ const ProgressingStatus = React . memo ( ( { stage, type } : ProgressingStatusType ) : JSX . Element => {
149
160
const [ aborting , setAborting ] = useState ( false )
150
161
const [ abortConfirmation , setAbortConfirmation ] = useState ( false )
151
162
const [ abortError , setAbortError ] = useState < {
@@ -209,7 +220,7 @@ const ProgressingStatus = React.memo(({ status, stage, type }: ProgressingStatus
209
220
< >
210
221
< div className = "flex dc__gap-8 left pt-12" >
211
222
< div className = "dc__min-width-fit-content" >
212
- < div className = { ` ${ status } fs-14 fw-6 flex left inprogress-status-color` } > In progress</ div >
223
+ < div className = " fs-14 fw-6 flex left inprogress-status-color" > In progress</ div >
213
224
</ div >
214
225
215
226
{ abort && (
@@ -278,12 +289,34 @@ const ProgressingStatus = React.memo(({ status, stage, type }: ProgressingStatus
278
289
)
279
290
} )
280
291
281
- const CurrentStatus = React . memo ( ( { status, finishedOn, artifact, stage, type } : CurrentStatusType ) : JSX . Element => {
282
- if ( PROGRESSING_STATUS [ status . toLowerCase ( ) ] ) {
283
- return < ProgressingStatus status = { status } stage = { stage } type = { type } />
284
- }
285
- return < Finished status = { status } finishedOn = { finishedOn } artifact = { artifact } type = { type } />
286
- } )
292
+ const CurrentStatus = React . memo (
293
+ ( { status, finishedOn, artifact, stage, type, executionInfo } : CurrentStatusType ) : JSX . Element => {
294
+ if ( executionInfo ) {
295
+ if ( executionInfo . finishedOn ) {
296
+ return < Finished executionInfo = { executionInfo } artifact = { artifact } type = { type } />
297
+ }
298
+
299
+ if ( executionInfo . currentStatus === WorkflowStageStatusType . RUNNING ) {
300
+ return < ProgressingStatus stage = { stage } type = { type } />
301
+ }
302
+
303
+ if ( executionInfo . currentStatus === WorkflowStageStatusType . UNKNOWN ) {
304
+ return (
305
+ < div className = "flex dc__gap-8 left pt-12" >
306
+ < span > Unknown status</ span >
307
+ </ div >
308
+ )
309
+ }
310
+
311
+ return null
312
+ }
313
+
314
+ if ( PROGRESSING_STATUS [ status . toLowerCase ( ) ] ) {
315
+ return < ProgressingStatus stage = { stage } type = { type } />
316
+ }
317
+ return < Finished status = { status } finishedOn = { finishedOn } artifact = { artifact } type = { type } />
318
+ } ,
319
+ )
287
320
288
321
const StartDetails = ( {
289
322
startedOn,
@@ -308,7 +341,7 @@ const StartDetails = ({
308
341
< div className = "flexbox dc__gap-8 dc__align-items-center pb-12 flex-wrap" >
309
342
< div className = "flex left dc__gap-4 cn-9 fs-13 fw-6 lh-20" >
310
343
< div className = "flex left dc__no-shrink dc__gap-4" data-testid = "deployment-history-start-heading" >
311
- < div > Start </ div >
344
+ < h3 className = "m-0 cn-9 fs-13 fw-6 lh-20" > Triggered </ h3 >
312
345
{ stage && (
313
346
< >
314
347
< div className = "dc__bullet" />
@@ -394,16 +427,39 @@ const StartDetails = ({
394
427
)
395
428
}
396
429
430
+ const renderDetailsSuccessIconBlock = ( ) => (
431
+ < >
432
+ < div className = "flex" >
433
+ < ICSuccess className = "icon-dim-20" />
434
+ </ div >
435
+
436
+ < div className = "flex flex-grow-1" >
437
+ < div className = "dc__border-left--n7 h-100" />
438
+ </ div >
439
+ </ >
440
+ )
441
+
397
442
const TriggerDetailsStatusIcon = React . memo (
398
- ( { status } : TriggerDetailsStatusIconType ) : JSX . Element => (
443
+ ( {
444
+ status,
445
+ renderDeploymentHistoryTriggerMetaText,
446
+ triggerMetadata,
447
+ executionStartedOn,
448
+ } : TriggerDetailsStatusIconType ) : JSX . Element => (
399
449
< div className = "flexbox-col" >
400
- < div className = "flex" >
401
- < ICSuccess className = "icon-dim-20" />
402
- </ div >
450
+ { renderDetailsSuccessIconBlock ( ) }
403
451
404
- < div className = "flex flex-grow-1" >
405
- < div className = "dc__border-left--n7 h-100" />
406
- </ div >
452
+ { ! ! triggerMetadata && (
453
+ < >
454
+ { renderDeploymentHistoryTriggerMetaText ?.( triggerMetadata , true ) }
455
+
456
+ < div className = "flex flex-grow-1" >
457
+ < div className = "dc__border-left--n7 h-100" />
458
+ </ div >
459
+ </ >
460
+ ) }
461
+
462
+ { executionStartedOn && renderDetailsSuccessIconBlock ( ) }
407
463
408
464
{ PULSATING_STATUS_MAP [ status ] ? (
409
465
< ICPulsateStatus />
@@ -446,6 +502,7 @@ export const TriggerDetails = React.memo(
446
502
renderDeploymentHistoryTriggerMetaText,
447
503
renderTargetConfigInfo,
448
504
workflowExecutionStages,
505
+ namespace,
449
506
} : TriggerDetailsType ) => {
450
507
const executionInfo = useMemo (
451
508
( ) => sanitizeWorkflowExecutionStages ( workflowExecutionStages ) ,
@@ -455,49 +512,62 @@ export const TriggerDetails = React.memo(
455
512
return (
456
513
< div className = "trigger-details flexbox-col pb-12" >
457
514
< div className = "display-grid trigger-details__grid py-12" >
458
- { stage === DeploymentStageType . DEPLOY ? (
459
- < >
460
- < div className = "flexbox dc__content-center" >
461
- < TriggerDetailsStatusIcon status = { status ?. toLowerCase ( ) } />
462
- </ div >
463
- < div className = "trigger-details__summary flexbox-col flex-grow-1 lh-20" >
464
- < StartDetails
465
- startedOn = { startedOn }
466
- triggeredBy = { triggeredBy }
467
- triggeredByEmail = { triggeredByEmail }
468
- ciMaterials = { ciMaterials }
469
- gitTriggers = { gitTriggers }
470
- artifact = { artifact }
471
- type = { type }
472
- environmentName = { environmentName }
473
- isJobView = { isJobView }
474
- triggerMetadata = { triggerMetadata }
475
- renderDeploymentHistoryTriggerMetaText = { renderDeploymentHistoryTriggerMetaText }
476
- renderTargetConfigInfo = { renderTargetConfigInfo }
477
- stage = { stage }
478
- />
515
+ < div className = "flexbox dc__content-center" >
516
+ < TriggerDetailsStatusIcon
517
+ status = { status ?. toLowerCase ( ) }
518
+ renderDeploymentHistoryTriggerMetaText = { renderDeploymentHistoryTriggerMetaText }
519
+ triggerMetadata = { triggerMetadata }
520
+ executionStartedOn = { executionInfo ?. executionStartedOn }
521
+ />
522
+ </ div >
523
+ < div className = "trigger-details__summary flexbox-col flex-grow-1 lh-20" >
524
+ < StartDetails
525
+ startedOn = { executionInfo ?. triggeredOn ?? startedOn }
526
+ triggeredBy = { triggeredBy }
527
+ triggeredByEmail = { triggeredByEmail }
528
+ ciMaterials = { ciMaterials }
529
+ gitTriggers = { gitTriggers }
530
+ artifact = { artifact }
531
+ type = { type }
532
+ environmentName = { environmentName }
533
+ isJobView = { isJobView }
534
+ triggerMetadata = { triggerMetadata }
535
+ renderDeploymentHistoryTriggerMetaText = { renderDeploymentHistoryTriggerMetaText }
536
+ renderTargetConfigInfo = { renderTargetConfigInfo }
537
+ stage = { stage }
538
+ />
479
539
480
- < CurrentStatus
481
- status = { status }
482
- finishedOn = { finishedOn }
483
- artifact = { artifact }
484
- stage = { stage }
485
- type = { type }
486
- />
540
+ { executionInfo ?. executionStartedOn && (
541
+ < div className = "w-100 pr-20 flexbox dc__gap-8" >
542
+ < h3 className = "m-0 cn-9 fs-13 fw-6 lh-20" > Execution started</ h3 >
543
+
544
+ < time className = "cn-7 fs-13" >
545
+ { moment ( startedOn , 'YYYY-MM-DDTHH:mm:ssZ' ) . format (
546
+ DATE_TIME_FORMATS . TWELVE_HOURS_FORMAT ,
547
+ ) }
548
+ </ time >
487
549
</ div >
488
- </ >
489
- ) : (
490
- < div />
491
- ) }
550
+ ) }
551
+
552
+ < CurrentStatus
553
+ executionInfo = { executionInfo }
554
+ status = { status }
555
+ finishedOn = { finishedOn }
556
+ artifact = { artifact }
557
+ stage = { stage }
558
+ type = { type }
559
+ />
560
+ </ div >
492
561
</ div >
493
562
494
563
< WorkerStatus
495
564
message = { executionInfo ?. workerDetails ?. message ?? message }
496
565
podStatus = { executionInfo ?. workerDetails ?. status ?? podStatus }
497
566
stage = { stage }
498
567
finishedOn = { executionInfo ?. workerDetails ?. endTime ?? finishedOn }
499
- clusterId = { executionInfo ?. workerDetails ?. clusterId || + DEFAULT_CLUSTER_ID }
568
+ clusterId = { executionInfo ?. workerDetails ?. clusterId || DEFAULT_CLUSTER_ID }
500
569
workerPodName = { workerPodName }
570
+ namespace = { namespace }
501
571
/>
502
572
</ div >
503
573
)
@@ -858,6 +928,7 @@ const TriggerOutput = ({
858
928
environmentName = { selectedEnvironmentName }
859
929
renderTargetConfigInfo = { renderTargetConfigInfo }
860
930
workflowExecutionStages = { triggerDetails . workflowExecutionStages }
931
+ namespace = { triggerDetails . namespace }
861
932
/>
862
933
< ul className = "pl-50 pr-20 pt-8 tab-list tab-list--nodes dc__border-bottom dc__position-sticky dc__top-0 bg__primary dc__zi-3" >
863
934
{ triggerDetails . stage === 'DEPLOY' && deploymentAppType !== DeploymentAppTypes . HELM && (
0 commit comments