[pbs-devel] [PATCH widget-toolkit v5 06/44] sendmail: smtp: allow to overide default mail author

Lukas Wagner l.wagner at proxmox.com
Tue Apr 23 13:51:52 CEST 2024


In PBS, we obviously don't have "Proxmox VE" as a default sender, so
we need a mechanism to change the default author.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 src/Schema.js                  | 9 +++++++++
 src/panel/SendmailEditPanel.js | 2 +-
 src/panel/SmtpEditPanel.js     | 2 +-
 src/window/EndpointEditBase.js | 1 +
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/Schema.js b/src/Schema.js
index 7833fc0..42541e0 100644
--- a/src/Schema.js
+++ b/src/Schema.js
@@ -52,11 +52,13 @@ Ext.define('Proxmox.Schema', { // a singleton
 	    name: 'Sendmail',
 	    ipanel: 'pmxSendmailEditPanel',
 	    iconCls: 'fa-envelope-o',
+	    defaultMailAuthor: 'Proxmox VE',
 	},
 	smtp: {
 	    name: 'SMTP',
 	    ipanel: 'pmxSmtpEditPanel',
 	    iconCls: 'fa-envelope-o',
+	    defaultMailAuthor: 'Proxmox VE',
 	},
 	gotify: {
 	    name: 'Gotify',
@@ -65,6 +67,13 @@ Ext.define('Proxmox.Schema', { // a singleton
 	},
     },
 
+    // to add or change existing for product specific ones
+    overrideEndpointTypes: function(extra) {
+	for (const [key, value] of Object.entries(extra)) {
+	    Proxmox.Schema.notificationEndpointTypes[key] = value;
+	}
+    },
+
     pxarFileTypes: {
 	b: { icon: 'cube', label: gettext('Block Device') },
 	c: { icon: 'tty', label: gettext('Character Device') },
diff --git a/src/panel/SendmailEditPanel.js b/src/panel/SendmailEditPanel.js
index 5a154c1..ccdfe98 100644
--- a/src/panel/SendmailEditPanel.js
+++ b/src/panel/SendmailEditPanel.js
@@ -58,8 +58,8 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
 	    fieldLabel: gettext('Author'),
 	    name: 'author',
 	    allowBlank: true,
-	    emptyText: 'Proxmox VE',
 	    cbind: {
+		emptyText: '{defaultMailAuthor}',
 		deleteEmpty: '{!isCreate}',
 	    },
 	},
diff --git a/src/panel/SmtpEditPanel.js b/src/panel/SmtpEditPanel.js
index 8b258e0..edb6344 100644
--- a/src/panel/SmtpEditPanel.js
+++ b/src/panel/SmtpEditPanel.js
@@ -161,8 +161,8 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
 	    fieldLabel: gettext('Author'),
 	    name: 'author',
 	    allowBlank: true,
-	    emptyText: gettext('Proxmox VE'),
 	    cbind: {
+		emptyText: '{defaultMailAuthor}',
 		deleteEmpty: '{!isCreate}',
 	    },
 	},
diff --git a/src/window/EndpointEditBase.js b/src/window/EndpointEditBase.js
index f42d0ea..993fa16 100644
--- a/src/window/EndpointEditBase.js
+++ b/src/window/EndpointEditBase.js
@@ -45,6 +45,7 @@ Ext.define('Proxmox.window.EndpointEditBase', {
 		isCreate: me.isCreate,
 		baseUrl: me.baseUrl,
 		type: me.type,
+		defaultMailAuthor: endpointConfig.defaultMailAuthor,
 	    }],
 	});
 
-- 
2.39.2




More information about the pbs-devel mailing list