Adds a CmdMenu for pools to allow for right-click actions on a
selected pool.
---
 www/manager6/pool/CmdMenu.js | 57 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 www/manager6/pool/CmdMenu.js

diff --git a/www/manager6/pool/CmdMenu.js b/www/manager6/pool/CmdMenu.js
new file mode 100644
index 00000000..cd79e35a
--- /dev/null
+++ b/www/manager6/pool/CmdMenu.js
@@ -0,0 +1,57 @@
+Ext.define('PVE.pool.CmdMenu', {
+    extend: 'Ext.menu.Menu',
+
+    showSeparator: false,
+
+    items: [
+       {
+           text: gettext('Bulk Start'),
+           itemId: 'bulkstart',
+           iconCls: 'fa fa-fw fa-play',
+           handler: function() {
+               var me = this.up('menu');
+               var win = Ext.create('PVE.window.PoolBulkAction', {
+                   poolname: me.pveSelNode.data.pool,
+                   title: gettext('Bulk Start'),
+                   btnText: gettext('Start'),
+                   action: 'startall'
+               });
+               win.show();
+           }
+       },
+       {
+           text: gettext('Bulk Stop'),
+           itemId: 'bulkstop',
+           iconCls: 'fa fa-fw fa-stop',
+           handler: function() {
+               var me = this.up('menu');
+               var win = Ext.create('PVE.window.PoolBulkAction', {
+                   poolname: me.pveSelNode.data.pool,
+                   title: gettext('Bulk Stop'),
+                   btnText: gettext('Stop'),
+                   action: 'stopall'
+               });
+               win.show();
+           }
+       }
+    ],
+
+    initComponent: function() {
+       var me = this;
+
+       var poolname = me.pveSelNode.data.pool;
+       if (!poolname) {
+           throw "no pool name specified";
+       }
+
+       me.title = gettext('Pool') + " '" + poolname + "'";
+       me.callParent();
+
+       var caps = Ext.state.Manager.get('GuiCap');
+       // disable not allowed options
+       if (!caps.nodes['Sys.PowerMgmt']) {
+           me.getComponent('bulkstart').setDisabled('true');
+           me.getComponent('bulkstop').setDisabled('true');
+       }
+    }
+});
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to