ext6migrate: fix display of sport/dport/proto combo boxes

setting the field value of to '' would trigger
the 'change' event which would then disable
the sport/dport/proto comboboxes too early, an empty
form would have the comboboxes disabled too

instead keep the field to a null value if it is empty, but force
it to '' before sending to the pve-proxy

also makes the macro selector keyboard editable, similar to
the other comboboxes in the input panel
This commit is contained in:
Emmanuel Kasper 2016-02-15 09:23:00 +01:00 committed by Dietmar Maurer
parent 3d990919c2
commit 1fafdce8c2

View File

@ -58,7 +58,7 @@ Ext.define('PVE.FirewallRulePanel', {
// hack: editable ComboGrid returns nothing when empty, so we need to set '' // hack: editable ComboGrid returns nothing when empty, so we need to set ''
// Also, disabled text fields return nothing, so we need to set '' // Also, disabled text fields return nothing, so we need to set ''
Ext.Array.each(['source', 'dest', 'proto', 'sport', 'dport'], function(key) { Ext.Array.each(['source', 'dest', 'macro', 'proto', 'sport', 'dport'], function(key) {
if (values[key] === undefined) { if (values[key] === undefined) {
values[key] = ''; values[key] = '';
} }
@ -161,12 +161,12 @@ Ext.define('PVE.FirewallRulePanel', {
{ {
xtype: 'pveFWMacroSelector', xtype: 'pveFWMacroSelector',
name: 'macro', name: 'macro',
value: '',
fieldLabel: gettext('Macro'), fieldLabel: gettext('Macro'),
editable: true,
allowBlank: true, allowBlank: true,
listeners: { listeners: {
change: function(f, value) { change: function(f, value) {
if (value === '') { if (value === null) {
me.down('field[name=proto]').setDisabled(false); me.down('field[name=proto]').setDisabled(false);
me.down('field[name=sport]').setDisabled(false); me.down('field[name=sport]').setDisabled(false);
me.down('field[name=dport]').setDisabled(false); me.down('field[name=dport]').setDisabled(false);