]>
Commit | Line | Data |
---|---|---|
9940ea01 DM |
1 | Ext.define('PVE.RestProxy', { |
2 | extend: 'Ext.data.RestProxy', | |
f3b18589 | 3 | alias: 'proxy.pve', |
9940ea01 DM |
4 | |
5 | constructor: function(config) { | |
6 | var me = this; | |
7 | ||
8 | config = config || {}; | |
9 | ||
10 | Ext.applyIf(config, { | |
f3b18589 | 11 | pageParam: null, |
9940ea01 DM |
12 | startParam: null, |
13 | limitParam: null, | |
14 | groupParam: null, | |
15 | sortParam: null, | |
16 | filterParam: null, | |
f3b18589 | 17 | noCache: false, |
9940ea01 DM |
18 | reader: { |
19 | type: 'json', | |
f3b18589 | 20 | rootProperty: config.root || 'data', |
9940ea01 DM |
21 | }, |
22 | afterRequest: function(request, success) { | |
23 | me.fireEvent('afterload', me, request, success); | |
f3b18589 | 24 | }, |
9940ea01 DM |
25 | }); |
26 | ||
f3b18589 TL |
27 | me.callParent([config]); |
28 | }, | |
9940ea01 DM |
29 | }); |
30 | ||
31 | Ext.define('pve-domains', { | |
32 | extend: "Ext.data.Model", | |
33 | ||
34 | config: { | |
f3b18589 TL |
35 | fields: ['realm', 'type', 'comment', 'default', 'tfa', |
36 | { | |
9940ea01 DM |
37 | name: 'descr', |
38 | // Note: We use this in the RealmComboBox.js | |
39 | // (see Bug #125) | |
40 | convert: function(value, record) { | |
41 | var info = record.data; | |
42 | var text; | |
43 | ||
44 | if (value) { | |
45 | return value; | |
46 | } | |
47 | // return realm if there is no comment | |
48 | text = info.comment || info.realm; | |
49 | ||
50 | if (info.tfa) { | |
51 | text += " (+ " + info.tfa + ")"; | |
52 | } | |
53 | ||
54 | return text; | |
f3b18589 TL |
55 | }, |
56 | }, | |
9940ea01 DM |
57 | ], |
58 | proxy: { | |
59 | type: 'pve', | |
f3b18589 TL |
60 | url: "/api2/json/access/domains", |
61 | }, | |
62 | }, | |
9940ea01 DM |
63 | }); |
64 | ||
65 | Ext.define('pve-tasks', { | |
66 | extend: 'Ext.data.Model', | |
67 | config: { | |
f3b18589 TL |
68 | fields: [ |
69 | { name: 'starttime', type: 'date', dateFormat: 'timestamp' }, | |
70 | { name: 'endtime', type: 'date', dateFormat: 'timestamp' }, | |
9940ea01 | 71 | { name: 'pid', type: 'int' }, |
f3b18589 | 72 | 'node', 'upid', 'user', 'status', 'type', 'id', |
9940ea01 | 73 | ], |
f3b18589 TL |
74 | idProperty: 'upid', |
75 | }, | |
9940ea01 | 76 | }); |