* [PATCH widget-toolkit] fix #7586: notification: check names of matchers and targets in the UI
@ 2026-10-06 9:54 Michal Fox
0 siblings, 0 replies; only message in thread
From: Michal Fox @ 2026-10-06 9:54 UTC (permalink / raw)
To: pve-devel
The names of notification matchers and targets have to be safe IDs,
but only the name of webhook targets was checked in the UI, and that
without saying what is wrong. For all others, an invalid name, for
example one containing a space, was only rejected by the API with a
'parameter verification errors (400)' message, without saying which
characters are allowed.
Add a 'SafeId' vtype, which uses the existing safe ID regex and says
which characters are allowed, and use it for the names of matchers and
all target types.
Signed-off-by: Michal Fox <me@dualfroz.com>
---
Tested in the browser with the matcher and all target edit windows:
names with a space or a slash now show which characters are allowed,
valid names are still accepted.
Proxmox VE uses the stricter 'pve-configid' format for these names in
its API, so there, names starting with a digit or containing a dot are
still only rejected by the API.
src/Toolkit.js | 9 +++++++++
src/panel/GotifyEditPanel.js | 1 +
src/panel/SendmailEditPanel.js | 1 +
src/panel/SmtpEditPanel.js | 1 +
src/panel/WebhookEditPanel.js | 2 +-
src/window/NotificationMatcherEdit.js | 1 +
6 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/Toolkit.js b/src/Toolkit.js
index bd31b3c..c1594b7 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -134,6 +134,15 @@ Ext.apply(Ext.form.field.VTypes, {
': ' +
gettext('letter'),
+ SafeId: function (v) {
+ return Proxmox.Utils.safeIdRegex.test(v);
+ },
+ SafeIdText:
+ gettext('Allowed characters') +
+ ": 'A-Z', 'a-z', '0-9', '_', '-', '.'<br />" +
+ gettext('Must start with') +
+ ": 'A-Z', 'a-z', '0-9', '_'",
+
HttpProxy: function (v) {
return /^http:\/\/.*$/.test(v);
},
diff --git a/src/panel/GotifyEditPanel.js b/src/panel/GotifyEditPanel.js
index 5e78e73..3e12323 100644
--- a/src/panel/GotifyEditPanel.js
+++ b/src/panel/GotifyEditPanel.js
@@ -15,6 +15,7 @@ Ext.define('Proxmox.panel.GotifyEditPanel', {
editable: '{isCreate}',
},
fieldLabel: gettext('Endpoint Name'),
+ vtype: 'SafeId',
allowBlank: false,
},
{
diff --git a/src/panel/SendmailEditPanel.js b/src/panel/SendmailEditPanel.js
index a4de50c..81624ad 100644
--- a/src/panel/SendmailEditPanel.js
+++ b/src/panel/SendmailEditPanel.js
@@ -26,6 +26,7 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
editable: '{isCreate}',
},
fieldLabel: gettext('Endpoint Name'),
+ vtype: 'SafeId',
allowBlank: false,
},
{
diff --git a/src/panel/SmtpEditPanel.js b/src/panel/SmtpEditPanel.js
index 37e4d51..8fafba9 100644
--- a/src/panel/SmtpEditPanel.js
+++ b/src/panel/SmtpEditPanel.js
@@ -51,6 +51,7 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
editable: '{isCreate}',
},
fieldLabel: gettext('Endpoint Name'),
+ vtype: 'SafeId',
allowBlank: false,
},
{
diff --git a/src/panel/WebhookEditPanel.js b/src/panel/WebhookEditPanel.js
index 7980d8b..8854329 100644
--- a/src/panel/WebhookEditPanel.js
+++ b/src/panel/WebhookEditPanel.js
@@ -17,7 +17,7 @@ Ext.define('Proxmox.panel.WebhookEditPanel', {
editable: '{isCreate}',
},
fieldLabel: gettext('Endpoint Name'),
- regex: Proxmox.Utils.safeIdRegex,
+ vtype: 'SafeId',
allowBlank: false,
},
],
diff --git a/src/window/NotificationMatcherEdit.js b/src/window/NotificationMatcherEdit.js
index a1d173c..d1b66a3 100644
--- a/src/window/NotificationMatcherEdit.js
+++ b/src/window/NotificationMatcherEdit.js
@@ -12,6 +12,7 @@ Ext.define('Proxmox.panel.NotificationMatcherGeneralPanel', {
editable: '{isCreate}',
},
fieldLabel: gettext('Matcher Name'),
+ vtype: 'SafeId',
allowBlank: false,
},
{
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-06 9:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 9:54 [PATCH widget-toolkit] fix #7586: notification: check names of matchers and targets in the UI Michal Fox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox