Skip to content

Commit

Permalink
feat: add delete override view in compare config
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhishekA1509 committed Oct 4, 2024
1 parent eb9236c commit ca8409c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const CompareConfigView = ({
publishedEditorTemplate,
selectedChartVersion,
draftChartVersion,
isDeleteOverrideView,
}: CompareConfigViewProps) => (
<div className="flexbox-col dc__overflow-scroll">
<div className="dc__grid-half">
Expand All @@ -31,6 +32,7 @@ const CompareConfigView = ({
handleCompareFromOptionSelection={handleCompareFromOptionSelection}
draftChartVersion={draftChartVersion || ''}
currentEditorChartVersion={selectedChartVersion || ''}
isDeleteOverrideView={isDeleteOverrideView}
/>
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ const DeploymentTemplate = ({
(configHeaderTab === ConfigHeaderTabType.DRY_RUN && dryRunEditorMode === DryRunEditorMode.PUBLISHED_VALUES))
)
const isCompareView = !!(
isProtected &&
configHeaderTab === ConfigHeaderTabType.VALUES &&
selectedProtectionViewTab === ProtectConfigTabsType.COMPARE &&
!showReadMe &&
isProtected
!showReadMe
)

const isApprovalPending = isDraftAvailable && draftTemplateData.latestDraft.draftState === DraftState.AwaitApproval
Expand Down Expand Up @@ -396,9 +396,8 @@ const DeploymentTemplate = ({
const handleLoadScopedVariables = async () => {
// TODO: can think about adding abort controller
try {
// TODO: check if need to enhance this
const shouldFetchOriginalTemplate: boolean = !!isGuiSupported
// Fetching LHS in case of compare view
// Fetching LHS of compare view
const shouldFetchPublishedTemplate: boolean = isPublishedConfigPresent && isApprovalView && isCompareView

const [currentEditorTemplate, defaultTemplate, publishedTemplate] = await Promise.all([
Expand Down Expand Up @@ -1416,10 +1415,6 @@ const DeploymentTemplate = ({
: publishedTemplateData.editorTemplate
}

if (isCompareView && isDeleteOverrideDraft) {
return ''
}

if (isApprovalPendingOptionSelected) {
return hideLockedKeys ? draftTemplateData.editorTemplateWithoutLockedKeys : draftTemplateData.editorTemplate
}
Expand Down Expand Up @@ -1566,7 +1561,9 @@ const DeploymentTemplate = ({
...(window._env_.APPLICATION_METRICS_ENABLED && {
applicationMetrics: {
displayName: 'Application metrics',
value: String(publishedTemplateData?.isAppMetricsEnabled),
value: publishedTemplateData?.isAppMetricsEnabled
? String(publishedTemplateData.isAppMetricsEnabled)
: null,
},
}),
...(envId &&
Expand Down Expand Up @@ -1627,6 +1624,7 @@ const DeploymentTemplate = ({
publishedEditorTemplate={YAML.parse(getPublishedTemplate())}
selectedChartVersion={getCurrentTemplateSelectedChart().version}
draftChartVersion={draftTemplateData?.selectedChart?.version}
isDeleteOverrideView={isDeleteOverrideDraft}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export interface CompareConfigViewProps {
compareFromSelectedOptionValue: CompareFromApprovalOptionsValuesType
handleCompareFromOptionSelection: (value: SelectPickerOptionType) => void
isApprovalView: boolean
isDeleteOverrideView: boolean

currentEditorTemplate: Record<string | number, unknown>
publishedEditorTemplate: Record<string | number, unknown>
Expand Down

0 comments on commit ca8409c

Please sign in to comment.