mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-04 19:32:23 +00:00
ui: rbd: storage: obsolete strange getBinds binding assembly
this was added for our (also in other places used): > xtype: me.isCreate ? 'pveCephPoolSelector' : 'displayfield', construct. But as displayfield does not has a submitValue setter we cannot bind it generally. So add such a setter with a small override and declare the bindings direct when declaring the items, less side effects and all the configurations for an item stays in the same place. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
b42d008b3a
commit
8c93faf917
@ -27,3 +27,12 @@ Ext.apply(Ext.form.field.VTypes, {
|
||||
IP64AddressListText: gettext('Example') + ': 192.168.1.1,192.168.1.2',
|
||||
IP64AddressListMask: /[A-Fa-f0-9\,\:\.\;\ ]/
|
||||
});
|
||||
|
||||
Ext.define('PVE.form.field.Display', {
|
||||
override: 'Ext.form.field.Display',
|
||||
|
||||
setSubmitValue: function(value) {
|
||||
// do nothing, this is only to allow generalized bindings for the:
|
||||
// `me.isCreate ? 'textfield' : 'displayfield'` cases we have.
|
||||
}
|
||||
});
|
||||
|
@ -98,28 +98,16 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
||||
}
|
||||
me.type = 'rbd';
|
||||
|
||||
var getBinds = function (activeIfPVECeph, hide) {
|
||||
var bind = {
|
||||
disabled: activeIfPVECeph ? '{!pveceph}' : '{pveceph}'
|
||||
};
|
||||
|
||||
// displayfield has no submitValue and bind mixin cannot handle that
|
||||
if (me.isCreate) {
|
||||
bind.submitValue = activeIfPVECeph ? '{pveceph}' : '{!pveceph}';
|
||||
}
|
||||
if (hide) {
|
||||
bind.hidden = activeIfPVECeph ? '{!pveceph}' : '{pveceph}';
|
||||
}
|
||||
|
||||
return bind;
|
||||
};
|
||||
|
||||
me.column1 = [
|
||||
{
|
||||
xtype: me.isCreate ? 'pveCephPoolSelector' : 'displayfield',
|
||||
nodename: me.nodename,
|
||||
name: 'pool',
|
||||
bind: getBinds(true, true),
|
||||
bind: {
|
||||
disabled: '{!pveceph}',
|
||||
submitValue: '{pveceph}',
|
||||
hidden: '{!pveceph}'
|
||||
},
|
||||
fieldLabel: gettext('Pool'),
|
||||
allowBlank: false
|
||||
},
|
||||
@ -127,7 +115,11 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
||||
xtype: me.isCreate ? 'textfield' : 'displayfield',
|
||||
name: 'pool',
|
||||
value: 'rbd',
|
||||
bind: getBinds(false, true),
|
||||
bind: {
|
||||
disabled: '{pveceph}',
|
||||
submitValue: '{!pveceph}',
|
||||
hidden: '{pveceph}'
|
||||
},
|
||||
fieldLabel: gettext('Pool'),
|
||||
allowBlank: false
|
||||
},
|
||||
@ -135,7 +127,11 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
||||
xtype: 'textfield',
|
||||
name: 'monhost',
|
||||
vtype: 'HostList',
|
||||
bind: getBinds(false, true),
|
||||
bind: {
|
||||
disabled: '{pveceph}',
|
||||
submitValue: '{!pveceph}',
|
||||
hidden: '{pveceph}'
|
||||
},
|
||||
value: '',
|
||||
fieldLabel: 'Monitor(s)',
|
||||
allowBlank: false
|
||||
@ -153,7 +149,10 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
||||
{
|
||||
xtype: me.isCreate ? 'textfield' : 'displayfield',
|
||||
name: 'username',
|
||||
bind: me.isCreate ? getBinds(false) : {},
|
||||
bind: {
|
||||
disabled: '{pveceph}',
|
||||
submitValue: '{!pveceph}'
|
||||
},
|
||||
value: 'admin',
|
||||
fieldLabel: gettext('User name'),
|
||||
allowBlank: true
|
||||
|
Loading…
Reference in New Issue
Block a user