@@ -23,9 +23,10 @@ import {
23
23
TriggerDetailsType ,
24
24
WorkerStatusType ,
25
25
} from '../cicdHistory/types'
26
- import { Link } from 'react-router-dom'
26
+ import { Link , NavLink } from 'react-router-dom'
27
27
import { cancelCiTrigger , cancelPrePostCdTrigger , extractImage } from '../../service'
28
28
import { DEFAULT_ENV } from '../triggerView/Constants'
29
+ import { TIMEOUT_VALUE , WORKER_POD_BASE_URL } from './Constants'
29
30
30
31
const TriggerDetailsStatusIcon = React . memo ( ( { status } : TriggerDetailsStatusIconType ) : JSX . Element => {
31
32
return (
@@ -61,6 +62,7 @@ export const TriggerDetails = React.memo(
61
62
artifact,
62
63
environmentName,
63
64
isJobView,
65
+ workerPodName,
64
66
} : TriggerDetailsType ) : JSX . Element => {
65
67
return (
66
68
< div className = "trigger-details" >
@@ -88,6 +90,7 @@ export const TriggerDetails = React.memo(
88
90
stage = { stage }
89
91
type = { type }
90
92
isJobView = { isJobView }
93
+ workerPodName = { workerPodName }
91
94
/>
92
95
</ div >
93
96
</ div >
@@ -98,7 +101,10 @@ export const TriggerDetails = React.memo(
98
101
const Finished = React . memo ( ( { status, finishedOn, artifact, type } : FinishedType ) : JSX . Element => {
99
102
return (
100
103
< div className = "flex column left dc__min-width-fit-content" >
101
- < div className = { `${ status } fs-14 fw-6 ${ TERMINAL_STATUS_COLOR_CLASS_MAP [ status . toLowerCase ( ) ] || 'cn-5' } ` } data-testid = "deployment-status-text" >
104
+ < div
105
+ className = { `${ status } fs-14 fw-6 ${ TERMINAL_STATUS_COLOR_CLASS_MAP [ status . toLowerCase ( ) ] || 'cn-5' } ` }
106
+ data-testid = "deployment-status-text"
107
+ >
102
108
{ status && status . toLowerCase ( ) === 'cancelled' ? 'ABORTED' : status }
103
109
</ div >
104
110
< div className = "flex left" >
@@ -121,39 +127,54 @@ const Finished = React.memo(({ status, finishedOn, artifact, type }: FinishedTyp
121
127
)
122
128
} )
123
129
124
- const WorkerStatus = React . memo ( ( { message, podStatus, stage } : WorkerStatusType ) : JSX . Element | null => {
125
- if ( ! message && ! podStatus ) return null
126
- return (
127
- < >
128
- < span style = { { height : '80%' , borderRight : '1px solid var(--N100)' , margin : '0 16px' } } />
129
- < div className = "flex left column" >
130
- < div className = "flex left fs-14" >
131
- < div className = "mr-10" > { stage === 'DEPLOY' ? 'Message' : 'Worker' } </ div >
132
- { podStatus && (
133
- < div className = "fw-6" style = { { color : colorMap [ podStatus . toLowerCase ( ) ] } } >
134
- { podStatus }
135
- </ div >
130
+ const WorkerStatus = React . memo (
131
+ ( { message, podStatus, stage, workerPodName, finishedOn } : WorkerStatusType ) : JSX . Element | null => {
132
+ if ( ! message && ! podStatus ) return null
133
+ // check if finishedOn time is timed out or not
134
+ const isTimedOut = moment ( finishedOn ) . isBefore ( moment ( ) . subtract ( TIMEOUT_VALUE , 'hours' ) )
135
+ // finishedOn is 0001-01-01T00:00:00Z when the worker is still running
136
+ const showLink = finishedOn === ZERO_TIME_STRING || ! isTimedOut
137
+
138
+ return (
139
+ < >
140
+ < span style = { { height : '80%' , borderRight : '1px solid var(--N100)' , margin : '0 16px' } } />
141
+ < div className = "flex left column" >
142
+ < div className = "flex left fs-14" >
143
+ { stage === 'DEPLOY' ? (
144
+ < div className = "mr-10" > Message</ div >
145
+ ) : showLink ? (
146
+ < NavLink to = { `${ WORKER_POD_BASE_URL } /${ workerPodName } /logs` } className = "anchor" >
147
+ < div className = "mr-10" > Worker</ div >
148
+ </ NavLink >
149
+ ) : (
150
+ < div className = "mr-10" > Worker</ div >
151
+ ) }
152
+ { podStatus && (
153
+ < div className = "fw-6" style = { { color : colorMap [ podStatus . toLowerCase ( ) ] } } >
154
+ { podStatus }
155
+ </ div >
156
+ ) }
157
+ </ div >
158
+ { message && (
159
+ < Tippy
160
+ theme = { TippyTheme . black }
161
+ className = "default-tt"
162
+ arrow = { false }
163
+ placement = "bottom-start"
164
+ animation = "shift-toward-subtle"
165
+ content = { message }
166
+ >
167
+ < div className = "fs-12 cn-7 dc__ellipsis-right__2nd-line" > { message } </ div >
168
+ </ Tippy >
136
169
) }
137
170
</ div >
138
- { message && (
139
- < Tippy
140
- theme = { TippyTheme . black }
141
- className = "default-tt"
142
- arrow = { false }
143
- placement = "bottom-start"
144
- animation = "shift-toward-subtle"
145
- content = { message }
146
- >
147
- < div className = "fs-12 cn-7 dc__ellipsis-right__2nd-line" > { message } </ div >
148
- </ Tippy >
149
- ) }
150
- </ div >
151
- </ >
152
- )
153
- } )
171
+ </ >
172
+ )
173
+ } ,
174
+ )
154
175
155
176
const ProgressingStatus = React . memo (
156
- ( { status, message, podStatus, stage, type } : ProgressingStatusType ) : JSX . Element => {
177
+ ( { status, message, podStatus, stage, type, finishedOn , workerPodName } : ProgressingStatusType ) : JSX . Element => {
157
178
const [ aborting , setAborting ] = useState ( false )
158
179
const [ abortConfirmation , setAbortConfiguration ] = useState ( false )
159
180
const { buildId, triggerId, pipelineId } = useParams < {
@@ -187,9 +208,7 @@ const ProgressingStatus = React.memo(
187
208
< >
188
209
< div className = "flex left mb-24" >
189
210
< div className = "dc__min-width-fit-content" >
190
- < div className = { `${ status } fs-14 fw-6 flex left inprogress-status-color` } >
191
- In progress
192
- </ div >
211
+ < div className = { `${ status } fs-14 fw-6 flex left inprogress-status-color` } > In progress</ div >
193
212
</ div >
194
213
195
214
{ abort && (
@@ -200,7 +219,13 @@ const ProgressingStatus = React.memo(
200
219
Abort
201
220
</ button >
202
221
) }
203
- < WorkerStatus message = { message } podStatus = { podStatus } stage = { stage } />
222
+ < WorkerStatus
223
+ message = { message }
224
+ podStatus = { podStatus }
225
+ stage = { stage }
226
+ finishedOn = { finishedOn }
227
+ workerPodName = { workerPodName }
228
+ />
204
229
</ div >
205
230
{ abortConfirmation && (
206
231
< ConfirmationDialog >
@@ -233,16 +258,40 @@ const ProgressingStatus = React.memo(
233
258
)
234
259
235
260
const CurrentStatus = React . memo (
236
- ( { status, finishedOn, artifact, message, podStatus, stage, type, isJobView } : CurrentStatusType ) : JSX . Element => {
261
+ ( {
262
+ status,
263
+ finishedOn,
264
+ artifact,
265
+ message,
266
+ podStatus,
267
+ stage,
268
+ type,
269
+ isJobView,
270
+ workerPodName,
271
+ } : CurrentStatusType ) : JSX . Element => {
237
272
if ( PROGRESSING_STATUS [ status . toLowerCase ( ) ] ) {
238
273
return (
239
- < ProgressingStatus status = { status } message = { message } podStatus = { podStatus } stage = { stage } type = { type } />
274
+ < ProgressingStatus
275
+ status = { status }
276
+ message = { message }
277
+ podStatus = { podStatus }
278
+ stage = { stage }
279
+ type = { type }
280
+ finishedOn = { finishedOn }
281
+ workerPodName = { workerPodName }
282
+ />
240
283
)
241
284
} else {
242
285
return (
243
- < div className = { `flex left ${ isJobView ? " mb-24" : "" } ` } >
286
+ < div className = { `flex left ${ isJobView ? ' mb-24' : '' } ` } >
244
287
< Finished status = { status } finishedOn = { finishedOn } artifact = { artifact } type = { type } />
245
- < WorkerStatus message = { message } podStatus = { podStatus } stage = { stage } />
288
+ < WorkerStatus
289
+ message = { message }
290
+ podStatus = { podStatus }
291
+ stage = { stage }
292
+ finishedOn = { finishedOn }
293
+ workerPodName = { workerPodName }
294
+ />
246
295
</ div >
247
296
)
248
297
}
0 commit comments