The 'auto' mode does not really add any functionality but only adds
confusion about what it actually does, so it is completely removed from
the UI. It is still supported by the backend, but in the UI it is mapped
it to a concrete mode (either notification-system or legacy-sendmail,
depending on whether mailto is set).

The term 'Notification System' is completely dropped from the UI,
instead 'Global Notification Settings' is used.

Signed-off-by: Lukas Wagner <l.wag...@proxmox.com>
Tested-by: Michael Köppl <m.koe...@proxmox.com>
Reviewed-by: Michael Köppl <m.koe...@proxmox.com>
---

Notes:
    Changeslog:
    
    v2:
      - Some rephrasing in the commit message
      - Fixed typo in 'Recipients'

 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..4377cb5f 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 (legacy)')],
            ],
-           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');
                },
            },
        });
@@ -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);
-- 
2.39.5



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

Reply via email to