mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-25 07:02:51 +00:00
43 lines
786 B
JavaScript
43 lines
786 B
JavaScript
Ext.define('PVE.form.VMIDSelector', {
|
|
extend: 'Ext.form.field.Number',
|
|
alias: 'widget.pveVMIDSelector',
|
|
|
|
allowBlank: false,
|
|
|
|
minValue: 100,
|
|
|
|
maxValue: 999999999,
|
|
|
|
validateExists: undefined,
|
|
|
|
validator: function(value) {
|
|
/*jslint confusion: true */
|
|
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'
|
|
});
|
|
|
|
me.callParent();
|
|
}
|
|
});
|