[pve-devel] [PATCH manager 03/19] use TextField from proxmox-widget-toolkit

Dominik Csapak d.csapak at proxmox.com
Thu Dec 21 13:36:06 CET 2017


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Makefile                 |  1 -
 www/manager6/dc/AuthEdit.js           |  2 +-
 www/manager6/dc/GroupEdit.js          |  2 +-
 www/manager6/dc/OptionView.js         |  6 +++---
 www/manager6/dc/PoolEdit.js           |  2 +-
 www/manager6/form/TextField.js        | 36 -----------------------------------
 www/manager6/grid/FirewallRules.js    |  4 ++--
 www/manager6/lxc/CreateWizard.js      |  4 ++--
 www/manager6/lxc/DNS.js               |  8 ++++----
 www/manager6/node/DNSEdit.js          |  6 +++---
 www/manager6/node/NetworkEdit.js      | 12 ++++++------
 www/manager6/qemu/Options.js          |  2 +-
 www/manager6/storage/GlusterFsEdit.js |  2 +-
 13 files changed, 25 insertions(+), 62 deletions(-)
 delete mode 100644 www/manager6/form/TextField.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 6a5b8252..fdaf15d4 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -28,7 +28,6 @@ JSSRC= 				                 	\
 	data/RRDStore.js				\
 	form/VLanField.js				\
 	form/Checkbox.js				\
-	form/TextField.js				\
 	form/IntegerField.js				\
 	form/RRDTypeSelector.js				\
 	form/KVComboBox.js				\
diff --git a/www/manager6/dc/AuthEdit.js b/www/manager6/dc/AuthEdit.js
index 91a722e2..612436d1 100644
--- a/www/manager6/dc/AuthEdit.js
+++ b/www/manager6/dc/AuthEdit.js
@@ -100,7 +100,7 @@ Ext.define('PVE.dc.AuthEdit', {
                     allowBlank: false
 		},
 		{
-                    xtype: 'pvetextfield',
+                    xtype: 'proxmoxtextfield',
                     fieldLabel: gettext('Fallback Server'),
 		    deleteEmpty: !me.isCreate,
 		    name: 'server2'
diff --git a/www/manager6/dc/GroupEdit.js b/www/manager6/dc/GroupEdit.js
index 0d881a38..6f17c5b5 100644
--- a/www/manager6/dc/GroupEdit.js
+++ b/www/manager6/dc/GroupEdit.js
@@ -24,7 +24,7 @@ Ext.define('PVE.dc.GroupEdit', {
             method: method,
             items: [
                 {
-		    xtype: me.isCreate ? 'pvetextfield' : 'displayfield',
+		    xtype: me.isCreate ? 'proxmoxtextfield' : 'displayfield',
 		    fieldLabel: gettext('Name'),
 		    name: 'groupid',
 		    value: me.groupid,
diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index a24b542f..44ca096b 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -7,7 +7,7 @@ Ext.define('PVE.dc.HttpProxyEdit', {
 	Ext.applyIf(me, {
 	    subject: gettext('HTTP proxy'),
 	    items: {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		name: 'http_proxy',
 		vtype: 'HttpProxy',
 		emptyText: PVE.Utils.noneText,
@@ -83,7 +83,7 @@ Ext.define('PVE.dc.EmailFromEdit', {
 	Ext.applyIf(me, {
 	    subject: gettext('Email from address'),
 	    items: {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		name: 'email_from',
 		vtype: 'pveMail',
 		emptyText: 'root@$hostname',
@@ -108,7 +108,7 @@ Ext.define('PVE.dc.MacPrefixEdit', {
 	Ext.applyIf(me, {
 	    subject: gettext('MAC address prefix'),
 	    items: {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		name: 'mac_prefix',
 		regex: /^[a-f0-9]{2}(?::[a-f0-9]{2}){0,2}:?$/i,
 		regexText: gettext('Example') + ': 02:8f',
diff --git a/www/manager6/dc/PoolEdit.js b/www/manager6/dc/PoolEdit.js
index c2a2d25f..ce466af8 100644
--- a/www/manager6/dc/PoolEdit.js
+++ b/www/manager6/dc/PoolEdit.js
@@ -24,7 +24,7 @@ Ext.define('PVE.dc.PoolEdit', {
             method: method,
             items: [
                 {
-		    xtype: me.isCreate ? 'pvetextfield' : 'displayfield',
+		    xtype: me.isCreate ? 'proxmoxtextfield' : 'displayfield',
 		    fieldLabel: gettext('Name'),
 		    name: 'poolid',
 		    value: me.poolid,
diff --git a/www/manager6/form/TextField.js b/www/manager6/form/TextField.js
deleted file mode 100644
index 60e42eb6..00000000
--- a/www/manager6/form/TextField.js
+++ /dev/null
@@ -1,36 +0,0 @@
-Ext.define('PVE.form.Textfield', {
-    extend: 'Ext.form.field.Text',
-    alias: ['widget.pvetextfield'],
-
-    skipEmptyText: true,
-    
-    deleteEmpty: false,
-    
-    getSubmitData: function() {
-        var me = this,
-            data = null,
-            val;
-        if (!me.disabled && me.submitValue && !me.isFileUpload()) {
-            val = me.getSubmitValue();
-            if (val !== null) {
-                data = {};
-                data[me.getName()] = val;
-            } else if (me.deleteEmpty) {
-		data = {};
-                data['delete'] = me.getName();
-	    }
-        }
-        return data;
-    },
-
-    getSubmitValue: function() {
-	var me = this;
-
-        var value = this.processRawValue(this.getRawValue());
-	if (value !== '') {
-	    return value;
-	}
-
-	return me.skipEmptyText ? null: value; 
-    }
-});
\ No newline at end of file
diff --git a/www/manager6/grid/FirewallRules.js b/www/manager6/grid/FirewallRules.js
index 5adf7e80..80801db0 100644
--- a/www/manager6/grid/FirewallRules.js
+++ b/www/manager6/grid/FirewallRules.js
@@ -106,7 +106,7 @@ Ext.define('PVE.FirewallRulePanel', {
 
 	if (me.allow_iface) {
 	    me.column1.push({
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		name: 'iface',
 		deleteEmpty: !me.isCreate,
 		value: '',
@@ -324,7 +324,7 @@ Ext.define('PVE.FirewallGroupRuleEdit', {
 
 	if (me.allow_iface) {
 	    column1.push({
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		name: 'iface',
 		deleteEmpty: !me.isCreate,
 		value: '',
diff --git a/www/manager6/lxc/CreateWizard.js b/www/manager6/lxc/CreateWizard.js
index 5fedb99c..5e85d2fe 100644
--- a/www/manager6/lxc/CreateWizard.js
+++ b/www/manager6/lxc/CreateWizard.js
@@ -88,7 +88,7 @@ Ext.define('PVE.lxc.CreateWizard', {
 
 	/*jslint confusion: true */
 	/* the validator function can return either a string or a boolean */
-	me.sshkeyfield = Ext.createWidget('pvetextfield', {
+	me.sshkeyfield = Ext.createWidget('proxmoxtextfield', {
 	    name: 'ssh-public-keys',
 	    value: '',
 	    fieldLabel: gettext('SSH public key'),
@@ -207,7 +207,7 @@ Ext.define('PVE.lxc.CreateWizard', {
 			    validateExists: false
 			},
 			{
-			    xtype: 'pvetextfield',
+			    xtype: 'proxmoxtextfield',
 			    name: 'hostname',
 			    vtype: 'DnsName',
 			    value: '',
diff --git a/www/manager6/lxc/DNS.js b/www/manager6/lxc/DNS.js
index 9b17c6f5..5437967f 100644
--- a/www/manager6/lxc/DNS.js
+++ b/www/manager6/lxc/DNS.js
@@ -37,7 +37,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
 
 	var items = [
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		name: 'searchdomain',
 		skipEmptyText: true,
 		fieldLabel: gettext('DNS domain'),
@@ -58,7 +58,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
 		}
 	    },
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		fieldLabel: gettext('DNS server') + " 1",
 		vtype: 'IP64Address',
 		allowBlank: true,
@@ -67,7 +67,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
 		itemId: 'dns1'
 	    },
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		fieldLabel: gettext('DNS server') + " 2",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
@@ -76,7 +76,7 @@ Ext.define('PVE.lxc.DNSInputPanel', {
 		itemId: 'dns2'
 	    },
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		fieldLabel: gettext('DNS server') + " 3",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
diff --git a/www/manager6/node/DNSEdit.js b/www/manager6/node/DNSEdit.js
index e9784801..e878622d 100644
--- a/www/manager6/node/DNSEdit.js
+++ b/www/manager6/node/DNSEdit.js
@@ -18,21 +18,21 @@ Ext.define('PVE.node.DNSEdit', {
                 allowBlank: false
 	    },
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
                 fieldLabel: gettext('DNS server') + " 1",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
                 name: 'dns1'
 	    },
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
 		fieldLabel: gettext('DNS server') + " 2",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
                 name: 'dns2'
 	    },
 	    {
-		xtype: 'pvetextfield',
+		xtype: 'proxmoxtextfield',
                 fieldLabel: gettext('DNS server') + " 3",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
diff --git a/www/manager6/node/NetworkEdit.js b/www/manager6/node/NetworkEdit.js
index aa995693..de8b65d9 100644
--- a/www/manager6/node/NetworkEdit.js
+++ b/www/manager6/node/NetworkEdit.js
@@ -209,14 +209,14 @@ Ext.define('PVE.node.NetworkEdit', {
 
 	    column1.push(
 		{
-		    xtype: 'pvetextfield',
+		    xtype: 'proxmoxtextfield',
 		    deleteEmpty: !me.isCreate,
 		    fieldLabel: gettext('IP address'),
 		    vtype: 'IPAddress',
 		    name: 'address'
 		},
 		{
-		    xtype: 'pvetextfield',
+		    xtype: 'proxmoxtextfield',
 		    deleteEmpty: !me.isCreate,
 		    fieldLabel: gettext('Subnet mask'),
 		    vtype: 'IPAddress',
@@ -241,21 +241,21 @@ Ext.define('PVE.node.NetworkEdit', {
 		    }
 		},
 		{
-		    xtype: 'pvetextfield',
+		    xtype: 'proxmoxtextfield',
 		    deleteEmpty: !me.isCreate,
 		    fieldLabel: gettext('Gateway'),
 		    vtype: 'IPAddress',
 		    name: 'gateway'
 		},
 		{
-		    xtype: 'pvetextfield',
+		    xtype: 'proxmoxtextfield',
 		    deleteEmpty: !me.isCreate,
 		    fieldLabel: gettext('IPv6 address'),
 		    vtype: 'IP6Address',
 		    name: 'address6'
 		},
 		{
-		    xtype: 'pvetextfield',
+		    xtype: 'proxmoxtextfield',
 		    deleteEmpty: !me.isCreate,
 		    fieldLabel: gettext('Prefix length'),
 		    vtype: 'IP6PrefixLength',
@@ -282,7 +282,7 @@ Ext.define('PVE.node.NetworkEdit', {
 		    }
 		},
 		{
-		    xtype: 'pvetextfield',
+		    xtype: 'proxmoxtextfield',
 		    deleteEmpty: !me.isCreate,
 		    fieldLabel: gettext('Gateway'),
 		    vtype: 'IP6Address',
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index b5d32537..016d68aa 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -247,7 +247,7 @@ Ext.define('PVE.qemu.Options', {
 		    xtype: 'pveWindowEdit',
 		    subject: gettext('RTC start date'),
 		    items: {
-			xtype: 'pvetextfield',
+			xtype: 'proxmoxtextfield',
 			name: 'startdate',
 			deleteEmpty: true,
 			value: 'now',
diff --git a/www/manager6/storage/GlusterFsEdit.js b/www/manager6/storage/GlusterFsEdit.js
index d861c0b8..1d135690 100644
--- a/www/manager6/storage/GlusterFsEdit.js
+++ b/www/manager6/storage/GlusterFsEdit.js
@@ -106,7 +106,7 @@ Ext.define('PVE.storage.GlusterFsInputPanel', {
 		}
 	    },
 	    {
-		xtype: me.isCreate ? 'pvetextfield' : 'displayfield',
+		xtype: me.isCreate ? 'proxmoxtextfield' : 'displayfield',
 		name: 'server2',
 		value: '',
 		fieldLabel: gettext('Second Server'),
-- 
2.11.0





More information about the pve-devel mailing list