[pve-devel] [PATCH manager v2 3/4] add pveIntegerfield and use it
Dominik Csapak
d.csapak at proxmox.com
Wed Nov 2 16:57:12 CET 2016
this adds a subclass of Ext.form.field.Number with the settings for
Integers (allowDecimals: false and allowExponential: false and default
step size 1)
and use it where we only accept integers
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/ceph/Pool.js | 8 ++++----
www/manager6/dc/AuthEdit.js | 12 +++---------
www/manager6/form/ControllerSelector.js | 2 +-
www/manager6/form/IntegerField.js | 8 ++++++++
www/manager6/grid/FirewallOptions.js | 3 +--
www/manager6/ha/GroupEdit.js | 2 +-
www/manager6/ha/ResourceEdit.js | 8 ++------
www/manager6/lxc/Options.js | 3 +--
www/manager6/lxc/ResourceEdit.js | 11 ++++-------
www/manager6/qemu/CPUOptions.js | 4 ++--
www/manager6/qemu/HDThrottle.js | 8 ++++----
www/manager6/qemu/MemoryEdit.js | 4 ++--
www/manager6/qemu/NetworkEdit.js | 2 +-
www/manager6/qemu/ProcessorEdit.js | 4 ++--
www/manager6/storage/DirEdit.js | 2 +-
www/manager6/storage/GlusterFsEdit.js | 2 +-
www/manager6/storage/NFSEdit.js | 2 +-
www/manager6/window/MigrateAll.js | 2 +-
19 files changed, 41 insertions(+), 47 deletions(-)
create mode 100644 www/manager6/form/IntegerField.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 62eccbe..d35ac35 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -26,6 +26,7 @@ JSSRC= \
form/VLanField.js \
form/Checkbox.js \
form/TextField.js \
+ form/IntegerField.js \
form/RRDTypeSelector.js \
form/ComboGrid.js \
form/KVComboBox.js \
diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
index c4e8dff..efc648f 100644
--- a/www/manager6/ceph/Pool.js
+++ b/www/manager6/ceph/Pool.js
@@ -16,7 +16,7 @@ Ext.define('PVE.CephCreatePool', {
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: gettext('Size'),
name: 'size',
value: 2,
@@ -25,7 +25,7 @@ Ext.define('PVE.CephCreatePool', {
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: gettext('Min. Size'),
name: 'min_size',
value: 1,
@@ -34,7 +34,7 @@ Ext.define('PVE.CephCreatePool', {
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: gettext('Crush RuleSet'),
name: 'crush_ruleset',
value: 0,
@@ -43,7 +43,7 @@ Ext.define('PVE.CephCreatePool', {
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: 'pg_num',
name: 'pg_num',
value: 64,
diff --git a/www/manager6/dc/AuthEdit.js b/www/manager6/dc/AuthEdit.js
index de51062..980348d 100644
--- a/www/manager6/dc/AuthEdit.js
+++ b/www/manager6/dc/AuthEdit.js
@@ -106,7 +106,7 @@ Ext.define('PVE.dc.AuthEdit', {
name: 'server2'
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'port',
fieldLabel: gettext('Port'),
minValue: 1,
@@ -147,13 +147,10 @@ Ext.define('PVE.dc.AuthEdit', {
});
column2.push({
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'oath_step',
value: '',
minValue: 10,
- step: 1,
- allowDecimals: false,
- allowBlank: true,
emptyText: PVE.Utils.defaultText + ' (30)',
submitEmptyText: false,
hidden: true,
@@ -161,14 +158,11 @@ Ext.define('PVE.dc.AuthEdit', {
});
column2.push({
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'oath_digits',
value: '',
minValue: 6,
maxValue: 8,
- step: 1,
- allowDecimals: false,
- allowBlank: true,
emptyText: PVE.Utils.defaultText + ' (6)',
submitEmptyText: false,
hidden: true,
diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js
index bf8a53e..fd4c66e 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -122,7 +122,7 @@ Ext.define('PVE.form.ControllerSelector', {
}
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'deviceid',
minValue: 0,
maxValue: PVE.form.ControllerSelector.maxIds.ide,
diff --git a/www/manager6/form/IntegerField.js b/www/manager6/form/IntegerField.js
new file mode 100644
index 0000000..23011c4
--- /dev/null
+++ b/www/manager6/form/IntegerField.js
@@ -0,0 +1,8 @@
+Ext.define('PVE.form.IntegerField',{
+ extend: 'Ext.form.field.Number',
+ alias: 'widget.pveIntegerField',
+
+ allowDecimals: false,
+ allowExponential: false,
+ step: 1
+});
diff --git a/www/manager6/grid/FirewallOptions.js b/www/manager6/grid/FirewallOptions.js
index 26ee373..859dc1f 100644
--- a/www/manager6/grid/FirewallOptions.js
+++ b/www/manager6/grid/FirewallOptions.js
@@ -59,10 +59,9 @@ Ext.define('PVE.FirewallOptions', {
subject: text,
fieldDefaults: { labelWidth: labelWidth || 100 },
items: {
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: name,
minValue: minValue,
- decimalPrecision: 0,
fieldLabel: text,
emptyText: gettext('Default'),
getSubmitData: function() {
diff --git a/www/manager6/ha/GroupEdit.js b/www/manager6/ha/GroupEdit.js
index db9cf74..0d4aa45 100644
--- a/www/manager6/ha/GroupEdit.js
+++ b/www/manager6/ha/GroupEdit.js
@@ -78,7 +78,7 @@ Ext.define('PVE.ha.GroupInputPanel', {
sortable: true,
stopSelection: true,
widget: {
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
minValue: 0,
maxValue: 1000,
listeners: {
diff --git a/www/manager6/ha/ResourceEdit.js b/www/manager6/ha/ResourceEdit.js
index 326d268..79a9836 100644
--- a/www/manager6/ha/ResourceEdit.js
+++ b/www/manager6/ha/ResourceEdit.js
@@ -48,25 +48,21 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
validateExists: true
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'max_restart',
fieldLabel: gettext('Max. Restart'),
value: 1,
minValue: 0,
maxValue: 10,
- allowDecimals: false,
- allowExponential: false,
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'max_relocate',
fieldLabel: gettext('Max. Relocate'),
value: 1,
minValue: 0,
maxValue: 10,
- allowDecimals: false,
- allowExponential: false,
allowBlank: false
}
];
diff --git a/www/manager6/lxc/Options.js b/www/manager6/lxc/Options.js
index 8871554..8c45fb1 100644
--- a/www/manager6/lxc/Options.js
+++ b/www/manager6/lxc/Options.js
@@ -78,9 +78,8 @@ Ext.define('PVE.lxc.Options', {
xtype: 'pveWindowEdit',
subject: gettext('TTY count'),
items: {
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'tty',
- decimalPrecision: 0,
minValue: 0,
maxValue: 6,
value: 2,
diff --git a/www/manager6/lxc/ResourceEdit.js b/www/manager6/lxc/ResourceEdit.js
index dd1639c..156c99f 100644
--- a/www/manager6/lxc/ResourceEdit.js
+++ b/www/manager6/lxc/ResourceEdit.js
@@ -119,13 +119,10 @@ Ext.define('PVE.lxc.CPUInputPanel', {
var column1 = [
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'cores',
minValue: 1,
maxValue: 128,
- step: 1,
- allowDecimals: false,
- allowExponential: false,
value: me.insideWizard ? 1 : '',
fieldLabel: gettext('Cores'),
allowBlank: true,
@@ -146,7 +143,7 @@ Ext.define('PVE.lxc.CPUInputPanel', {
emptyText: gettext('unlimited')
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'cpuunits',
fieldLabel: gettext('CPU units'),
value: 1024,
@@ -181,7 +178,7 @@ Ext.define('PVE.lxc.MemoryInputPanel', {
var items = [
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'memory',
minValue: 32,
maxValue: 512*1024,
@@ -192,7 +189,7 @@ Ext.define('PVE.lxc.MemoryInputPanel', {
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'swap',
minValue: 0,
maxValue: 128*1024,
diff --git a/www/manager6/qemu/CPUOptions.js b/www/manager6/qemu/CPUOptions.js
index 5ee7afb..3cadf22 100644
--- a/www/manager6/qemu/CPUOptions.js
+++ b/www/manager6/qemu/CPUOptions.js
@@ -17,7 +17,7 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
var items = [
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'vcpus',
minValue: 1,
maxValue: me.maxvcpus,
@@ -38,7 +38,7 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
emptyText: gettext('unlimited')
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'cpuunits',
fieldLabel: gettext('CPU units'),
minValue: 8,
diff --git a/www/manager6/qemu/HDThrottle.js b/www/manager6/qemu/HDThrottle.js
index 7506cff..60a699c 100644
--- a/www/manager6/qemu/HDThrottle.js
+++ b/www/manager6/qemu/HDThrottle.js
@@ -111,7 +111,7 @@ Ext.define('PVE.qemu.HDThrottleInputPanel', {
me.column2.push(me.mbps_wr_max);
- me.iops_rd = Ext.widget('numberfield', {
+ me.iops_rd = Ext.widget('pveIntegerField', {
name: 'iops_rd',
minValue: 10,
step: 10,
@@ -122,7 +122,7 @@ Ext.define('PVE.qemu.HDThrottleInputPanel', {
me.column1.push(me.iops_rd);
- me.iops_rd_max = Ext.widget('numberfield', {
+ me.iops_rd_max = Ext.widget('pveIntegerField', {
name: 'iops_rd_max',
minValue: 10,
step: 10,
@@ -133,7 +133,7 @@ Ext.define('PVE.qemu.HDThrottleInputPanel', {
me.column2.push(me.iops_rd_max);
- me.iops_wr = Ext.widget('numberfield', {
+ me.iops_wr = Ext.widget('pveIntegerField', {
name: 'iops_wr',
minValue: 10,
step: 10,
@@ -144,7 +144,7 @@ Ext.define('PVE.qemu.HDThrottleInputPanel', {
me.column1.push(me.iops_wr);
- me.iops_wr_max = Ext.widget('numberfield', {
+ me.iops_wr_max = Ext.widget('pveIntegerField', {
name: 'iops_wr_max',
minValue: 10,
step: 10,
diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index e9ee432..821a8ae 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -93,7 +93,7 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
}
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'balloon',
disabled: true,
minValue: 0,
@@ -106,7 +106,7 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
allowBlank: false
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'shares',
disabled: true,
minValue: 0,
diff --git a/www/manager6/qemu/NetworkEdit.js b/www/manager6/qemu/NetworkEdit.js
index 9a4875d..a23af65 100644
--- a/www/manager6/qemu/NetworkEdit.js
+++ b/www/manager6/qemu/NetworkEdit.js
@@ -149,7 +149,7 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
allowBlank: true
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'queues',
fieldLabel: gettext('Multiqueues'),
minValue: 1,
diff --git a/www/manager6/qemu/ProcessorEdit.js b/www/manager6/qemu/ProcessorEdit.js
index be15354..01da703 100644
--- a/www/manager6/qemu/ProcessorEdit.js
+++ b/www/manager6/qemu/ProcessorEdit.js
@@ -42,7 +42,7 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
me.column1 = [
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'sockets',
minValue: 1,
maxValue: 4,
@@ -58,7 +58,7 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
}
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'cores',
minValue: 1,
maxValue: 128,
diff --git a/www/manager6/storage/DirEdit.js b/www/manager6/storage/DirEdit.js
index e38c231..fa94065 100644
--- a/www/manager6/storage/DirEdit.js
+++ b/www/manager6/storage/DirEdit.js
@@ -61,7 +61,7 @@ Ext.define('PVE.storage.DirInputPanel', {
fieldLabel: gettext('Shared')
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: gettext('Max Backups'),
name: 'maxfiles',
minValue: 0,
diff --git a/www/manager6/storage/GlusterFsEdit.js b/www/manager6/storage/GlusterFsEdit.js
index 3a04fb4..9a4918a 100644
--- a/www/manager6/storage/GlusterFsEdit.js
+++ b/www/manager6/storage/GlusterFsEdit.js
@@ -147,7 +147,7 @@ Ext.define('PVE.storage.GlusterFsInputPanel', {
fieldLabel: gettext('Enable')
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: gettext('Max Backups'),
name: 'maxfiles',
minValue: 0,
diff --git a/www/manager6/storage/NFSEdit.js b/www/manager6/storage/NFSEdit.js
index 20ba83b..f24209a 100644
--- a/www/manager6/storage/NFSEdit.js
+++ b/www/manager6/storage/NFSEdit.js
@@ -142,7 +142,7 @@ Ext.define('PVE.storage.NFSInputPanel', {
fieldLabel: gettext('Enable')
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
fieldLabel: gettext('Max Backups'),
name: 'maxfiles',
minValue: 0,
diff --git a/www/manager6/window/MigrateAll.js b/www/manager6/window/MigrateAll.js
index 525735b..1bcba1e 100644
--- a/www/manager6/window/MigrateAll.js
+++ b/www/manager6/window/MigrateAll.js
@@ -48,7 +48,7 @@ Ext.define('PVE.window.MigrateAll', {
onlineValidator: true
},
{
- xtype: 'numberfield',
+ xtype: 'pveIntegerField',
name: 'maxworkers',
minValue: 1,
maxValue: 100,
--
2.1.4
More information about the pve-devel
mailing list