[pve-devel] [PATCH manager] When basic capabilities are missing, don't display the corresponding actions in the tree menu
Emmanuel Kasper
e.kasper at proxmox.com
Mon Aug 1 14:20:52 CEST 2016
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) {
--
2.1.4
More information about the pve-devel
mailing list