Skip to content

Commit

Permalink
Handle correctDrift:enabled undefined value
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <[email protected]>
  • Loading branch information
torchiaf committed Jan 9, 2025
1 parent 374ca33 commit 686cd9c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions shell/edit/fleet.cattle.io.gitrepo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ export default {
this.tlsMode = tls;
if (this.value.spec.correctDrift === undefined) {
this.value.spec['correctDrift'] = { enabled: false };
}
this.correctDriftEnabled = this.value.spec?.correctDrift?.enabled || false;
this.updateTargets();
},
Expand Down Expand Up @@ -145,6 +143,7 @@ export default {
privateKey: null,
tlsMode: null,
caBundle: null,
correctDriftEnabled: false,
targetAdvancedErrors: null,
matchingClusters: null,
ref,
Expand Down Expand Up @@ -492,6 +491,12 @@ export default {
}
}
},
onSave() {
this.value.spec['correctDrift'] = { enabled: this.correctDriftEnabled };
this.save();
}
}
};
</script>
Expand All @@ -513,7 +518,7 @@ export default {
class="wizard"
@cancel="done"
@error="e=>errors = e"
@finish="save"
@finish="onSave"
>
<template #noticeBanner>
<Banner
Expand Down Expand Up @@ -648,12 +653,13 @@ export default {
<h2 v-t="'fleet.gitRepo.resources.label'" />
<div>
<Checkbox
v-model:value="value.spec.correctDrift.enabled"
v-model:value="correctDriftEnabled"
data-testid="GitRepo-correctDrift-checkbox"
class="check"
type="checkbox"
label-key="fleet.gitRepo.resources.correctDrift"
:mode="mode"
@update:value="correctDriftEnabled=$event"
/>
<Banner
data-testid="GitRepo-correctDrift-banner"
Expand Down

0 comments on commit 686cd9c

Please sign in to comment.