ui: vm/efi: always allow to add EFI disk even if OVMF is not yet set

As this is annoying else, especially if the change from default to
ovmf BIOS is already a pending change..

A simple hint is enough, we do not do anything with the EFI disk if
OVMF is not set to be used anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-10-01 09:30:03 +02:00
parent d17464b0e2
commit b2621d928a
2 changed files with 27 additions and 22 deletions

View File

@ -37,15 +37,22 @@ Ext.define('PVE.qemu.EFIDiskInputPanel', {
me.drive = {};
me.items= [];
me.items= [
{
xtype: 'pveDiskStorageSelector',
name: 'efidisk0',
storageContent: 'images',
nodename: me.nodename,
hideSize: true
},
{
xtype: 'label',
text: gettext("Warning: The VM currently does not uses 'OVMF (UEFI)' as BIOS."),
userCls: 'pve-hint',
hidden: me.usesEFI,
},
];
me.items.push({
xtype: 'pveDiskStorageSelector',
name: 'efidisk0',
storageContent: 'images',
nodename: me.nodename,
hideSize: true
});
me.callParent();
}
});
@ -56,6 +63,7 @@ Ext.define('PVE.qemu.EFIDiskEdit', {
isAdd: true,
subject: gettext('EFI Disk'),
width: 450,
initComponent : function() {
var me = this;
@ -69,7 +77,8 @@ Ext.define('PVE.qemu.EFIDiskEdit', {
onlineHelp: 'qm_bios_and_uefi',
confid: me.confid,
nodename: nodename,
isCreate: true
usesEFI: me.usesEFI,
isCreate: true,
}];
me.callParent();

View File

@ -530,20 +530,16 @@ Ext.define('PVE.qemu.HardwareView', {
iconCls: 'fa fa-fw fa-hdd-o black',
disabled: !caps.vms['VM.Config.Disk'],
handler: function() {
let bios = me.rstore.getData().map.bios;
let usesEFI = bios && (bios.data.value === 'ovmf' || bios.data.pending === 'ovmf');
var rstoredata = me.rstore.getData().map;
// check if ovmf is configured
if (rstoredata.bios && rstoredata.bios.data.value === 'ovmf') {
var win = Ext.create('PVE.qemu.EFIDiskEdit', {
url: '/api2/extjs/' + baseurl,
pveSelNode: me.pveSelNode
});
win.on('destroy', reload);
win.show();
} else {
Ext.Msg.alert('Error',gettext('Please select OVMF(UEFI) as BIOS first.'));
}
var win = Ext.create('PVE.qemu.EFIDiskEdit', {
url: '/api2/extjs/' + baseurl,
pveSelNode: me.pveSelNode,
usesEFI: usesEFI,
});
win.on('destroy', reload);
win.show();
}
});