]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
hide not usable buttons for qemu
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 29 Aug 2017 09:41:17 +0000 (11:41 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 1 Sep 2017 07:59:48 +0000 (09:59 +0200)
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@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/qemu/Config.js

index 3b1ff018f295f9a33bb4d7a8823352b14bc9aa92..75454d8e42a473b889530d367de0ae463333da57 100644 (file)
@@ -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);