Skip to content

Commit 5a34853

Browse files
committed
feat: Refactor DeploymentStatusBreakdown component and update utility functions for improved clarity and functionality
1 parent 91015a1 commit 5a34853

File tree

4 files changed

+41
-54
lines changed

4 files changed

+41
-54
lines changed

src/Shared/Components/CICDHistory/DeploymentStatusBreakdown.tsx

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@
1515
*/
1616

1717
import { Fragment } from 'react'
18-
import { useRouteMatch } from 'react-router-dom'
1918

2019
import { TIMELINE_STATUS } from '@Shared/types'
2120

22-
import { URLS } from '../../../Common'
23-
import ErrorBar from '../Error/ErrorBar'
2421
import { DeploymentStatusDetailRow } from './DeploymentStatusDetailRow'
2522
import { DeploymentStatusDetailBreakdownType, DeploymentStatusDetailRowType } from './types'
2623

@@ -31,7 +28,6 @@ const DeploymentStatusDetailBreakdown = ({
3128
isVirtualEnvironment,
3229
appDetails,
3330
}: DeploymentStatusDetailBreakdownType) => {
34-
const { url } = useRouteMatch()
3531
const isHelmManifestPushed =
3632
deploymentStatusDetailsBreakdownData.deploymentStatusBreakdown[
3733
TIMELINE_STATUS.HELM_MANIFEST_PUSHED_TO_HELM_REPO
@@ -44,56 +40,51 @@ const DeploymentStatusDetailBreakdown = ({
4440
}
4541

4642
return (
47-
<>
48-
{!url.includes(`/${URLS.CD_DETAILS}`) && <ErrorBar appDetails={appDetails} />}
49-
<div className="deployment-status-breakdown-container" data-testid="deployment-history-steps-status">
50-
<DeploymentStatusDetailRow
51-
type={TIMELINE_STATUS.DEPLOYMENT_INITIATED}
52-
{...deploymentStatusDetailRowProps}
53-
/>
54-
{!(
55-
isVirtualEnvironment &&
56-
deploymentStatusDetailsBreakdownData.deploymentStatusBreakdown[
57-
TIMELINE_STATUS.HELM_PACKAGE_GENERATED
58-
]
59-
) ? (
60-
<>
61-
{(
62-
[
63-
TIMELINE_STATUS.GIT_COMMIT,
64-
TIMELINE_STATUS.ARGOCD_SYNC,
65-
TIMELINE_STATUS.KUBECTL_APPLY,
66-
] as DeploymentStatusDetailRowType['type'][]
67-
).map((timelineStatus) => (
68-
<Fragment key={timelineStatus}>
69-
<DeploymentStatusDetailRow type={timelineStatus} {...deploymentStatusDetailRowProps} />
70-
</Fragment>
71-
))}
43+
<div className="deployment-status-breakdown-container" data-testid="deployment-history-steps-status">
44+
<DeploymentStatusDetailRow
45+
type={TIMELINE_STATUS.DEPLOYMENT_INITIATED}
46+
{...deploymentStatusDetailRowProps}
47+
/>
48+
{!(
49+
isVirtualEnvironment &&
50+
deploymentStatusDetailsBreakdownData.deploymentStatusBreakdown[TIMELINE_STATUS.HELM_PACKAGE_GENERATED]
51+
) ? (
52+
<>
53+
{(
54+
[
55+
TIMELINE_STATUS.GIT_COMMIT,
56+
TIMELINE_STATUS.ARGOCD_SYNC,
57+
TIMELINE_STATUS.KUBECTL_APPLY,
58+
] as DeploymentStatusDetailRowType['type'][]
59+
).map((timelineStatus) => (
60+
<Fragment key={timelineStatus}>
61+
<DeploymentStatusDetailRow type={timelineStatus} {...deploymentStatusDetailRowProps} />
62+
</Fragment>
63+
))}
7264

65+
<DeploymentStatusDetailRow
66+
type={TIMELINE_STATUS.APP_HEALTH}
67+
hideVerticalConnector
68+
{...deploymentStatusDetailRowProps}
69+
/>
70+
</>
71+
) : (
72+
<>
73+
<DeploymentStatusDetailRow
74+
type={TIMELINE_STATUS.HELM_PACKAGE_GENERATED}
75+
hideVerticalConnector={!isHelmManifestPushed}
76+
{...deploymentStatusDetailRowProps}
77+
/>
78+
{isHelmManifestPushed && (
7379
<DeploymentStatusDetailRow
74-
type={TIMELINE_STATUS.APP_HEALTH}
80+
type={TIMELINE_STATUS.HELM_MANIFEST_PUSHED_TO_HELM_REPO}
7581
hideVerticalConnector
7682
{...deploymentStatusDetailRowProps}
7783
/>
78-
</>
79-
) : (
80-
<>
81-
<DeploymentStatusDetailRow
82-
type={TIMELINE_STATUS.HELM_PACKAGE_GENERATED}
83-
hideVerticalConnector={!isHelmManifestPushed}
84-
{...deploymentStatusDetailRowProps}
85-
/>
86-
{isHelmManifestPushed && (
87-
<DeploymentStatusDetailRow
88-
type={TIMELINE_STATUS.HELM_MANIFEST_PUSHED_TO_HELM_REPO}
89-
hideVerticalConnector
90-
{...deploymentStatusDetailRowProps}
91-
/>
92-
)}
93-
</>
94-
)}
95-
</div>
96-
</>
84+
)}
85+
</>
86+
)}
87+
</div>
9788
)
9889
}
9990

src/Shared/Components/CICDHistory/utils.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,7 @@ export const renderDeploymentTimelineIcon = (iconState: DeploymentStatusBreakdow
368368
return <Icon {...iconBaseProps} name="ic-circle-loader" color="O500" />
369369
case 'disconnect':
370370
return <Icon {...iconBaseProps} name="ic-disconnect" />
371-
case 'time_out':
372371
case 'timed_out':
373-
// TODO: Test
374372
return <Icon {...iconBaseProps} name="ic-timeout-two-dash" color="R500" />
375373
default:
376374
return <Icon {...iconBaseProps} name="ic-timer" color="N600" />
@@ -383,7 +381,6 @@ export const getDeploymentTimelineBGColorFromIcon = (icon: DeploymentStatusBreak
383381
return 'bcg-1 cg-7'
384382
case 'failed':
385383
case 'disconnect':
386-
case 'time_out':
387384
case 'timed_out':
388385
return 'bcr-1 cr-5'
389386
case 'inprogress':

src/Shared/Components/DeploymentStatusBreakdown/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const processKubeCTLApply = (
136136
)?.resourceDetails
137137

138138
if (resourceDetails) {
139-
// TODO: Confirm this logic since, can have duplication
139+
// TODO: Confirm this logic since, can have duplication of resourcePhase in the resourceDetails
140140
// Used to parse resource details base struct with current phase as last phase
141141
DEPLOYMENT_PHASES.forEach((phase) => {
142142
resourceDetails.forEach((item) => {

src/Shared/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,6 @@ export type DeploymentStatusBreakdownItemIconType =
12321232
// Loading is for subSteps
12331233
| 'loading'
12341234
| 'disconnect'
1235-
| 'time_out'
12361235
| 'timed_out'
12371236
| ''
12381237

0 commit comments

Comments
 (0)