Signed-off-by: Lukas Wagner <l.wag...@proxmox.com> --- www/manager6/window/Backup.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js index 4b21c746..8c8cd7d8 100644 --- a/www/manager6/window/Backup.js +++ b/www/manager6/window/Backup.js @@ -30,12 +30,33 @@ Ext.define('PVE.window.Backup', { name: 'mode', }); + let notificationChannelSelector = Ext.create('PVE.form.NotificationChannelSelector', { + fieldLabel: gettext('Notification channel'), + name: 'notification-channel', + emptyText: Proxmox.Utils.noneText, + hidden: true, + }); + let mailtoField = Ext.create('Ext.form.field.Text', { fieldLabel: gettext('Send email to'), name: 'mailto', emptyText: Proxmox.Utils.noneText, }); + let notificationModeSelector = Ext.create('PVE.form.NotificationModeSelector', { + fieldLabel: gettext('Notify via'), + value: 'mail', + name: 'notification-mode', + listeners: { + change: function(f, v) { + let mailSelected = v === 'mail'; + notificationChannelSelector.setHidden(mailSelected); + mailtoField.setHidden(!mailSelected); + } + } + + }); + const keepNames = [ ['keep-last', gettext('Keep Last')], ['keep-hourly', gettext('Keep Hourly')], @@ -107,6 +128,12 @@ Ext.define('PVE.window.Backup', { success: function(response, opts) { const data = response.result.data; + if (!initialDefaults && data['notification-mode'] !== undefined) { + notificationModeSelector.setValue(data['notification-mode']); + } + if (!initialDefaults && data['notification-channel'] !== undefined) { + notificationChannelSelector.setValue(data['notification-channel']); + } if (!initialDefaults && data.mailto !== undefined) { mailtoField.setValue(data.mailto); } @@ -176,6 +203,8 @@ Ext.define('PVE.window.Backup', { ], column2: [ compressionSelector, + notificationModeSelector, + notificationChannelSelector, mailtoField, removeCheckbox, ], @@ -252,10 +281,14 @@ Ext.define('PVE.window.Backup', { remove: values.remove, }; - if (values.mailto) { + if (values.mailto && values['notification-mode'] === 'mail') { params.mailto = values.mailto; } + if (values['notification-channel'] && values['notification-mode'] === 'channel') { + params['notification-channel'] = values['notification-channel']; + } + if (values.compress) { params.compress = values.compress; } -- 2.30.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel