[pve-devel] [RFC manager 2/4] Add a pool-centered bulk action

Philip Abernethy p.abernethy at proxmox.com
Wed Aug 30 17:22:59 CEST 2017


Uses the memberVSSelector to get a list of all VMs and containers
in the selected pool.
---
 www/manager6/window/PoolBulkAction.js | 100 ++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 www/manager6/window/PoolBulkAction.js

diff --git a/www/manager6/window/PoolBulkAction.js b/www/manager6/window/PoolBulkAction.js
new file mode 100644
index 00000000..1fae0ba5
--- /dev/null
+++ b/www/manager6/window/PoolBulkAction.js
@@ -0,0 +1,100 @@
+Ext.define('PVE.window.PoolBulkAction', {
+    extend: 'Ext.window.Window',
+
+    resizable: true,
+    width: 800,
+    modal: true,
+    layout: {
+	type: 'fit'
+    },
+    border: false,
+
+    // the action to be set
+    // currently there are
+    // startall
+    // stopall
+    action: undefined,
+
+    submit: function(params) {
+
+    },
+
+    initComponent: function() {
+	var me = this;
+
+	if (!me.poolname) {
+	    throw "no pool name specified";
+	}
+
+	if (!me.action) {
+	    throw "no action specified";
+	}
+
+	if (!me.btnText) {
+	    throw "no button text specified";
+	}
+
+	if (!me.title) {
+	    throw "no title specified";
+	}
+
+	var items = [];
+
+	if (me.action === 'startall') {
+	    items.push({
+		xtype: 'hiddenfield',
+		name: 'force',
+		value: 1
+	    });
+	}
+
+	items.push({
+	    xtype: 'membervmselector',
+	    itemId: 'vms',
+	    name: 'vms',
+	    flex: 1,
+	    height: 300,
+	    selectAll: true,
+	    allowBlank: false,
+	    poolname: me.poolname,
+	    action: me.action
+	});
+
+	me.formPanel = Ext.create('Ext.form.Panel', {
+	    bodyPadding: 10,
+	    border: false,
+	    layout: {
+		type: 'vbox',
+		align: 'stretch'
+	    },
+	    fieldDefaults: {
+		labelWidth: 300,
+		anchor: '100%'
+	    },
+	    items: items
+	});
+
+	var form = me.formPanel.getForm();
+
+	var submitBtn = Ext.create('Ext.Button', {
+	    text: me.btnText,
+	    handler: function() {
+		form.isValid();
+		me.submit(form.getValues());
+	    }
+	});
+
+	Ext.apply(me, {
+	    items: [ me.formPanel ],
+	    buttons: [ submitBtn ]
+	});
+
+	me.callParent();
+
+	form.on('validitychange', function() {
+	    var valid = form.isValid();
+	    submitBtn.setDisabled(!valid);
+	});
+	form.isValid();
+    }
+});
-- 
2.11.0





More information about the pve-devel mailing list