fix: require names for cloud configuration templates (#1138)

Signed-off-by: Victor Chang <t7902195204@gmail.com>
This commit is contained in:
Victor Chang
2026-09-16 09:17:29 +08:00
committed by GitHub
parent 50b4cf5248
commit f42d798d10
@@ -7,6 +7,7 @@ import NameNsDescription from '@shell/components/form/NameNsDescription';
import YamlEditor from '@shell/components/YamlEditor'; import YamlEditor from '@shell/components/YamlEditor';
import CreateEditView from '@shell/mixins/create-edit-view'; import CreateEditView from '@shell/mixins/create-edit-view';
import FormValidation from '@shell/mixins/form-validation';
import { HCI } from '@pkg/harvester/config/labels-annotations'; import { HCI } from '@pkg/harvester/config/labels-annotations';
export default { export default {
@@ -23,14 +24,19 @@ export default {
NameNsDescription, NameNsDescription,
}, },
mixins: [CreateEditView], mixins: [CreateEditView, FormValidation],
inheritAttrs: false, inheritAttrs: false,
data() { data() {
return { return {
config: this.value.data?.cloudInit || '', config: this.value.data?.cloudInit || '',
type: this.value?.metadata?.labels?.[HCI.CLOUD_INIT] || 'user', 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" :resource="value"
:errors="errors" :errors="errors"
:apply-hooks="applyHooks" :apply-hooks="applyHooks"
:validation-passed="fvFormIsValid"
@finish="save" @finish="save"
@cancel="done" @cancel="done"
@error="e=>errors=e" @error="e=>errors=e"
@@ -86,6 +93,7 @@ export default {
:value="value" :value="value"
:mode="mode" :mode="mode"
:namespaced="true" :namespaced="true"
:rules="{ name: fvGetAndReportPathRules('metadata.name') }"
@update:value="$emit('update:value', $event)" @update:value="$emit('update:value', $event)"
/> />