Commit e280d1aa authored by Dietmar Maurer's avatar Dietmar Maurer

copy form/VMIDSelector.js from manager to manager5

parent 1aeceea8
Ext.define('PVE.form.VMIDSelector', {
extend: 'Ext.form.field.Number',
alias: 'widget.pveVMIDSelector',
allowBlank: false,
minValue: 100,
maxValue: 999999999,
validateExists: undefined,
loadNextFreeVMID: false,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
fieldLabel: 'VM ID',
listeners: {
'change': function(field, newValue, oldValue) {
if (!Ext.isDefined(me.validateExists)) {
return;
}
PVE.Utils.API2Request({
params: { vmid: newValue },
url: '/cluster/nextid',
method: 'GET',
success: function(response, opts) {
if (me.validateExists === true) {
me.markInvalid(gettext('This VM ID does not exists'));
}
},
failure: function(response, opts) {
if (me.validateExists === false) {
me.markInvalid(gettext('This VM ID is already in use'));
}
}
});
}
}
});
me.callParent();
if (me.loadNextFreeVMID) {
PVE.Utils.API2Request({
url: '/cluster/nextid',
method: 'GET',
success: function(response, opts) {
me.setRawValue(response.result.data);
}
});
}
}
});
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