From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2 2/2] ui: one-off backup: show hint if notification-system is used
Date: Mon, 15 Apr 2024 11:51:02 +0200 [thread overview]
Message-ID: <20240415095102.2566187-2-l.wagner@proxmox.com> (raw)
In-Reply-To: <20240415095102.2566187-1-l.wagner@proxmox.com>
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>
---
www/manager6/window/Backup.js | 37 +++++++++++++++++++++++++++++++----
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index 4418a9c7..ce679971 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -30,10 +30,27 @@ Ext.define('PVE.window.Backup', {
name: 'mode',
});
+ let viewModel = new Ext.app.ViewModel({
+ formulas: {
+ showMailtoField: (get) =>
+ ['auto', 'legacy-sendmail'].includes(get('notificationMode')),
+ hintTextVisible: (get) => get('notificationMode') === 'auto' && !get('mailto'),
+ },
+ data: {
+ mailto: '',
+ notificationMode: 'auto',
+ },
+ });
+
let mailtoField = Ext.create('Ext.form.field.Text', {
fieldLabel: gettext('Send email to'),
name: 'mailto',
emptyText: Proxmox.Utils.noneText,
+ viewModel,
+ bind: {
+ value: '{mailto}',
+ hidden: '{!showMailtoField}',
+ },
});
let notificationModeSelector = Ext.create({
@@ -46,10 +63,21 @@ Ext.define('PVE.window.Backup', {
fieldLabel: gettext('Notification mode'),
name: 'notification-mode',
value: 'auto',
- listeners: {
- change: function(field, value) {
- mailtoField.setDisabled(value === 'notification-system');
- },
+ viewModel,
+ bind: {
+ value: '{notificationMode}',
+ },
+ });
+
+ let notificationSystemHint = Ext.create({
+ xtype: 'displayfield',
+ padding: '0 0 0 5',
+ userCls: 'pmx-hint',
+ hidden: true,
+ value: gettext('No email configured, the notification system will be used'),
+ viewModel,
+ bind: {
+ hidden: '{!hintTextVisible}',
},
});
@@ -198,6 +226,7 @@ Ext.define('PVE.window.Backup', {
compressionSelector,
notificationModeSelector,
mailtoField,
+ notificationSystemHint,
removeCheckbox,
],
columnB: [
--
2.39.2
next prev parent reply other threads:[~2024-04-15 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Lukas Wagner [this message]
2024-04-21 11:50 ` [pve-devel] partially-applied: " Thomas Lamprecht
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=20240415095102.2566187-2-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