From 1b3666e15c9521656b46c5d3a41c7b9ed7d4cf77 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 14:01:35 +0800 Subject: [PATCH] fix(subnet): support None option for VLAN dropdown (#1085) (#1090) (cherry picked from commit be6e9b5f0678fd3a42ff7e648bf1768bb3377617) Signed-off-by: Andy Lee Co-authored-by: Andy Lee --- pkg/harvester/edit/kubeovn.io.subnet/index.vue | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/harvester/edit/kubeovn.io.subnet/index.vue b/pkg/harvester/edit/kubeovn.io.subnet/index.vue index fcd99300..b9ed162f 100644 --- a/pkg/harvester/edit/kubeovn.io.subnet/index.vue +++ b/pkg/harvester/edit/kubeovn.io.subnet/index.vue @@ -9,7 +9,7 @@ import Loading from '@shell/components/Loading'; import CreateEditView from '@shell/mixins/create-edit-view'; import { RadioGroup } from '@components/Form/Radio'; import { NETWORK_PROTOCOL, NETWORK_TYPE } from '@pkg/harvester/config/types'; -import { set } from '@shell/utils/object'; +import { set, remove } from '@shell/utils/object'; import ArrayList from '@shell/components/form/ArrayList'; import { allHash } from '@shell/utils/promise'; import { HCI } from '../../types'; @@ -142,10 +142,12 @@ export default { const inStore = this.$store.getters['currentProduct'].inStore; const vlans = this.$store.getters[`${ inStore }/all`](HCI.VLAN) || []; - return vlans.map((vlan) => ({ + const options = vlans.map((vlan) => ({ label: vlan.id, value: vlan.id, })); + + return [{ label: this.t('generic.none'), value: '' }, ...options]; } }, @@ -160,6 +162,14 @@ export default { } }, methods: { + onVlanChange(value) { + if (value === '') { + remove(this.value.spec, 'vlan'); + } else { + set(this.value, 'spec.vlan', value); + } + }, + async saveSubnet(buttonCb) { const errors = []; const name = this.value?.metadata?.name; @@ -283,12 +293,13 @@ export default {