]>
Commit | Line | Data |
---|---|---|
04f5d98e DM |
1 | Ext.define('PVE.form.VMIDSelector', { |
2 | extend: 'Ext.form.field.Number', | |
3 | alias: 'widget.pveVMIDSelector', | |
4 | ||
5 | minValue: 100, | |
6 | ||
7 | maxValue: 999999999, | |
8 | ||
9 | validateExists: undefined, | |
10 | ||
11 | validator: function(value) { | |
12 | var me = this; | |
13 | ||
14 | if (!Ext.isDefined(me.validateExists)) { | |
15 | return true; | |
16 | } | |
17 | if (PVE.data.ResourceStore.findVMID(value)) { | |
18 | if (me.validateExists === true) { | |
19 | return true; | |
20 | } | |
21 | return "This VM ID is already in use."; | |
22 | } else { | |
23 | if (me.validateExists === false) { | |
24 | return true; | |
25 | } | |
26 | return "This VM ID does not exists."; | |
27 | } | |
28 | }, | |
29 | ||
30 | initComponent: function() { | |
31 | var me = this; | |
32 | ||
33 | Ext.applyIf(me, { | |
34 | fieldLabel: 'VM ID', | |
35 | allowBlank: false | |
36 | }); | |
37 | ||
38 | me.callParent(); | |
39 | } | |
40 | }); |