Skip to content

Commit 9566a95

Browse files
author
Mukul Tayal
committed
fix hide lock keys issue for manifest
1 parent 2ae0680 commit 9566a95

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export default function DeploymentTemplateOverrideForm({
371371
openComparison: state.showReadme && state.selectedTabIndex === 2,
372372
},
373373
})
374+
hideLockKeysToggled.current = true
374375
}
375376

376377
const handleComparisonClick = () => {
@@ -528,6 +529,9 @@ export default function DeploymentTemplateOverrideForm({
528529
: YAML.stringify(state.data.globalConfig, { indent: 2 })
529530
} else if (state.tempFormData) {
530531
codeEditorValue = state.tempFormData
532+
if (applyPatches && hideLockedKeys) {
533+
codeEditorValue = YAML.stringify(applyPatches(YAML.parse(state.tempFormData), removedPatches.current))
534+
}
531535
} else {
532536
const isOverridden = state.latestDraft?.action === 3 ? state.isDraftOverriden : !!state.duplicate
533537
codeEditorValue = isOverridden

src/components/deploymentConfig/DeploymentConfig.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ export default function DeploymentConfig({
660660
openComparison: state.showReadme && state.selectedTabIndex === 2,
661661
},
662662
})
663+
hideLockKeysToggled.current = true
663664
}
664665

665666
const handleComparisonClick = () => {
@@ -862,7 +863,11 @@ export default function DeploymentConfig({
862863
if (isCompareAndApprovalState) {
863864
result = await fetchManifestData(state.draftValues)
864865
} else {
865-
result = await fetchManifestData(state.tempFormData)
866+
if (applyPatches && hideLockedKeys) {
867+
result = fetchManifestData(
868+
YAML.stringify(applyPatches(YAML.parse(state.tempFormData), removedPatches.current)),
869+
)
870+
} else result = await fetchManifestData(state.tempFormData)
866871
}
867872
return result
868873
}

src/components/deploymentConfig/DeploymentTemplateView/DeploymentTemplateEditorView.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,18 +321,22 @@ const getLockFilteredTemplate = importComponentFromFELibrary('getLockFilteredTem
321321
// final value for RHS
322322
let rhs = convertVariables ? resolvedValuesRHS : valueRHS
323323
if (getLockFilteredTemplate && isValues) {
324-
const { updatedLHS, updatedRHS } = getLockFilteredTemplate({
325-
hideLockedKeys,
326-
lhs,
327-
rhs,
328-
lockedConfigKeysWithLockType,
329-
removedPatches,
330-
hideLockKeysToggled,
331-
unableToParseYaml: state.unableToParseYaml,
332-
readOnly,
333-
})
334-
lhs = updatedLHS
335-
rhs = updatedRHS
324+
try {
325+
const { updatedLHS, updatedRHS } = getLockFilteredTemplate({
326+
hideLockedKeys,
327+
lhs,
328+
rhs,
329+
lockedConfigKeysWithLockType,
330+
removedPatches,
331+
hideLockKeysToggled,
332+
unableToParseYaml: state.unableToParseYaml,
333+
readOnly,
334+
})
335+
lhs = updatedLHS
336+
rhs = updatedRHS
337+
} catch (err) {
338+
showError(err)
339+
}
336340
}
337341

338342
const renderCodeEditorHeading = () => (

0 commit comments

Comments
 (0)