@@ -12,7 +12,14 @@ import {
12
12
} from './service'
13
13
import { getChartReferences } from '../../services/service'
14
14
import { useJsonYaml , importComponentFromFELibrary , FloatingVariablesSuggestions } from '../common'
15
- import { showError , useEffectAfterMount , useAsync , Progressing } from '@devtron-labs/devtron-fe-common-lib'
15
+ import {
16
+ showError ,
17
+ useEffectAfterMount ,
18
+ useAsync ,
19
+ Progressing ,
20
+ getLockedJSON ,
21
+ getUnlockedJSON ,
22
+ } from '@devtron-labs/devtron-fe-common-lib'
16
23
import {
17
24
ConfigKeysWithLockType ,
18
25
DeploymentConfigContextType ,
@@ -46,10 +53,6 @@ import { SaveConfirmationDialog, SuccessToastBody } from './DeploymentTemplateVi
46
53
import { deploymentConfigReducer , initDeploymentConfigState } from './DeploymentConfigReducer'
47
54
import DeploymentTemplateReadOnlyEditorView from './DeploymentTemplateView/DeploymentTemplateReadOnlyEditorView'
48
55
import CodeEditor from '../CodeEditor/CodeEditor'
49
- import { getUnlockedJSON } from '@devtron-labs/devtron-fe-common-lib'
50
- import { getLockedJSON } from '@devtron-labs/devtron-fe-common-lib'
51
- import { getLockedJsonPathArray } from '../EnvironmentOverride/service'
52
-
53
56
const DeploymentTemplateLockedDiff = importComponentFromFELibrary ( 'DeploymentTemplateLockedDiff' )
54
57
const ConfigToolbar = importComponentFromFELibrary ( 'ConfigToolbar' , DeploymentConfigToolbar )
55
58
const SaveChangesModal = importComponentFromFELibrary ( 'SaveChangesModal' )
@@ -488,11 +491,9 @@ export default function DeploymentConfig({
488
491
} )
489
492
try {
490
493
const requestBody = prepareDataToSave ( true )
491
- const [ lockedJSONPathResp , deploymentTemplateResp ] = await Promise . all ( [
492
- getLockedJsonPathArray ( ) ,
493
- isProtected ? checkForProtectedLockedChanges ( ) : getIfLockedConfigNonProtected ( requestBody ) ,
494
- ] )
495
- setLockedConfigKeysWithLockType ( lockedJSONPathResp . result )
494
+ const deploymentTemplateResp = isProtected
495
+ ? await checkForProtectedLockedChanges ( )
496
+ : await getIfLockedConfigNonProtected ( requestBody )
496
497
if ( deploymentTemplateResp . result . isLockConfigError ) {
497
498
setDisableSaveEligibleChanges ( deploymentTemplateResp . result ?. disableSaveEligibleChanges )
498
499
setLockedOverride ( deploymentTemplateResp . result ?. lockedOverride )
@@ -539,11 +540,7 @@ export default function DeploymentConfig({
539
540
try {
540
541
const requestBody = prepareDataToSave ( true )
541
542
const api = state . chartConfig . id ? updateDeploymentTemplate : saveDeploymentTemplate
542
- const [ lockedJSONPathResp , deploymentTemplateResp ] = await Promise . all ( [
543
- getLockedJsonPathArray ( ) ,
544
- api ( requestBody , baseDeploymentAbortController . signal ) ,
545
- ] )
546
- setLockedConfigKeysWithLockType ( lockedJSONPathResp . result )
543
+ const deploymentTemplateResp = await api ( requestBody , baseDeploymentAbortController . signal )
547
544
if ( deploymentTemplateResp . result . isLockConfigError ) {
548
545
setDisableSaveEligibleChanges ( deploymentTemplateResp . result ?. disableSaveEligibleChanges )
549
546
setLockedOverride ( deploymentTemplateResp . result ?. lockedOverride )
@@ -578,6 +575,7 @@ export default function DeploymentConfig({
578
575
payload : false ,
579
576
} )
580
577
saveEligibleChangesCb && closeLockedDiffDrawerWithChildModal ( )
578
+ state . showConfirmation && handleConfirmationDialog ( false )
581
579
}
582
580
}
583
581
@@ -980,6 +978,7 @@ export default function DeploymentConfig({
980
978
lockedConfigKeysWithLockType = { lockedConfigKeysWithLockType }
981
979
lockedOverride = { lockedOverride }
982
980
disableSaveEligibleChanges = { disableSaveEligibleChanges }
981
+ setLockedConfigKeysWithLockType = { setLockedConfigKeysWithLockType }
983
982
/>
984
983
) }
985
984
{ SaveChangesModal && state . showSaveChangesModal && (
0 commit comments