pve-manager/www/manager6/form/CephPoolSelector.js
Aaron Lauterer b5bbcb4c7f ui: ceph: adapt urls to new ceph/pool endpoint
ceph/pools (plural) is deprecated, use the new one.
Since the details / status of a pool has been moved from previously
ceph/pools/{name} to now ceph/pool/{name}/status, we need to pass the
'loadUrl' to the edit window.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by:  Dominik Csapak <d.csapak@proxmox.com>
2023-03-20 15:31:04 +01:00

51 lines
975 B
JavaScript

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";
}
let onlyRBDPools = ({ data }) =>
!data?.application_metadata || !!data?.application_metadata?.rbd;
var store = Ext.create('Ext.data.Store', {
fields: ['name'],
sorters: 'name',
filters: [
onlyRBDPools,
],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes/' + me.nodename + '/ceph/pool',
},
});
Ext.apply(me, {
store: store,
});
me.callParent();
store.load({
callback: function(rec, op, success) {
let filteredRec = rec.filter(onlyRBDPools);
if (success && filteredRec.length > 0) {
me.select(filteredRec[0]);
}
},
});
},
});