add CephPoolSelector

this allows us to give the user a list of pve managed ceph pools

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2017-09-05 16:23:47 +02:00 committed by Fabian Grünbichler
parent 52b3ac0385
commit 6e198c8f49
2 changed files with 43 additions and 0 deletions

View File

@ -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 \

View File

@ -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]);
}
}
});
}
});