[pve-devel] [PATCH manager v2 1/3] hide not usable buttons for qemu

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Aug 29 11:41:17 CEST 2017


From: Dominik Csapak <d.csapak at proxmox.com>

this hides not usuable buttons for qemu
e.g. start/shutdown for templates
migrate for non-cluster setups

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

changes v1 -> v2:
 * none

 www/manager6/qemu/Config.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 3b1ff018..75454d8e 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -17,7 +17,7 @@ Ext.define('PVE.qemu.Config', {
 	    throw "no VM ID specified";
 	}
 
-	var template = me.pveSelNode.data.template;
+	var template = !!me.pveSelNode.data.template;
 
 	var caps = Ext.state.Manager.get('GuiCap');
 
@@ -53,6 +53,7 @@ Ext.define('PVE.qemu.Config', {
 	var startBtn = Ext.create('Ext.Button', {
 	    text: gettext('Start'),
 	    disabled: !caps.vms['VM.PowerMgmt'],
+	    hidden: template,
 	    handler: function() {
 		vm_command('start');
 	    },
@@ -62,6 +63,7 @@ Ext.define('PVE.qemu.Config', {
 	var migrateBtn = Ext.create('Ext.Button', {
 	    text: gettext('Migrate'),
 	    disabled: !caps.vms['VM.Migrate'],
+	    hidden: PVE.data.ResourceStore.getNodes().length < 2,
 	    handler: function() {
 		var win = Ext.create('PVE.window.Migrate', {
 		    vmtype: 'qemu',
@@ -104,6 +106,7 @@ Ext.define('PVE.qemu.Config', {
 	var shutdownBtn = Ext.create('PVE.button.Split', {
 	    text: gettext('Shutdown'),
 	    disabled: !caps.vms['VM.PowerMgmt'],
+	    hidden: template,
 	    confirmMsg: PVE.Utils.format_task_description('qmshutdown', vmid),
 	    handler: function() {
 		vm_command('shutdown');
@@ -147,6 +150,7 @@ Ext.define('PVE.qemu.Config', {
 
 	var consoleBtn = Ext.create('PVE.button.ConsoleButton', {
 	    disabled: !caps.vms['VM.Console'],
+	    hidden: template,
 	    consoleType: 'kvm',
 	    consoleName: vmname,
 	    nodename: nodename,
@@ -320,6 +324,10 @@ Ext.define('PVE.qemu.Config', {
 
 	    }
 
+	    if (template) {
+		return;
+	    }
+
 	    if (qmpstatus === 'prelaunch' || qmpstatus === 'paused' || qmpstatus === 'suspended') {
 		startBtn.setVisible(false);
 		resumeBtn.setVisible(true);
-- 
2.11.0




More information about the pve-devel mailing list