[pbs-devel] [PATCH widget-toolkit 2/2] Toolkit: add HostPort vtype

Dominik Csapak d.csapak at proxmox.com
Thu Oct 1 09:57:55 CEST 2020


for easy checking textfield for a single host:port

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/Toolkit.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index d528ea7..f706036 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -147,6 +147,14 @@ Ext.apply(Ext.form.field.VTypes, {
     },
     DnsOrIpText: gettext('Not a valid DNS name or IP address.'),
 
+    HostPort: function(v) {
+	return Proxmox.Utils.HostPort_match.test(v) ||
+		Proxmox.Utils.HostPortBrackets_match.test(v) ||
+		Proxmox.Utils.IP6_dotnotation_match.test(v);
+    },
+
+    HostPortText: gettext('Not a valid hosts'),
+
     HostList: function(v) {
 	let list = v.split(/[ ,;]+/);
 	let i;
-- 
2.20.1






More information about the pbs-devel mailing list