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

Fix custom variables validation in Application edit mode #325

Merged
merged 3 commits into from
Sep 4, 2023
Merged
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
17 changes: 16 additions & 1 deletion dashboard/pkg/epinio/edit/applications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export default Vue.extend<Data, EpinioCompRecord, EpinioCompRecord, EpinioCompRe
previousButton: { disable: true }
},
],
epinioInfo: undefined
epinioInfo: undefined,
tabErrors: { appInfo: false }
};
},

Expand Down Expand Up @@ -111,6 +112,9 @@ export default Vue.extend<Data, EpinioCompRecord, EpinioCompRecord, EpinioCompRe
showSourceTab() {
return this.mode === _EDIT;
},
validationPassed() {
return !Object.values(this.tabErrors).find((error) => error);
}
},

methods: {
Expand Down Expand Up @@ -191,6 +195,14 @@ export default Vue.extend<Data, EpinioCompRecord, EpinioCompRecord, EpinioCompRe
updateManifestConfigurations(changes: string[]) {
this.set(this.value.configuration, { configurations: changes });
},
validate(value: boolean, tab: string) {
if (tab) {
this.tabErrors[tab] = !value;
}

// UpdateSource wizard will save settings as well, needs to disable the button in case of errors
this.steps[0].ready = value;
richard-cox marked this conversation as resolved.
Show resolved Hide resolved
}
},
});
</script>
Expand All @@ -204,6 +216,7 @@ export default Vue.extend<Data, EpinioCompRecord, EpinioCompRecord, EpinioCompRe
:mode="mode"
:resource="value"
:errors="errors"
:validation-passed="validationPassed"
@error="e=>errors = e"
@finish="save"
>
Expand Down Expand Up @@ -258,11 +271,13 @@ export default Vue.extend<Data, EpinioCompRecord, EpinioCompRecord, EpinioCompRe
label-key="epinio.applications.steps.basics.label"
name="info"
:weight="20"
:error="tabErrors.appInfo"
>
<AppInfo
:application="value"
:mode="mode"
@change="updateInfo"
@valid="validate($event, 'appInfo')"
/>
</Tab>
<Tab
Expand Down
Loading