Skip to content

Commit 4240986

Browse files
committed
Merge branch 'main' of github.com:devtron-labs/dashboard into chore/sync-develop-with-main
2 parents 34cf77c + 3b68002 commit 4240986

File tree

14 files changed

+188
-91
lines changed

14 files changed

+188
-91
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.10.19",
7+
"@devtron-labs/devtron-fe-common-lib": "1.11.0",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/DeploymentTemplate/DeploymentTemplateForm.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,20 @@ const DeploymentTemplateForm = ({
164164
displayValue:
165165
expressEditComparisonViewLHS &&
166166
(expressEditComparisonViewLHS.isAppMetricsEnabled ? 'Enabled' : 'Disabled'),
167-
value: expressEditComparisonViewLHS?.isAppMetricsEnabled,
168-
},
169-
rhs: {
170-
value: isAppMetricsEnabled,
171-
dropdownConfig: {
172-
options: APPLICATION_METRICS_DROPDOWN_OPTIONS,
173-
onChange: toggleApplicationMetrics,
174-
},
167+
value: expressEditComparisonViewLHS?.isAppMetricsEnabled ?? false,
175168
},
169+
rhs: selectedChart.isAppMetricsSupported
170+
? {
171+
value: isAppMetricsEnabled,
172+
dropdownConfig: {
173+
options: APPLICATION_METRICS_DROPDOWN_OPTIONS,
174+
onChange: toggleApplicationMetrics,
175+
},
176+
}
177+
: {
178+
displayValue: isAppMetricsEnabled ? 'Enabled' : 'Disabled',
179+
value: isAppMetricsEnabled,
180+
},
176181
},
177182
]
178183

src/Pages/Shared/ConfigMapSecret/ConfigMapSecretContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ import {
9999
getConfigMapSecretResolvedDataPayload,
100100
getConfigMapSecretStateLabel,
101101
parseConfigMapSecretSearchParams,
102+
shouldHidePatchOption,
102103
} from './utils'
103104

104105
import './styles.scss'
@@ -1187,7 +1188,7 @@ export const ConfigMapSecretContainer = ({
11871188
handleMergeStrategyChange={handleMergeStrategyChange}
11881189
userApprovalMetadata={draftData?.userApprovalMetadata}
11891190
isApprovalPolicyConfigured={isApprovalPolicyConfigured}
1190-
hidePatchOption={isJob || formData.external}
1191+
hidePatchOption={shouldHidePatchOption(inheritedConfigMapSecretData, isJob)}
11911192
isMergeStrategySelectorDisabled={resolveScopedVariables}
11921193
areCommentsPresent={areCommentsPresent}
11931194
disableAllActions={isLoading || isSubmitting || !!parsingError}

src/Pages/Shared/ConfigMapSecret/ConfigMapSecretData.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const ConfigMapSecretData = ({
7575
isExpressEditComparisonView,
7676
draftData,
7777
publishedConfigMapSecretData,
78+
hidePatchOption,
7879
handleMergeStrategyChange,
7980
}: ConfigMapSecretDataProps) => {
8081
// USE FORM PROPS
@@ -375,6 +376,7 @@ export const ConfigMapSecretData = ({
375376
lhs: expressEditComparisonViewLHS,
376377
rhs: data,
377378
onMergeStrategySelect,
379+
hidePatchOption,
378380
})}
379381
readOnly={readOnly}
380382
lhsEditor={{
@@ -386,6 +388,10 @@ export const ConfigMapSecretData = ({
386388
}}
387389
showDraftOption={!!draftData}
388390
handleCompareWithChange={handleExpressEditCompareWithChange}
391+
hideEditor={{
392+
lhs: expressEditComparisonViewLHS?.external,
393+
rhs: data.external,
394+
}}
389395
/>
390396
) : (
391397
<CodeEditor.Container overflowHidden>
@@ -506,6 +512,14 @@ export const ConfigMapSecretData = ({
506512
return null
507513
}
508514

515+
const externalExpressEditEditor = () => {
516+
if (data.external && isExpressEditComparisonView) {
517+
return renderCodeEditor({ sheBangText: '' })
518+
}
519+
520+
return null
521+
}
522+
509523
return (
510524
<div className="flex-grow-1 flexbox-col dc__gap-12">
511525
{renderDataEditorSelector()}
@@ -516,6 +530,7 @@ export const ConfigMapSecretData = ({
516530
})
517531
: renderGUIEditor())}
518532
{externalSecretEditor()}
533+
{externalExpressEditEditor()}
519534
</div>
520535
)
521536
}

src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import { ConfigMapSecretData } from './ConfigMapSecretData'
5656
import { CM_SECRET_COMPONENT_NAME } from './constants'
5757
import { renderChartVersionBelow3090NotSupportedText, renderESOInfo, renderExternalInfo } from './helpers'
5858
import { ConfigMapSecretFormProps } from './types'
59+
import { shouldHidePatchOption } from './utils'
5960

6061
const DISABLE_DATA_TYPE_CHANGE_HELPER_MESSAGE = importComponentFromFELibrary(
6162
'DISABLE_DATA_TYPE_CHANGE_HELPER_MESSAGE',
@@ -422,6 +423,7 @@ export const ConfigMapSecretForm = ({
422423
publishedConfigMapSecretData={publishedConfigMapSecretData}
423424
isExpressEditView={isExpressEditView}
424425
isExpressEditComparisonView={isExpressEditComparisonView}
426+
hidePatchOption={shouldHidePatchOption(inheritedConfigMapSecretData, isJob)}
425427
handleMergeStrategyChange={handleMergeStrategyChange}
426428
/>
427429
</div>

src/Pages/Shared/ConfigMapSecret/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export interface ConfigMapSecretDataProps
150150
readOnly: boolean
151151
isPatchMode: boolean
152152
hasPublishedConfig: boolean
153+
hidePatchOption: boolean
153154
}
154155

155156
export type CMSecretDeleteModalType = 'deleteModal' | 'protectedDeleteModal' | 'expressDeleteDraft'

src/Pages/Shared/ConfigMapSecret/utils.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ export const getConfigMapSecretDataType = (
398398
: (getSelectPickerOptionByValue(getSecretDataTypeOptions(false, true), externalType).label as string)
399399
}
400400

401+
export const shouldHidePatchOption = (configMapSecretData: CMSecretConfigData, isJob: boolean) =>
402+
isJob || configMapSecretData?.external || false
403+
401404
export const getExpressEditComparisonViewLHS = ({
402405
isDraft,
403406
draftData,
@@ -436,10 +439,12 @@ export const getCMCSExpressEditComparisonDataDiffConfig = ({
436439
lhs,
437440
rhs,
438441
onMergeStrategySelect,
442+
hidePatchOption,
439443
}: {
440444
lhs: ConfigMapSecretUseFormProps
441445
rhs: ConfigMapSecretUseFormProps
442446
onMergeStrategySelect: (newValue: SelectPickerOptionType) => void
447+
hidePatchOption: boolean
443448
}) => [
444449
...(rhs.mergeStrategy
445450
? [
@@ -448,13 +453,17 @@ export const getCMCSExpressEditComparisonDataDiffConfig = ({
448453
lhs: {
449454
displayValue: lhs?.mergeStrategy,
450455
},
451-
rhs: {
452-
value: rhs.mergeStrategy,
453-
dropdownConfig: {
454-
options: MERGE_STRATEGY_OPTIONS,
455-
onChange: onMergeStrategySelect,
456-
},
457-
},
456+
rhs: hidePatchOption
457+
? {
458+
displayValue: rhs.mergeStrategy,
459+
}
460+
: {
461+
value: rhs.mergeStrategy,
462+
dropdownConfig: {
463+
options: MERGE_STRATEGY_OPTIONS,
464+
onChange: onMergeStrategySelect,
465+
},
466+
},
458467
},
459468
]
460469
: []),

0 commit comments

Comments
 (0)