ui: backup job detail view: merge mail notification when/to fields

While it surely is nice to follow the layout of the job creation/edit
panel for sharing familiarity, it does not means that we need to show
the data 1:1, we can profit from the read-only fact and merge stuff a
bit, like the mail to/when field.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-09-08 16:09:40 +02:00
parent 3f85cce836
commit 18af64dc99

View File

@ -636,26 +636,17 @@ Ext.define('PVE.dc.BackupInfo', {
}, },
], ],
column2: [ column2: [
{
xtype: 'displayfield',
name: 'mailto',
fieldLabel: gettext('Send email to'),
},
{ {
xtype: 'displayfield', xtype: 'displayfield',
name: 'mailnotification', name: 'mailnotification',
fieldLabel: gettext('Email notification'), fieldLabel: gettext('Email notification'),
renderer: function(value) { renderer: function(value) {
let msg; let mailto = this.up('pveBackupInfo')?.record?.mailto || 'root@localhost';
switch (value) { let when = gettext('Always');
case 'always': if (value === 'failure') {
msg = gettext('Always'); when = gettext('On failure only');
break;
case 'failure':
msg = gettext('On failure only');
break;
} }
return msg; return `${when} (${mailto})`;
}, },
}, },
{ {