On 6/11/25 14:59, Lukas Wagner wrote:
> The 'auto' mode does not really add any functionality but only adds
> confusion about what it actually does, so we completely remove it from
> the UI. It is still supported by the backend, but in the UI we map it to
> a concrete mode (either notification-system or legacy-sendmail,
> depending on whether mailto is set).
> 
> We also stop using the term 'notification system' in the UI, instead it
> is called "Global Notification Settings".
> 
> Signed-off-by: Lukas Wagner <l.wag...@proxmox.com>
> ---
>  www/manager6/window/Backup.js | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
> index 70b51409..d80a6e85 100644
> --- a/www/manager6/window/Backup.js
> +++ b/www/manager6/window/Backup.js
> @@ -33,22 +33,22 @@ Ext.define('PVE.window.Backup', {
>       let mailtoField = Ext.create('Ext.form.field.Text', {
>           fieldLabel: gettext('Send email to'),
>           name: 'mailto',
> +         hidden: true,
>           emptyText: Proxmox.Utils.noneText,
>       });
>  
>       let notificationModeSelector = Ext.create({
>           xtype: 'proxmoxKVComboBox',
>           comboItems: [
> -             ['auto', gettext('Auto')],
> -             ['legacy-sendmail', gettext('Email (legacy)')],
> -             ['notification-system', gettext('Notification system')],
> +             ['notification-system', gettext('Use global settings')],
> +             ['legacy-sendmail', gettext('Use sendmail')],
>           ],
> -         fieldLabel: gettext('Notification mode'),
> +         fieldLabel: gettext('Notification'),
>           name: 'notification-mode',
> -         value: 'auto',
> +         value: 'notification-system',
>           listeners: {
>               change: function(field, value) {
> -                 mailtoField.setDisabled(value === 'notification-system');
> +                 mailtoField.setHidden(value === 'notification-system');

While this does work, I think I'd prefer it if the field is always
visible and is enabled or disabled depending on the selection of the
notification system. With the hidden field, UI shifts a tiny bit once it
becomes visible (Firefox 139.0.1). Since the Backup window is not super
cluttered, I think this additional field could always be visible, but
that's just my two cents.

>               },
>           },
>       });
> @@ -170,11 +170,21 @@ Ext.define('PVE.window.Backup', {
>                       success: function(response, opts) {
>                           const data = response.result.data;
>  
> -                         if (!initialDefaults && data.mailto !== undefined) {
> -                             mailtoField.setValue(data.mailto);
> -                         }
> -                         if (!initialDefaults && data['notification-mode'] 
> !== undefined) {
> -                             
> notificationModeSelector.setValue(data['notification-mode']);
> +                         if (!initialDefaults) {
> +                             let notificationMode = 
> data['notification-mode'] ?? 'auto';
> +                             let mailto = data.mailto;
> +
> +                             if (notificationMode === 'auto' && mailto !== 
> undefined) {
> +                                 notificationMode = 'legacy-sendmail';
> +                             }
> +                             if (notificationMode === 'auto' && mailto === 
> undefined) {
> +                                 notificationMode = 'notification-system';
> +                             }
> +
> +                             
> notificationModeSelector.setValue(notificationMode);
> +                             if (mailto !== undefined) {
> +                                 mailtoField.setValue(mailto);
> +                             }
>                           }
>                           if (!initialDefaults && data.mode !== undefined) {
>                               modeSelector.setValue(data.mode);



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to