]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: backup: adapt backup job details to new notification params
authorLukas Wagner <l.wagner@proxmox.com>
Thu, 3 Aug 2023 12:17:05 +0000 (14:17 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 16 Aug 2023 09:11:13 +0000 (11:11 +0200)
Adapt the backup job detail view so that it shows notification
targets.

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

index 880784a2321fbb650662f50717a49e42ab3b8917..e154fec14d5e6d97def5e824ea3c090f19faffe6 100644 (file)
@@ -202,15 +202,27 @@ 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';
+               let record = this.up('pveBackupInfo')?.record;
+
+               // Fall back to old value, in case this option is not migrated yet.
+               let policy = value || 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');
                }
-               return `${when} (${mailto})`;
+
+               // Notification-target takes precedence
+               let target = record?.['notification-target'] ||
+                   record?.mailto ||
+                   gettext('No target configured');
+
+               return `${when} (${target})`;
            },
        },
        {