]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
check for VM.Montior privileges on qemu AgentIPView
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 25 May 2018 08:36:33 +0000 (10:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 25 May 2018 08:43:47 +0000 (10:43 +0200)
so that the user does not get the useless 'no information' or
'not running' message, but the real cause

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/qemu/AgentIPView.js

index ecc091f12d2c666e58f9efae16909c53e879d44e..179b29223e04ed66644272481adaa3eda76a3886 100644 (file)
@@ -128,15 +128,23 @@ Ext.define('PVE.qemu.AgentIPView', {
        me.running = (store.getById('status').data.value === 'running');
        /*jslint confusion: false*/
 
+       var caps = Ext.state.Manager.get('GuiCap');
+
+       if (!caps.vms['VM.Monitor']) {
+           var errorText = gettext("Requires '{0}' Privileges");
+           me.updateStatus(false, Ext.String.format(errorText, 'VM.Monitor'));
+           return;
+       }
+
        if (me.agent && me.running && me.ipStore.isStopped) {
            me.ipStore.startUpdate();
        }
        me.updateStatus();
     },
 
-    updateStatus: function(unsuccessful) {
+    updateStatus: function(unsuccessful, defaulttext) {
        var me = this;
-       var text = gettext('No network information');
+       var text = defaulttext || gettext('No network information');
        var more = false;
        if (unsuccessful) {
            text = gettext('Guest Agent not running');