public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v3 pve-manager 3/5] ui: backup jobs: add 'notification-mode' selector for backup jobs
Date: Tue, 21 Nov 2023 13:23:26 +0100	[thread overview]
Message-ID: <20231121122328.134930-4-l.wagner@proxmox.com> (raw)
In-Reply-To: <20231121122328.134930-1-l.wagner@proxmox.com>

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>
---
 www/manager6/dc/Backup.js | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 9aae4090..8f7bab5a 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -206,12 +206,15 @@ Ext.define('PVE.dc.BackupEdit', {
     viewModel: {
 	data: {
 	    selMode: 'include',
+	    notificationMode: '__default__',
 	},
 
 	formulas: {
 	    poolMode: (get) => get('selMode') === 'pool',
 	    disableVMSelection: (get) => get('selMode') !== 'include' && get('selMode') !== 'exclude',
-	    mailNotificationSelected: (get) => get('notificationMode') === 'mailto',
+	    showMailtoFields: (get) => {
+		return ['auto', 'legacy-sendmail', '__default__'].includes(get('notificationMode'));
+	    },
 	},
     },
 
@@ -301,6 +304,28 @@ Ext.define('PVE.dc.BackupEdit', {
 				},
 			    ],
 			    column2: [
+				{
+				    xtype: 'proxmoxKVComboBox',
+				    comboItems: [
+					[
+					    '__default__',
+					    Ext.String.format(
+						gettext('{0} (Auto)'), Proxmox.Utils.defaultText
+					    )
+					],
+					['auto', gettext('Auto')],
+					['legacy-sendmail', gettext('Email (legacy)')],
+					['notification-system', gettext('Notification system')],
+				    ],
+				    fieldLabel: gettext('Notification mode'),
+				    name: 'notification-mode',
+				    cbind: {
+					deleteEmpty: '{!isCreate}',
+				    },
+				    bind: {
+					value: '{notificationMode}',
+				    },
+				},
 				{
 				    xtype: 'pveEmailNotificationSelector',
 				    fieldLabel: gettext('Notify'),
@@ -309,11 +334,17 @@ Ext.define('PVE.dc.BackupEdit', {
 					value: (get) => get('isCreate') ? 'always' : '',
 					deleteEmpty: '{!isCreate}',
 				    },
+				    bind: {
+					disabled: '{!showMailtoFields}',
+				    }
 				},
 				{
 				    xtype: 'textfield',
 				    fieldLabel: gettext('Send email to'),
 				    name: 'mailto',
+				    bind: {
+					disabled: '{!showMailtoFields}',
+				    }
 				},
 				{
 				    xtype: 'pveBackupCompressionSelector',
-- 
2.39.2





  parent reply	other threads:[~2023-11-21 12:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 12:23 [pve-devel] [PATCH v3 guest-common/manager 0/5] vzdump: add 'notification-mode' parameter Lukas Wagner
2023-11-21 12:23 ` [pve-devel] [PATCH v3 pve-guest-common 1/5] vzdump: config: add 'notification-mode' param for backup jobs Lukas Wagner
2023-11-21 12:23 ` [pve-devel] [PATCH v3 pve-manager 2/5] vzdump: support 'notification-mode' parameter Lukas Wagner
2023-11-21 12:23 ` Lukas Wagner [this message]
2023-11-21 12:51   ` [pve-devel] [PATCH v3 pve-manager 3/5] ui: backup jobs: add 'notification-mode' selector for backup jobs Philipp Hufnagl
2023-11-21 12:23 ` [pve-devel] [PATCH v3 pve-manager 4/5] ui: backup: add 'notification-mode' param for one-shot " Lukas Wagner
     [not found]   ` <6e27a91f-2a4b-4072-87ee-f097dd175a9e@proxmox.com>
2023-11-21 12:42     ` Lukas Wagner
2023-11-21 12:23 ` [pve-devel] [PATCH v3 pve-manager 5/5] ui: backup job: change field text for 'mailnotification' field Lukas Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231121122328.134930-4-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal