]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: backup jobs: add 'notification-mode' selector for backup jobs
authorLukas Wagner <l.wagner@proxmox.com>
Tue, 21 Nov 2023 12:52:38 +0000 (13:52 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 21 Nov 2023 13:41:15 +0000 (14:41 +0100)
This selector allows one to selected between the 'old' (send email
directly via sendmail) or the 'new' notification system.

The default is 'auto', which sends and email if one is configured,
and uses the notification system if no email address is set.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
www/manager6/dc/Backup.js

index 9aae4090a87595d2c240fc547d3514fcc780732d..1258772bd56eea24449dc2d92e844ff1da1c1e5b 100644 (file)
@@ -206,12 +206,14 @@ Ext.define('PVE.dc.BackupEdit', {
     viewModel: {
        data: {
            selMode: 'include',
+           notificationMode: '__default__',
        },
 
        formulas: {
            poolMode: (get) => get('selMode') === 'pool',
            disableVMSelection: (get) => get('selMode') !== 'include' && get('selMode') !== 'exclude',
-           mailNotificationSelected: (get) => get('notificationMode') === 'mailto',
+           showMailtoFields: (get) =>
+               ['auto', 'legacy-sendmail', '__default__'].includes(get('notificationMode')),
        },
     },
 
@@ -301,6 +303,28 @@ Ext.define('PVE.dc.BackupEdit', {
                                },
                            ],
                            column2: [
+                               {
+                                   xtype: 'proxmoxKVComboBox',
+                                   comboItems: [
+                                       [
+                                           '__default__',
+                                           Ext.String.format(
+                                               gettext('{0} (Auto)'), Proxmox.Utils.defaultText,
+                                           ),
+                                       ],
+                                       ['auto', gettext('Auto')],
+                                       ['legacy-sendmail', gettext('Email (legacy)')],
+                                       ['notification-system', gettext('Notification system')],
+                                   ],
+                                   fieldLabel: gettext('Notification mode'),
+                                   name: 'notification-mode',
+                                   cbind: {
+                                       deleteEmpty: '{!isCreate}',
+                                   },
+                                   bind: {
+                                       value: '{notificationMode}',
+                                   },
+                               },
                                {
                                    xtype: 'pveEmailNotificationSelector',
                                    fieldLabel: gettext('Notify'),
@@ -309,11 +333,17 @@ Ext.define('PVE.dc.BackupEdit', {
                                        value: (get) => get('isCreate') ? 'always' : '',
                                        deleteEmpty: '{!isCreate}',
                                    },
+                                   bind: {
+                                       disabled: '{!showMailtoFields}',
+                                   },
                                },
                                {
                                    xtype: 'textfield',
                                    fieldLabel: gettext('Send email to'),
                                    name: 'mailto',
+                                   bind: {
+                                       disabled: '{!showMailtoFields}',
+                                   },
                                },
                                {
                                    xtype: 'pveBackupCompressionSelector',