[pve-devel] [PATCH manager 2/5] add CephPoolSelector
Dominik Csapak
d.csapak at proxmox.com
Tue Sep 5 16:23:47 CEST 2017
this allows us to give the user a list of pve managed ceph pools
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/form/CephPoolSelector.js | 42 +++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 www/manager6/form/CephPoolSelector.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 6c3efe0d..372e08af 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -72,6 +72,7 @@ JSSRC= \
form/VMSelector.js \
form/USBSelector.js \
form/CalendarEvent.js \
+ form/CephPoolSelector.js \
dc/Tasks.js \
dc/Log.js \
panel/StatusPanel.js \
diff --git a/www/manager6/form/CephPoolSelector.js b/www/manager6/form/CephPoolSelector.js
new file mode 100644
index 00000000..e66221d5
--- /dev/null
+++ b/www/manager6/form/CephPoolSelector.js
@@ -0,0 +1,42 @@
+Ext.define('PVE.form.CephPoolSelector', {
+ extend: 'Ext.form.field.ComboBox',
+ alias: 'widget.pveCephPoolSelector',
+
+ allowBlank: false,
+ valueField: 'pool_name',
+ displayField: 'pool_name',
+ editable: false,
+ queryMode: 'local',
+
+ initComponent: function() {
+ var me = this;
+
+ if (!me.nodename) {
+ throw "no nodename given";
+ }
+
+ var store = Ext.create('Ext.data.Store', {
+ fields: ['name'],
+ sorters: 'name',
+ proxy: {
+ type: 'pve',
+ url: '/api2/json/nodes/' + me.nodename + '/ceph/pools'
+ }
+ });
+
+ Ext.apply(me, {
+ store: store
+ });
+
+ me.callParent();
+
+ store.load({
+ callback: function(rec, op, success){
+ if (success && rec.length > 0) {
+ me.select(rec[0]);
+ }
+ }
+ });
+ }
+
+});
--
2.11.0
More information about the pve-devel
mailing list