[pve-devel] [RFC PATCH manager 5/5] add efidisk button to add menu
Dominik Csapak
d.csapak at proxmox.com
Mon Sep 12 12:02:38 CEST 2016
this adds a new button "efi disk" to the
qemu hardware add menu
this is only enabled if the vm has ovmf enabled and
no active efidisk
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/qemu/HardwareView.js | 36 ++++++++++++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 7765585..0623aa0 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -136,6 +136,7 @@ JSSRC= \
qemu/HDResize.js \
qemu/HDMove.js \
qemu/HDThrottle.js \
+ qemu/HDEfi.js \
qemu/CPUOptions.js \
qemu/DisplayEdit.js \
qemu/KeyboardEdit.js \
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 4b19e00..f4b12d4 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -139,6 +139,9 @@ Ext.define('PVE.qemu.HardwareView', {
},
cpulimit: {
visible: false
+ },
+ bios: {
+ visible: false
}
};
@@ -428,10 +431,35 @@ Ext.define('PVE.qemu.HardwareView', {
}
});
+ var efidisk_menuitem = Ext.create('Ext.menu.Item',{
+ text: gettext('EFI Disk'),
+ iconCls: 'pve-itype-icon-storage',
+ disabled: !caps.vms['VM.Config.Disk'],
+ handler: function() {
+ var win = Ext.create('PVE.qemu.EFIDiskEdit', {
+ url: '/api2/extjs/' + baseurl,
+ pveSelNode: me.pveSelNode
+ });
+ win.on('destroy', reload);
+ win.show();
+ }
+ });
+
var set_button_status = function() {
var sm = me.getSelectionModel();
var rec = sm.getSelection()[0];
+ // check if there is already an efidisk
+ var rstoredata = me.rstore.getData().map;
+ if (rstoredata.bios &&
+ rstoredata.bios.data.value === 'ovmf' &&
+ !rstoredata.efidisk0) {
+ // we have ovmf configured and no efidisk
+ efidisk_menuitem.setDisabled(false);
+ } else {
+ efidisk_menuitem.setDisabled(true);
+ }
+
if (!rec) {
remove_btn.disable();
edit_btn.disable();
@@ -450,6 +478,9 @@ Ext.define('PVE.qemu.HardwareView', {
rowdef.tdCls == 'pve-itype-icon-storage' &&
(value && !value.match(/media=cdrom/));
+ var isEfi = (key === 'efidisk0');
+
+
remove_btn.setDisabled(rec.data['delete'] || (rowdef.never_delete === true));
edit_btn.setDisabled(rec.data['delete'] || !rowdef.editor);
@@ -458,7 +489,7 @@ Ext.define('PVE.qemu.HardwareView', {
move_btn.setDisabled(pending || !isDisk);
- diskthrottle_btn.setDisabled(pending || !isDisk);
+ diskthrottle_btn.setDisabled(pending || !isDisk || isEfi);
revert_btn.setDisabled(!pending);
@@ -511,7 +542,8 @@ Ext.define('PVE.qemu.HardwareView', {
win.on('destroy', reload);
win.show();
}
- }
+ },
+ efidisk_menuitem
]
})
},
--
2.1.4
More information about the pve-devel
mailing list