feat: add exclusive VLAN field to storage network settings (#914)

Signed-off-by: Renuka Devi Rajendran <renuka.rajendran@suse.com>
This commit is contained in:
Renuka Devi Rajendran 2026-06-08 08:44:24 -07:00 committed by GitHub
parent b18aebbbd4
commit 44ef9195eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 3 deletions

View File

@ -64,6 +64,9 @@ export default {
try { try {
parsedDefaultValue = JSON.parse(this.value.value); parsedDefaultValue = JSON.parse(this.value.value);
if (typeof parsedDefaultValue.exclusiveVlan !== 'boolean') {
parsedDefaultValue.exclusiveVlan = false;
}
networkType = 'vlan' in parsedDefaultValue ? L2VLAN : UNTAGGED; // backend doesn't provide networkType, so we check if vlan is provided instead networkType = 'vlan' in parsedDefaultValue ? L2VLAN : UNTAGGED; // backend doesn't provide networkType, so we check if vlan is provided instead
openVlan = true; openVlan = true;
} catch (error) { } catch (error) {
@ -72,7 +75,8 @@ export default {
vlan: '', vlan: '',
clusterNetwork: '', clusterNetwork: '',
range: '', range: '',
exclude: [] exclude: [],
exclusiveVlan: false
}; };
} }
const exclude = parsedDefaultValue?.exclude?.toString().split(',') || []; const exclude = parsedDefaultValue?.exclude?.toString().split(',') || [];
@ -94,6 +98,10 @@ export default {
}, },
computed: { computed: {
showExclusiveVlan() {
return this.networkType === L2VLAN &&
Number(this.parsedDefaultValue.vlan) !== 1;
},
showVlan() { showVlan() {
return this.networkType === L2VLAN; return this.networkType === L2VLAN;
}, },
@ -132,6 +140,18 @@ export default {
}; };
}); });
}, },
exclusiveVlanOptions() {
return [
{
label: this.t('generic.enabled'),
value: true
},
{
label: this.t('generic.disabled'),
value: false
}
];
},
}, },
watch: { watch: {
@ -174,7 +194,8 @@ export default {
vlan: '', vlan: '',
clusterNetwork: '', clusterNetwork: '',
range: '', range: '',
exclude: [] exclude: [],
exclusiveVlan: false
}; };
}, },
@ -280,7 +301,15 @@ export default {
label-key="harvester.setting.storageNetwork.vlan" label-key="harvester.setting.storageNetwork.vlan"
@update:value="inputVlan" @update:value="inputVlan"
/> />
<LabeledSelect
v-if="showExclusiveVlan"
v-model:value="parsedDefaultValue.exclusiveVlan"
class="mb-20"
:options="exclusiveVlanOptions"
:mode="mode"
label-key="harvester.setting.storageNetwork.exclusiveVlan"
@update:value="update"
/>
<LabeledSelect <LabeledSelect
v-model:value="parsedDefaultValue.clusterNetwork" v-model:value="parsedDefaultValue.clusterNetwork"
label-key="harvester.setting.storageNetwork.clusterNetwork" label-key="harvester.setting.storageNetwork.clusterNetwork"

View File

@ -1310,6 +1310,7 @@ harvester:
invalid: '"Range" is invalid.' invalid: '"Range" is invalid.'
clusterNetwork: Cluster Network clusterNetwork: Cluster Network
vlan: VLAN ID vlan: VLAN ID
exclusiveVlan: Exclusive VLAN
exclude: exclude:
label: Exclude IPs label: Exclude IPs
placeholder: CIDR format, e.g. 172.16.0.10/32 placeholder: CIDR format, e.g. 172.16.0.10/32