[pve-devel] [PATCH manager 1/3] check for VM.Montior privileges on qemu AgentIPView

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 23 10:58:28 CEST 2018


On 5/22/18 2:02 PM, Dominik Csapak wrote:
> 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 at proxmox.com>
> ---
>  www/manager6/qemu/AgentIPView.js | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/qemu/AgentIPView.js b/www/manager6/qemu/AgentIPView.js
> index ecc091f1..13fe3e9a 100644
> --- a/www/manager6/qemu/AgentIPView.js
> +++ b/www/manager6/qemu/AgentIPView.js
> @@ -128,15 +128,22 @@ 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']) {
> +	    me.updateStatus(false, gettext('Need VM.Monitor privileges'));

How about: Ext.String.format(gt('Requires {0} privileges'), 'VM.Monitor')

Seems more future proof then to have a translation for every privilege
which is required somewhere and we want the user to inform about it?

btw. could we do something like a: global var printf = Ext.String.format?
It's annoying to write this always out and makes readability worse, IMO.


> +	    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');
> 





More information about the pve-devel mailing list