@@ -14,7 +14,6 @@ import {
14
14
VisibleModal ,
15
15
Drawer ,
16
16
DeleteDialog ,
17
- DockerConfigOverrideType ,
18
17
RefVariableType ,
19
18
VariableType ,
20
19
MandatoryPluginDataType ,
@@ -179,7 +178,6 @@ export default function CIPipeline({
179
178
} ,
180
179
} )
181
180
const validationRules = new ValidationRules ( )
182
- const [ isDockerConfigOverridden , setDockerConfigOverridden ] = useState ( false )
183
181
const [ mandatoryPluginData , setMandatoryPluginData ] = useState < MandatoryPluginDataType > ( null )
184
182
const selectedBranchRef = useRef ( null )
185
183
@@ -285,6 +283,7 @@ export default function CIPipeline({
285
283
setPageState ( ViewType . LOADING )
286
284
getSecurityModuleStatus ( )
287
285
if ( ciPipelineId ) {
286
+ // TODO: Would need to add loader for getAvailablePlugins to avoid state toggle
288
287
getInitDataWithCIPipeline ( appId , ciPipelineId , true )
289
288
. then ( ( ciResponse ) => {
290
289
const preBuildVariable = calculateLastStepDetail (
@@ -367,7 +366,7 @@ export default function CIPipeline({
367
366
}
368
367
setPresetPlugins ( _presetPlugin )
369
368
setSharedPlugins ( _sharedPlugin )
370
- getMandatoryPluginData ( _formData , [ ..._presetPlugin , ..._sharedPlugin ] )
369
+ getMandatoryPluginData ( _formData , [ ..._presetPlugin , ..._sharedPlugin ] , true )
371
370
} )
372
371
. catch ( ( error : ServerErrors ) => {
373
372
showError ( error )
@@ -383,7 +382,11 @@ export default function CIPipeline({
383
382
} catch ( error ) { }
384
383
}
385
384
386
- const getMandatoryPluginData = ( _formData : PipelineFormType , pluginList : PluginDetailType [ ] ) : void => {
385
+ const getMandatoryPluginData = (
386
+ _formData : PipelineFormType ,
387
+ pluginList : PluginDetailType [ ] ,
388
+ referPrevState : boolean = false ,
389
+ ) : void => {
387
390
if ( ! isJobCard && processPluginData && prepareFormData && pluginList . length ) {
388
391
let branchName = ''
389
392
if ( _formData ?. materials ?. length ) {
@@ -398,7 +401,9 @@ export default function CIPipeline({
398
401
processPluginData ( _formData , pluginList , appId , ciPipelineId , branchName )
399
402
. then ( ( response : MandatoryPluginDataType ) => {
400
403
setMandatoryPluginData ( response )
401
- if ( _formData ) {
404
+ if ( referPrevState ) {
405
+ setFormData ( ( prevForm ) => prepareFormData ( { ...prevForm } , response ?. pluginData ?? [ ] ) )
406
+ } else {
402
407
setFormData ( prepareFormData ( _formData , response ?. pluginData ?? [ ] ) )
403
408
}
404
409
} )
@@ -533,11 +538,6 @@ export default function CIPipeline({
533
538
534
539
const msg = ciPipeline . id ? 'Pipeline Updated' : 'Pipeline Created'
535
540
536
- // Reset allow override flag to false if config matches with global
537
- if ( ! ciPipeline . isDockerConfigOverridden && ! isDockerConfigOverridden ) {
538
- formData . isDockerConfigOverridden = false
539
- formData . dockerConfigOverride = { } as DockerConfigOverrideType
540
- }
541
541
//here we check for the case where the pipeline is multigit and user selects pullrequest or tag creation(webhook)
542
542
//in that case we only send the webhook data not the other one.
543
543
let _materials = formData . materials
@@ -813,7 +813,6 @@ export default function CIPipeline({
813
813
isAdvanced = { isAdvanced }
814
814
ciPipeline = { ciPipeline }
815
815
isSecurityModuleInstalled = { isSecurityModuleInstalled }
816
- setDockerConfigOverridden = { setDockerConfigOverridden }
817
816
isJobView = { isJobCard }
818
817
getPluginData = { getPluginData }
819
818
/>
0 commit comments