[pve-devel] [PATCH v2 manager] Add mac prefix to the datacenter options

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Jul 15 10:34:37 CEST 2016


---
  * anchored the regex
  * added regexText with an example
  * changed the empty text to PVE.Util.noneText

 www/manager6/dc/OptionView.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index 2149cb0..f02b870 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -99,6 +99,32 @@ Ext.define('PVE.dc.EmailFromEdit', {
     }
 });
 
+Ext.define('PVE.dc.MacPrefixEdit', {
+    extend: 'PVE.window.Edit',
+
+    initComponent : function() {
+	var me = this;
+
+	Ext.applyIf(me, {
+	    subject: gettext('MAC address prefix'),
+	    items: {
+		xtype: 'pvetextfield',
+		name: 'mac_prefix',
+		regex: /^[a-f0-9]{2}(?::[a-f0-9]{2}){0,2}:?$/i,
+		regexText: gettext('Example') + ': 02:8f',
+		emptyText: PVE.Utils.noneText,
+		deleteEmpty: true,
+		value: '',
+		fieldLabel: gettext('MAC address prefix')
+	    }
+	});
+
+	me.callParent();
+
+	me.load();
+    }
+});
+
 Ext.define('PVE.dc.OptionView', {
     extend: 'PVE.grid.ObjectGrid',
     alias: ['widget.pveDcOptionView'],
@@ -146,6 +172,17 @@ Ext.define('PVE.dc.OptionView', {
 		    }
 		    return value;
 		}
+	    },
+	    mac_prefix: {
+		header: gettext('MAC address prefix'),
+		editor: 'PVE.dc.MacPrefixEdit', 
+		required: true,
+		renderer: function(value) {
+		    if (!value) {
+			return PVE.Utils.noneText;
+		    }
+		    return value;
+		}
 	    }
 	};
 
-- 
2.1.4





More information about the pve-devel mailing list