[pve-devel] [PATCH manager v2] closes #195 : hide disallowed commands in tree
Emmanuel Kasper
e.kasper at proxmox.com
Mon Aug 1 16:24:36 CEST 2016
When basic capabilities are missing, don't display the corresponding actions in
the tree menu.
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 reenable the menu commands by himself.
This is mainly a usability improvement, as the real capabilities test is done in
the backend.
---
changes since v2:
reformat git commit message to follow pve-devel conventions (shorter
subject line and bug reference in subject)
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