Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle correctDrift:enabled undefined value #13029

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't repro this issue, although I didn't provision a rancher system from that commit, tbh.

My question is: Using v-model and @update:value to set the exact same variable value doesn't yield any problems on the console/UI?

We do either https://github.com/rancher/dashboard/blob/master/pkg/gke/components/AdvancedOptions.vue#L179-L184 or https://github.com/rancher/dashboard/blob/master/pkg/gke/components/AdvancedOptions.vue#L169-L173 but I don't think we should do both 🤔

The rest LGTM

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
Loading