Commit 5f1518d6 authored by Dietmar Maurer's avatar Dietmar Maurer

implemented new VMIDSelector class

parent 9822bddd
......@@ -21,6 +21,7 @@ JSSRC= \
form/ComboGrid.js \
form/KVComboBox.js \
form/Boolean.js \
form/VMIDSelector.js \
form/NetworkCardSelector.js \
form/DiskFormatSelector.js \
form/BusTypeSelector.js \
......
Ext.define('PVE.form.VMIDSelector', {
extend: 'Ext.form.field.Number',
alias: 'widget.pveVMIDSelector',
minValue: 100,
maxValue: 999999999,
validateExists: undefined,
validator: function(value) {
var me = this;
if (!Ext.isDefined(me.validateExists)) {
return true;
}
if (PVE.data.ResourceStore.findVMID(value)) {
if (me.validateExists === true) {
return true;
}
return "This VM ID is already in use.";
} else {
if (me.validateExists === false) {
return true;
}
return "This VM ID does not exists.";
}
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
fieldLabel: 'VM ID',
allowBlank: false
});
me.callParent();
}
});
......@@ -57,20 +57,10 @@ Ext.define('PVE.openvz.CreateWizard', {
}
},
{
xtype: 'numberfield',
xtype: 'pveVMIDSelector',
name: 'vmid',
value: nextvmid,
minValue: 100,
maxValue: 999999999,
fieldLabel: 'VM ID',
allowBlank: false,
validator: function(value) {
/*jslint confusion: true */
if (!PVE.data.ResourceStore.findVMID(value)) {
return true;
}
return "This VM ID is already in use.";
}
validateExists: false
},
{
xtype: 'pvetextfield',
......
......@@ -61,20 +61,10 @@ Ext.define('PVE.qemu.CreateWizard', {
}
},
{
xtype: 'numberfield',
xtype: 'pveVMIDSelector',
name: 'vmid',
value: nextvmid,
minValue: 100,
maxValue: 999999999,
fieldLabel: 'VM ID',
allowBlank: false,
validator: function(value) {
/*jslint confusion: true */
if (!PVE.data.ResourceStore.findVMID(value)) {
return true;
}
return "This VM ID is already in use.";
}
validateExists: false
},
{
xtype: 'textfield',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment