From f42d798d102835972a94e04a358e7548214ef6eb Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Wed, 16 Sep 2026 09:17:29 +0800 Subject: [PATCH] fix: require names for cloud configuration templates (#1138) Signed-off-by: Victor Chang --- .../edit/harvesterhci.io.cloudtemplate.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/harvester/edit/harvesterhci.io.cloudtemplate.vue b/pkg/harvester/edit/harvesterhci.io.cloudtemplate.vue index cadbaa86..ffbd8e40 100644 --- a/pkg/harvester/edit/harvesterhci.io.cloudtemplate.vue +++ b/pkg/harvester/edit/harvesterhci.io.cloudtemplate.vue @@ -7,6 +7,7 @@ import NameNsDescription from '@shell/components/form/NameNsDescription'; import YamlEditor from '@shell/components/YamlEditor'; import CreateEditView from '@shell/mixins/create-edit-view'; +import FormValidation from '@shell/mixins/form-validation'; import { HCI } from '@pkg/harvester/config/labels-annotations'; export default { @@ -23,14 +24,19 @@ export default { NameNsDescription, }, - mixins: [CreateEditView], + mixins: [CreateEditView, FormValidation], inheritAttrs: false, data() { return { - config: this.value.data?.cloudInit || '', - type: this.value?.metadata?.labels?.[HCI.CLOUD_INIT] || 'user', + config: this.value.data?.cloudInit || '', + type: this.value?.metadata?.labels?.[HCI.CLOUD_INIT] || 'user', + fvFormRuleSets: [{ + path: 'metadata.name', + rules: ['required'], + translationKey: 'nameNsDescription.name.label', + }], }; }, @@ -78,6 +84,7 @@ export default { :resource="value" :errors="errors" :apply-hooks="applyHooks" + :validation-passed="fvFormIsValid" @finish="save" @cancel="done" @error="e=>errors=e" @@ -86,6 +93,7 @@ export default { :value="value" :mode="mode" :namespaced="true" + :rules="{ name: fvGetAndReportPathRules('metadata.name') }" @update:value="$emit('update:value', $event)" />