mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-08 06:38:39 +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',
|
IP64AddressListText: gettext('Example') + ': 192.168.1.1,192.168.1.2',
|
||||||
IP64AddressListMask: /[A-Fa-f0-9\,\:\.\;\ ]/
|
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';
|
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 = [
|
me.column1 = [
|
||||||
{
|
{
|
||||||
xtype: me.isCreate ? 'pveCephPoolSelector' : 'displayfield',
|
xtype: me.isCreate ? 'pveCephPoolSelector' : 'displayfield',
|
||||||
nodename: me.nodename,
|
nodename: me.nodename,
|
||||||
name: 'pool',
|
name: 'pool',
|
||||||
bind: getBinds(true, true),
|
bind: {
|
||||||
|
disabled: '{!pveceph}',
|
||||||
|
submitValue: '{pveceph}',
|
||||||
|
hidden: '{!pveceph}'
|
||||||
|
},
|
||||||
fieldLabel: gettext('Pool'),
|
fieldLabel: gettext('Pool'),
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
},
|
},
|
||||||
@ -127,7 +115,11 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
|||||||
xtype: me.isCreate ? 'textfield' : 'displayfield',
|
xtype: me.isCreate ? 'textfield' : 'displayfield',
|
||||||
name: 'pool',
|
name: 'pool',
|
||||||
value: 'rbd',
|
value: 'rbd',
|
||||||
bind: getBinds(false, true),
|
bind: {
|
||||||
|
disabled: '{pveceph}',
|
||||||
|
submitValue: '{!pveceph}',
|
||||||
|
hidden: '{pveceph}'
|
||||||
|
},
|
||||||
fieldLabel: gettext('Pool'),
|
fieldLabel: gettext('Pool'),
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
},
|
},
|
||||||
@ -135,7 +127,11 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
|||||||
xtype: 'textfield',
|
xtype: 'textfield',
|
||||||
name: 'monhost',
|
name: 'monhost',
|
||||||
vtype: 'HostList',
|
vtype: 'HostList',
|
||||||
bind: getBinds(false, true),
|
bind: {
|
||||||
|
disabled: '{pveceph}',
|
||||||
|
submitValue: '{!pveceph}',
|
||||||
|
hidden: '{pveceph}'
|
||||||
|
},
|
||||||
value: '',
|
value: '',
|
||||||
fieldLabel: 'Monitor(s)',
|
fieldLabel: 'Monitor(s)',
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
@ -153,7 +149,10 @@ Ext.define('PVE.storage.RBDInputPanel', {
|
|||||||
{
|
{
|
||||||
xtype: me.isCreate ? 'textfield' : 'displayfield',
|
xtype: me.isCreate ? 'textfield' : 'displayfield',
|
||||||
name: 'username',
|
name: 'username',
|
||||||
bind: me.isCreate ? getBinds(false) : {},
|
bind: {
|
||||||
|
disabled: '{pveceph}',
|
||||||
|
submitValue: '{!pveceph}'
|
||||||
|
},
|
||||||
value: 'admin',
|
value: 'admin',
|
||||||
fieldLabel: gettext('User name'),
|
fieldLabel: gettext('User name'),
|
||||||
allowBlank: true
|
allowBlank: true
|
||||||
|
Loading…
Reference in New Issue
Block a user