[pve-devel] [PATCH manager] When basic capabilities are missing, don't display the corresponding actions in the tree menu

Eneko Lacunza elacunza at binovo.es
Mon Aug 1 14:40:15 CEST 2016


How refreshing to see a 4 year old issue get taken care of! ;)

Thanks

El 01/08/16 a las 14:20, Emmanuel Kasper escribió:
> Note that we *hide* the corresponding actions, instead of disabling by greying out the menu command.
> Disabling here does not make sense, since a low privilege user
> has no way to re enabling the menu commands by himself.
>
> This is mainly a usability improvement, as the real capabilities test is done in the backend.
>
> closes: #195
> ---
>   www/manager6/qemu/CmdMenu.js | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
> index 3865e3d..7a95e36 100644
> --- a/www/manager6/qemu/CmdMenu.js
> +++ b/www/manager6/qemu/CmdMenu.js
> @@ -28,6 +28,8 @@ Ext.define('PVE.qemu.CmdMenu', {
>   	    });
>   	};
>   
> +	var caps = Ext.state.Manager.get('GuiCap');
> +
>   	var running = false;
>   	var stopped = true;
>   	var suspended = false;
> @@ -112,6 +114,7 @@ Ext.define('PVE.qemu.CmdMenu', {
>   	    {
>   		text: gettext('Migrate'),
>   		iconCls: 'fa fa-fw fa-send-o',
> +		hidden: caps.vms['VM.Migrate'] ? false : true,
>   		handler: function() {
>   		    var win = Ext.create('PVE.window.Migrate', {
>   			vmtype: 'qemu',
> @@ -124,6 +127,7 @@ Ext.define('PVE.qemu.CmdMenu', {
>   	    {
>   		text: gettext('Clone'),
>   		iconCls: 'fa fa-fw fa-clone',
> +		hidden: caps.vms['VM.Clone'] ? false : true,
>   		handler: function() {
>   		    var win = Ext.create('PVE.window.Clone', {
>   			nodename: nodename,
> @@ -135,6 +139,7 @@ Ext.define('PVE.qemu.CmdMenu', {
>   	    {
>   		text: gettext('Convert to template'),
>   		iconCls: 'fa fa-fw fa-file-o',
> +		hidden: caps.vms['VM.Allocate'] ? false : true,
>   		handler: function() {
>   		    var msg = PVE.Utils.format_task_description('qmtemplate', vmid);
>   		    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {


-- 
Zuzendari Teknikoa / Director Técnico
Binovo IT Human Project, S.L.
Telf. 943493611
       943324914
Astigarraga bidea 2, planta 6 dcha., ofi. 3-2; 20180 Oiartzun (Gipuzkoa)
www.binovo.es




More information about the pve-devel mailing list