mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-24 12:31:08 +00:00

for nested pools we have to provide the pool id via a get parameter instead of in the path, and also we have to extract the data from the returned array. To do this, changet the cbind url handler, remove the autoLoad one, and handle the load ourselves. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
54 lines
1.0 KiB
JavaScript
54 lines
1.0 KiB
JavaScript
Ext.define('PVE.dc.PoolEdit', {
|
|
extend: 'Proxmox.window.Edit',
|
|
alias: ['widget.pveDcPoolEdit'],
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
subject: gettext('Pool'),
|
|
|
|
cbindData: {
|
|
poolid: '',
|
|
isCreate: (cfg) => !cfg.poolid,
|
|
},
|
|
|
|
cbind: {
|
|
url: get => `/api2/extjs/pools/${!get('isCreate') ? '?poolid=' + get('poolid') : ''}`,
|
|
method: get => get('isCreate') ? 'POST' : 'PUT',
|
|
},
|
|
|
|
items: [
|
|
{
|
|
xtype: 'pmxDisplayEditField',
|
|
fieldLabel: gettext('Name'),
|
|
cbind: {
|
|
editable: '{isCreate}',
|
|
value: '{poolid}',
|
|
},
|
|
name: 'poolid',
|
|
allowBlank: false,
|
|
},
|
|
{
|
|
xtype: 'textfield',
|
|
fieldLabel: gettext('Comment'),
|
|
name: 'comment',
|
|
allowBlank: true,
|
|
},
|
|
],
|
|
|
|
initComponent: function() {
|
|
let me = this;
|
|
me.callParent();
|
|
if (me.poolid) {
|
|
me.load({
|
|
success: function(response) {
|
|
let data = response.result.data;
|
|
if (Ext.isArray(data)) {
|
|
me.setValues(data[0]);
|
|
} else {
|
|
me.setValues(data);
|
|
}
|
|
},
|
|
});
|
|
}
|
|
},
|
|
});
|