@@ -26,12 +26,17 @@ import {
26
26
DOCUMENTATION ,
27
27
ROUTES ,
28
28
SearchBar ,
29
- ZERO_TIME_STRING ,
30
29
useUrlFilters ,
31
30
stopPropagation ,
32
31
} from '../../../Common'
33
32
import LogStageAccordion from './LogStageAccordion'
34
- import { EVENT_STREAM_EVENTS_MAP , LOGS_RETRY_COUNT , LOGS_STAGE_IDENTIFIER , POD_STATUS } from './constants'
33
+ import {
34
+ EVENT_STREAM_EVENTS_MAP ,
35
+ LOGS_RETRY_COUNT ,
36
+ LOGS_STAGE_IDENTIFIER ,
37
+ LOGS_STAGE_STREAM_SEPARATOR ,
38
+ POD_STATUS ,
39
+ } from './constants'
35
40
import {
36
41
CreateMarkupReturnType ,
37
42
DeploymentHistoryBaseParamsType ,
@@ -271,9 +276,11 @@ export const LogsRenderer = ({
271
276
return streamDataList . reduce ( ( acc , streamItem : string , index ) => {
272
277
if ( streamItem . startsWith ( LOGS_STAGE_IDENTIFIER ) ) {
273
278
try {
274
- const { stage, startTime, endTime, status } : StageInfoDTO = JSON . parse ( streamItem . split ( '|' ) [ 1 ] )
279
+ const { stage, startTime, endTime, status } : StageInfoDTO = JSON . parse (
280
+ streamItem . split ( LOGS_STAGE_STREAM_SEPARATOR ) [ 1 ] ,
281
+ )
275
282
const existingStage = acc . find ( ( item ) => item . stage === stage && item . startTime === startTime )
276
- const previousExistingStage = previousStageMap [ stage ] ?. [ startTime ]
283
+ const previousExistingStage = previousStageMap [ stage ] ?. [ startTime ] ?? ( { } as StageDetailType )
277
284
278
285
if ( existingStage ) {
279
286
// Would update the existing stage with new endTime
@@ -282,14 +289,14 @@ export const LogsRenderer = ({
282
289
existingStage . isOpen = getIsStageOpen (
283
290
status ,
284
291
previousExistingStage ?. isOpen ,
285
- ! ! searchKeyStatusMap [ stage ] ?. [ startTime ] ,
292
+ ! ! searchKeyStatusMap [ stage ] [ startTime ] ,
286
293
! ! targetSearchKey ,
287
294
)
288
295
} else {
289
296
acc . push ( {
290
297
stage : stage || `Untitled stage ${ index + 1 } ` ,
291
- startTime : startTime || ZERO_TIME_STRING ,
292
- endTime : endTime || ZERO_TIME_STRING ,
298
+ startTime : startTime || '' ,
299
+ endTime : endTime || '' ,
293
300
// Would be defining the state when we receive the end status, otherwise it is loading and would be open
294
301
isOpen : true ,
295
302
status : StageStatusType . PROGRESSING ,
@@ -298,15 +305,7 @@ export const LogsRenderer = ({
298
305
}
299
306
return acc
300
307
} catch ( e ) {
301
- acc . push ( {
302
- stage : `Untitled stage ${ index + 1 } ` ,
303
- startTime : ZERO_TIME_STRING ,
304
- endTime : ZERO_TIME_STRING ,
305
- isOpen : false ,
306
- logs : [ ] ,
307
- // Can not set status as FAILURE, as we will append latest logs to last stage
308
- status : StageStatusType . PROGRESSING ,
309
- } )
308
+ // In case of error would not create
310
309
return acc
311
310
}
312
311
}
@@ -347,8 +346,7 @@ export const LogsRenderer = ({
347
346
setStageList ( newStageList )
348
347
// NOTE: Not adding searchKey as dependency since on mount we would already have searchKey
349
348
// And for other cases we would use handleSearchEnter
350
- // TODO: Check if stringifying the streamDataList is required
351
- } , [ JSON . stringify ( streamDataList ) ] )
349
+ } , [ streamDataList ] )
352
350
353
351
const handleSearchEnter = ( searchText : string ) => {
354
352
handleSearch ( searchText )
@@ -383,6 +381,7 @@ export const LogsRenderer = ({
383
381
>
384
382
< div
385
383
className = "flexbox pl-12 logs-renderer__search-bar logs-renderer__filters-border-bottom dc__position-sticky dc__top-0 dc__zi-1"
384
+ // Doing this since we have binded 'f' with full screen and SearchVar has not exposed event on search, so on pressing f it goes to full screen
386
385
onKeyDown = { stopPropagation }
387
386
style = { {
388
387
backgroundColor : '#0C1021' ,
0 commit comments