all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2 1/2] ui: dc: backup: improve UX for the different 'notification-mode's
@ 2024-04-15  9:51 Lukas Wagner
  2024-04-15  9:51 ` [pve-devel] [PATCH manager v2 2/2] ui: one-off backup: show hint if notification-system is used Lukas Wagner
  2024-04-21 11:50 ` [pve-devel] partially-applied: [PATCH manager v2 1/2] ui: dc: backup: improve UX for the different 'notification-mode's Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Wagner @ 2024-04-15  9:51 UTC (permalink / raw)
  To: pve-devel

  - Switch order of 'mailto' and 'mailnotification' field
  - When mode is 'auto', disable 'mailtnotification' field
  - When mode is 'auto' and 'mailto' is empty, show
    hint that the notification system will be used

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

Notes:
    Changes since v1:
      - Set 'mailNotification' in viewModel to 'always'
        to  avoid the combobox being empty initially

 www/manager6/dc/Backup.js | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 70903bdc..70b5604e 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -207,13 +207,25 @@ Ext.define('PVE.dc.BackupEdit', {
 	data: {
 	    selMode: 'include',
 	    notificationMode: '__default__',
+	    mailto: '',
+	    mailNotification: 'always',
 	},
 
 	formulas: {
 	    poolMode: (get) => get('selMode') === 'pool',
-	    disableVMSelection: (get) => get('selMode') !== 'include' && get('selMode') !== 'exclude',
+	    disableVMSelection: (get) => get('selMode') !== 'include' &&
+		get('selMode') !== 'exclude',
 	    showMailtoFields: (get) =>
 		['auto', 'legacy-sendmail', '__default__'].includes(get('notificationMode')),
+	    enableMailnotificationField: (get) => {
+		let mode = get('notificationMode');
+		let mailto = get('mailto');
+
+		return (['auto', '__default__'].includes(mode) && mailto) ||
+		    mode === 'legacy-sendmail';
+	    },
+	    hintTextVisible: (get) =>
+		['auto', '__default__'].includes(get('notificationMode')) && !get('mailto'),
 	},
     },
 
@@ -325,6 +337,15 @@ Ext.define('PVE.dc.BackupEdit', {
 					value: '{notificationMode}',
 				    },
 				},
+				{
+				    xtype: 'textfield',
+				    fieldLabel: gettext('Send email to'),
+				    name: 'mailto',
+				    bind: {
+					hidden: '{!showMailtoFields}',
+					value: '{mailto}',
+				    },
+				},
 				{
 				    xtype: 'pveEmailNotificationSelector',
 				    fieldLabel: gettext('Send email'),
@@ -334,15 +355,18 @@ Ext.define('PVE.dc.BackupEdit', {
 					deleteEmpty: '{!isCreate}',
 				    },
 				    bind: {
-					disabled: '{!showMailtoFields}',
+					hidden: '{!showMailtoFields}',
+					disabled: '{!enableMailnotificationField}',
+					value: '{mailNotification}',
 				    },
 				},
 				{
-				    xtype: 'textfield',
-				    fieldLabel: gettext('Send email to'),
-				    name: 'mailto',
+				    xtype: 'displayfield',
+				    userCls: 'pmx-hint',
+				    hidden: true,
+				    value: gettext('No email configured, the notification system will be used'),
 				    bind: {
-					disabled: '{!showMailtoFields}',
+					hidden: '{!hintTextVisible}',
 				    },
 				},
 				{
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-21 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15  9:51 [pve-devel] [PATCH manager v2 1/2] ui: dc: backup: improve UX for the different 'notification-mode's Lukas Wagner
2024-04-15  9:51 ` [pve-devel] [PATCH manager v2 2/2] ui: one-off backup: show hint if notification-system is used Lukas Wagner
2024-04-21 11:50 ` [pve-devel] partially-applied: [PATCH manager v2 1/2] ui: dc: backup: improve UX for the different 'notification-mode's Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal