[pve-devel] [PATCH widget-toolkit 5/5] toolkit: add MacPrefix vtype

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Dec 19 08:16:15 CET 2017


useful for our PVE dc/options panel

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 Toolkit.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Toolkit.js b/Toolkit.js
index e4e9dca..9487c7e 100644
--- a/Toolkit.js
+++ b/Toolkit.js
@@ -53,6 +53,12 @@ Ext.apply(Ext.form.field.VTypes, {
     MacAddressMask: /[a-fA-F0-9:]/,
     MacAddressText: gettext('Example') + ': 01:23:45:67:89:ab',
 
+    MacPrefix:  function(v) {
+	return (/^[a-f0-9]{2}(?::[a-f0-9]{2}){0,2}:?$/i).test(v);
+    },
+    MacPrefixMask: /[a-fA-F0-9:]/,
+    MacPrefixText: gettext('Example') + ': 02:8f',
+
     BridgeName: function(v) {
         return (/^vmbr\d{1,4}$/).test(v);
     },
-- 
2.11.0





More information about the pve-devel mailing list