From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 6927320EC7F for ; Tue, 23 Apr 2024 13:53:48 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1E06B30AC6; Tue, 23 Apr 2024 13:53:43 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com Date: Tue, 23 Apr 2024 13:52:17 +0200 Message-Id: <20240423115230.170113-32-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240423115230.170113-1-l.wagner@proxmox.com> References: <20240423115230.170113-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup v5 31/44] ui: datastore options: add 'notification-mode' parameter X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Lukas Wagner Tested-by: Gabriel Goller Reviewed-by: Gabriel Goller Tested-by: Maximiliano Sandoval --- www/datastore/OptionView.js | 15 +++++++++++++ www/window/NotifyOptions.js | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js index 6f1be969..e1f38af6 100644 --- a/www/datastore/OptionView.js +++ b/www/datastore/OptionView.js @@ -159,6 +159,21 @@ Ext.define('PBS.Datastore.Options', { }, rows: { + "notification-mode": { + required: true, + defaultValue: 'legacy-sendmail', + header: gettext('Notification mode'), + renderer: function(value) { + if (value === 'notification-system') { + return gettext('Notification system'); + } else { + return gettext('Email (legacy)'); + } + }, + editor: { + xtype: 'pbsNotifyOptionEdit', + }, + }, "notify": { required: true, header: gettext('Notify'), diff --git a/www/window/NotifyOptions.js b/www/window/NotifyOptions.js index 11765b43..57e8ba44 100644 --- a/www/window/NotifyOptions.js +++ b/www/window/NotifyOptions.js @@ -44,6 +44,15 @@ Ext.define('PBS.window.NotifyOptions', { labelWidth: 120, }, + viewModel: { + data: { + notificationMode: '__default__', + }, + formulas: { + notificationSystemSelected: (get) => get('notificationMode') === 'notification-system', + }, + }, + items: { xtype: 'inputpanel', onGetValues: function(values) { @@ -54,12 +63,30 @@ Ext.define('PBS.window.NotifyOptions', { } values.notify = PBS.Utils.printPropertyString(notify); + if (values.delete && !Ext.isArray(values.delete)) { + values.delete = values.delete.split(','); + } + PBS.Utils.delete_if_default(values, 'notify', ''); PBS.Utils.delete_if_default(values, 'notify-user', ''); return values; }, items: [ + { + xtype: 'proxmoxKVComboBox', + comboItems: [ + ['__default__', `${Proxmox.Utils.defaultText} (Email)`], + ['legacy-sendmail', gettext('Email (legacy)')], + ['notification-system', gettext('Notification system')], + ], + deleteEmpty: true, + fieldLabel: gettext('Notification mode'), + name: 'notification-mode', + bind: { + value: '{notificationMode}', + }, + }, { xtype: 'pmxUserSelector', name: 'notify-user', @@ -69,6 +96,9 @@ Ext.define('PBS.window.NotifyOptions', { allowBlank: true, renderer: Ext.String.htmlEncode, deleteEmpty: true, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyType', @@ -76,6 +106,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Verification Jobs'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyType', @@ -83,6 +116,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Sync Jobs'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyErrorDefaultType', @@ -90,6 +126,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Prune Jobs'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyType', @@ -97,6 +136,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Garbage Collection'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, ], }, @@ -107,6 +149,8 @@ Ext.define('PBS.window.NotifyOptions', { let options = { 'notify-user': values['notify-user'], 'verify-new': values['verify-new'], + 'notification-mode': values['notification-mode'] + ? values['notification-mode'] : '__default__', }; let notify = {}; -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel