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 B354C1FF56B for ; Mon, 22 Apr 2024 14:39:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 34B3711903; Mon, 22 Apr 2024 14:39:54 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com Date: Mon, 22 Apr 2024 14:38:29 +0200 Message-Id: <20240422123841.280675-32-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240422123841.280675-1-l.wagner@proxmox.com> References: <20240422123841.280675-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.001 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 v4 31/43] 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 --- www/datastore/OptionView.js | 15 +++++++++++++++ www/window/NotifyOptions.js | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 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..95323486 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: 'notification-system', + }, + formulas: { + notificationSystemSelected: (get) => get('notificationMode') === 'notification-system', + }, + }, + items: { xtype: 'inputpanel', onGetValues: function(values) { @@ -60,6 +69,18 @@ Ext.define('PBS.window.NotifyOptions', { return values; }, items: [ + { + xtype: 'proxmoxKVComboBox', + comboItems: [ + ['legacy-sendmail', gettext('Email (legacy)')], + ['notification-system', gettext('Notification system')], + ], + fieldLabel: gettext('Notification mode'), + name: 'notification-mode', + bind: { + value: '{notificationMode}', + }, + }, { xtype: 'pmxUserSelector', name: 'notify-user', @@ -69,6 +90,9 @@ Ext.define('PBS.window.NotifyOptions', { allowBlank: true, renderer: Ext.String.htmlEncode, deleteEmpty: true, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyType', @@ -76,6 +100,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Verification Jobs'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyType', @@ -83,6 +110,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Sync Jobs'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyErrorDefaultType', @@ -90,6 +120,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Prune Jobs'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, { xtype: 'pbsNotifyType', @@ -97,6 +130,9 @@ Ext.define('PBS.window.NotifyOptions', { fieldLabel: gettext('Garbage Collection'), value: '__default__', deleteEmpty: false, + bind: { + disabled: "{notificationSystemSelected}", + }, }, ], }, @@ -107,6 +143,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'] : 'legacy-sendmail', }; let notify = {}; -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel