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