Skip to content

Commit 21c9226

Browse files
committed
feat: Update processKubeCTLApply to require data parameter and improve resource details handling
1 parent 5a34853 commit 21c9226

File tree

1 file changed

+8
-3
lines changed
  • src/Shared/Components/DeploymentStatusBreakdown

1 file changed

+8
-3
lines changed

src/Shared/Components/DeploymentStatusBreakdown/utils.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const processKubeCTLApply = (
120120
timelineData: DeploymentStatusBreakdownItemType,
121121
element: DeploymentStatusDetailsTimelineType,
122122
deploymentStatus: DeploymentStatusDetailsBreakdownDataType['deploymentStatus'],
123-
data?: DeploymentStatusDetailsType,
123+
data: DeploymentStatusDetailsType,
124124
) => {
125125
const tableData: {
126126
currentPhase: DeploymentPhaseType | ''
@@ -131,22 +131,27 @@ const processKubeCTLApply = (
131131
}
132132

133133
// Resource details are present in KUBECTL_APPLY_STARTED timeline alone
134-
const resourceDetails = data?.timelines?.find(
134+
const resourceDetails = data.timelines.find(
135135
(item) => item.status === TIMELINE_STATUS.KUBECTL_APPLY_STARTED,
136136
)?.resourceDetails
137137

138138
if (resourceDetails) {
139-
// TODO: Confirm this logic since, can have duplication of resourcePhase in the resourceDetails
140139
// Used to parse resource details base struct with current phase as last phase
141140
DEPLOYMENT_PHASES.forEach((phase) => {
141+
let breakPhase = false
142142
resourceDetails.forEach((item) => {
143+
if (breakPhase) {
144+
return
145+
}
146+
143147
if (phase === item.resourcePhase) {
144148
tableData.currentPhase = phase
145149
tableData.currentTableData.push({
146150
icon: 'success',
147151
phase,
148152
message: `${phase}: Create and update resources based on manifest`,
149153
})
154+
breakPhase = true
150155
}
151156
})
152157
})

0 commit comments

Comments
 (0)