ui: backup: add 'notification-mode' param for one-shot backup jobs.

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>
This commit is contained in:
Lukas Wagner 2023-11-21 13:52:39 +01:00 committed by Thomas Lamprecht
parent 66b2086269
commit c202b169f5

View File

@ -36,6 +36,23 @@ Ext.define('PVE.window.Backup', {
emptyText: Proxmox.Utils.noneText,
});
let notificationModeSelector = Ext.create({
xtype: 'proxmoxKVComboBox',
comboItems: [
['auto', gettext('Auto')],
['legacy-sendmail', gettext('Email (legacy)')],
['notification-system', gettext('Notification system')],
],
fieldLabel: gettext('Notification mode'),
name: 'notification-mode',
value: 'auto',
listeners: {
change: function(field, value) {
mailtoField.setDisabled(value === 'notification-system');
},
},
});
const keepNames = [
['keep-last', gettext('Keep Last')],
['keep-hourly', gettext('Keep Hourly')],
@ -110,6 +127,9 @@ Ext.define('PVE.window.Backup', {
if (!initialDefaults && data.mailto !== undefined) {
mailtoField.setValue(data.mailto);
}
if (!initialDefaults && data['notification-mode'] !== undefined) {
notificationModeSelector.setValue(data['notification-mode']);
}
if (!initialDefaults && data.mode !== undefined) {
modeSelector.setValue(data.mode);
}
@ -176,6 +196,7 @@ Ext.define('PVE.window.Backup', {
],
column2: [
compressionSelector,
notificationModeSelector,
mailtoField,
removeCheckbox,
],
@ -256,6 +277,10 @@ Ext.define('PVE.window.Backup', {
params.mailto = values.mailto;
}
if (values['notification-mode']) {
params['notification-mode'] = values['notification-mode'];
}
if (values.compress) {
params.compress = values.compress;
}