]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
copy form/VLanField.js from manager to manager5
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Jul 2015 09:29:11 +0000 (11:29 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Jul 2015 09:29:11 +0000 (11:29 +0200)
www/manager5/form/VLanField.js [new file with mode: 0644]

diff --git a/www/manager5/form/VLanField.js b/www/manager5/form/VLanField.js
new file mode 100644 (file)
index 0000000..c699907
--- /dev/null
@@ -0,0 +1,40 @@
+Ext.define('PVE.form.VlanField', {
+    extend: 'Ext.form.field.Number',
+    alias: ['widget.pveVlanField'],
+
+    deleteEmpty: false,
+
+    emptyText: 'no VLAN',
+    
+    fieldLabel: gettext('VLAN Tag'),
+
+    allowBlank: true,
+    
+    getSubmitData: function() {
+        var me = this,
+            data = null,
+            val;
+        if (!me.disabled && me.submitValue) {
+            val = me.getSubmitValue();
+            if (val) {
+                data = {};
+                data[me.getName()] = val;
+            } else if (me.deleteEmpty) {
+               data = {};
+                data['delete'] = me.getName();
+           }
+        }
+        return data;
+    },
+
+    initComponent: function() {
+       var me = this;
+
+       Ext.apply(me, {
+           minValue: 1,
+           maxValue: 4094
+       });
+
+       me.callParent();
+    }
+});