mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
feat: support for HotPlugNICs from Kubevirt (#582)
* refactor: rename hotplug volume * feat: add hotplug NIC * feat: add hot unplug * refactor: rename NIC * feat: get latest status * feat: disable not ready options * feat: filter out system networks * refactor: update wordings --------- Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
@@ -29,6 +29,16 @@ export default class NetworkAttachmentDef extends SteveModel {
|
||||
}
|
||||
}
|
||||
|
||||
get isSystem() {
|
||||
const systemNamespaces = this.$rootGetters['systemNamespaces'];
|
||||
|
||||
if (systemNamespaces.includes(this.metadata?.namespace)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
get isIpamStatic() {
|
||||
return this.parseConfig.ipam?.type === 'static';
|
||||
}
|
||||
|
||||
@@ -200,10 +200,16 @@ export default class VirtVm extends HarvesterResource {
|
||||
label: this.t('harvester.action.abortMigration')
|
||||
},
|
||||
{
|
||||
action: 'addHotplug',
|
||||
action: 'addHotplugVolume',
|
||||
enabled: !!this.actions?.addVolume,
|
||||
icon: 'icon icon-plus',
|
||||
label: this.t('harvester.action.addHotplug')
|
||||
label: this.t('harvester.action.addHotplugVolume')
|
||||
},
|
||||
{
|
||||
action: 'addHotplugNic',
|
||||
enabled: this.hotplugNicFeatureEnabled && !!this.actions?.addNic,
|
||||
icon: 'icon icon-plus',
|
||||
label: this.t('harvester.action.addHotplugNic')
|
||||
},
|
||||
{
|
||||
action: 'createTemplate',
|
||||
@@ -389,8 +395,20 @@ export default class VirtVm extends HarvesterResource {
|
||||
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
diskName,
|
||||
component: 'HarvesterUnplugVolume'
|
||||
name: diskName,
|
||||
type: 'volume',
|
||||
component: 'HarvesterHotUnplug',
|
||||
});
|
||||
}
|
||||
|
||||
unplugNIC(networkName) {
|
||||
const resources = this;
|
||||
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
name: networkName,
|
||||
type: 'network',
|
||||
component: 'HarvesterHotUnplug',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -498,10 +516,17 @@ export default class VirtVm extends HarvesterResource {
|
||||
});
|
||||
}
|
||||
|
||||
addHotplug(resources = this) {
|
||||
addHotplugVolume(resources = this) {
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
component: 'HarvesterAddHotplugModal'
|
||||
component: 'HarvesterAddHotplugVolumeModal'
|
||||
});
|
||||
}
|
||||
|
||||
addHotplugNic(resources = this) {
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
component: 'HarvesterAddHotplugNic'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1234,6 +1259,10 @@ export default class VirtVm extends HarvesterResource {
|
||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('vmMachineTypeAuto');
|
||||
}
|
||||
|
||||
get hotplugNicFeatureEnabled() {
|
||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('hotplugNic');
|
||||
}
|
||||
|
||||
get isBackupTargetUnavailable() {
|
||||
const allSettings = this.$rootGetters['harvester/all'](HCI.SETTING) || [];
|
||||
const backupTargetSetting = allSettings.find( (O) => O.id === 'backup-target');
|
||||
|
||||
Reference in New Issue
Block a user