Signed-off-by: Lukas Wagner <l.wag...@proxmox.com>
---
 www/manager6/dc/BackupJobDetail.js | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/www/manager6/dc/BackupJobDetail.js 
b/www/manager6/dc/BackupJobDetail.js
index c4683a47..f4a0d981 100644
--- a/www/manager6/dc/BackupJobDetail.js
+++ b/www/manager6/dc/BackupJobDetail.js
@@ -202,15 +202,31 @@ Ext.define('PVE.dc.BackupInfo', {
     column2: [
        {
            xtype: 'displayfield',
-           name: 'mailnotification',
+           name: 'notification-policy',
            fieldLabel: gettext('Notification'),
            renderer: function(value) {
-               let mailto = this.up('pveBackupInfo')?.record?.mailto || 
'root@localhost';
+               // Fall back to old value, in case this option is not migrated 
yet.
+               let policy = value || 
this.up('pveBackupInfo')?.record?.mailnotification || 'always';
+
                let when = gettext('Always');
-               if (value === 'failure') {
+               if (policy === 'failure') {
                    when = gettext('On failure only');
+               } else if (policy === 'never') {
+                   when = gettext('Never');
+               }
+
+               let mode = 
this.up('pveBackupInfo')?.record?.['notification-mode'] || 'mail';
+
+               let target = "";
+
+               if (mode === 'mail') {
+                   target = this.up('pveBackupInfo')?.record?.mailto ||
+                       gettext('No mail recipient configured');
+               } else {
+                   target = 
this.up('pveBackupInfo')?.record?.['notification-channel'] ||
+                       gettext('No channel configured');
                }
-               return `${when} (${mailto})`;
+               return `${when} (${target})`;
            },
        },
        {
-- 
2.30.2



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

Reply via email to