[pve-devel] [PATCH manager 1/2] ui: dc: backup: improve UX for the different 'notification-mode's
Lukas Wagner
l.wagner at proxmox.com
Thu Nov 23 17:09:01 CET 2023
- 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 at proxmox.com>
---
www/manager6/dc/Backup.js | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 70903bdc..780315db 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -207,13 +207,26 @@ Ext.define('PVE.dc.BackupEdit', {
data: {
selMode: 'include',
notificationMode: '__default__',
+ mailto: '',
+ mailNotification: '',
},
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 +338,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 +356,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
More information about the pve-devel
mailing list