Skip to content

Commit ec06938

Browse files
committed
fix: using getIsStageOpen for start stage
1 parent 997a5c3 commit ec06938

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.1.8-beta-8",
3+
"version": "0.1.8-beta-9",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/CICDHistory/LogsRenderer.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,24 @@ export const LogsRenderer = ({
235235
*/
236236
const getIsStageOpen = (
237237
status: StageStatusType,
238-
lastUserActionState: boolean,
238+
lastUserActionState: boolean | undefined,
239239
isSearchKeyPresent: boolean,
240240
isFromSearchAction: boolean,
241241
): boolean => {
242242
const isInitialState = stageList.length === 0
243+
const lastActionState = lastUserActionState ?? true
243244

245+
// In case of search action, would open the stage if search key is present
246+
// If search key is not present would return the last action state, if no action taken would return true(that is stage is new or being loaded)
244247
if (isFromSearchAction) {
245-
return isSearchKeyPresent || lastUserActionState
248+
return isSearchKeyPresent || lastActionState
246249
}
247250

248251
if (isInitialState) {
249252
return status !== StageStatusType.SUCCESS || isSearchKeyPresent
250253
}
251254

252-
return lastUserActionState ?? true
255+
return lastActionState
253256
}
254257

255258
/**
@@ -298,7 +301,12 @@ export const LogsRenderer = ({
298301
startTime: startTime || '',
299302
endTime: endTime || '',
300303
// Would be defining the state when we receive the end status, otherwise it is loading and would be open
301-
isOpen: true,
304+
isOpen: getIsStageOpen(
305+
StageStatusType.PROGRESSING,
306+
previousExistingStage.isOpen,
307+
!!searchKeyStatusMap[stage]?.[startTime],
308+
!!targetSearchKey,
309+
),
302310
status: StageStatusType.PROGRESSING,
303311
logs: [],
304312
})

0 commit comments

Comments
 (0)