The formula used for deriving the emptyText for the password field did not correctly pick up the 'isCreate' flag, so 'Unchanged' was also visible when creating a new SMTP target that has no password yet.
Also took the opportunity to improve the behavior when modifying an existing target. Now the original state of the 'authentication' flag is saved. The 'Unchanged' emptyText is only shown if the loaded config contains authentication parameters. When editing a target *without* authentication, the password field does not have the 'Unchanged' emptyText any more. Signed-off-by: Lukas Wagner <l.wag...@proxmox.com> --- src/panel/SmtpEditPanel.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/panel/SmtpEditPanel.js b/src/panel/SmtpEditPanel.js index fd10b54..a7cfaff 100644 --- a/src/panel/SmtpEditPanel.js +++ b/src/panel/SmtpEditPanel.js @@ -8,12 +8,10 @@ Ext.define('Proxmox.panel.SmtpEditPanel', { viewModel: { xtype: 'viewmodel', - cbind: { - isCreate: '{isCreate}', - }, data: { mode: 'tls', authentication: true, + originalAuthentication: true, }, formulas: { portEmptyText: function (get) { @@ -33,8 +31,13 @@ Ext.define('Proxmox.panel.SmtpEditPanel', { return `${Proxmox.Utils.defaultText} (${port})`; }, passwordEmptyText: function (get) { - let isCreate = this.isCreate; - return get('authentication') && !isCreate ? gettext('Unchanged') : ''; + let isCreate = this.getView().isCreate; + + let auth = get('authentication'); + let origAuth = get('originalAuthentication'); + let shouldShowUnchanged = !isCreate && auth && origAuth; + + return shouldShowUnchanged ? gettext('Unchanged') : ''; }, }, }, @@ -123,7 +126,9 @@ Ext.define('Proxmox.panel.SmtpEditPanel', { inputType: 'password', fieldLabel: gettext('Password'), name: 'password', - allowBlank: true, + cbind: { + allowBlank: '{!isCreate}', + }, bind: { disabled: '{!authentication}', emptyText: '{passwordEmptyText}', @@ -206,6 +211,7 @@ Ext.define('Proxmox.panel.SmtpEditPanel', { // 'Authenticate' remains ticked (the default value) if loading an // SMTP target without authentication. me.getViewModel().set('authentication', values.authentication); + me.getViewModel().set('originalAuthentication', values.authentication); return values; }, -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel