]>
Commit | Line | Data |
---|---|---|
ac404578 DM |
1 | Ext.define('PVE.RestProxy', { |
2 | extend: 'Ext.data.RestProxy', | |
3 | alias : 'proxy.pve', | |
3b416218 EK |
4 | |
5 | pageParam : null, | |
6 | startParam: null, | |
7 | limitParam: null, | |
8 | groupParam: null, | |
9 | sortParam: null, | |
10 | filterParam: null, | |
11 | noCache : false, | |
12 | afterRequest: function(request, success) { | |
13 | this.fireEvent('afterload', this, request, success); | |
14 | return; | |
15 | }, | |
ac404578 DM |
16 | |
17 | constructor: function(config) { | |
ac404578 | 18 | |
3b416218 | 19 | Ext.applyIf(config, { |
ac404578 DM |
20 | reader: { |
21 | type: 'json', | |
80a04f8e | 22 | rootProperty: config.root || 'data' |
22f2f9d6 | 23 | } |
ac404578 DM |
24 | }); |
25 | ||
3b416218 | 26 | this.callParent([config]); |
ac404578 DM |
27 | } |
28 | ||
29 | }, function() { | |
30 | ||
31 | Ext.define('pve-domains', { | |
32 | extend: "Ext.data.Model", | |
33 | fields: [ 'realm', 'type', 'comment', 'default', 'tfa', | |
34 | { | |
35 | name: 'descr', | |
36 | // Note: We use this in the RealmComboBox.js | |
37 | // (see Bug #125) | |
38 | convert: function(value, record) { | |
39 | var info = record.data; | |
40 | var text; | |
41 | ||
42 | if (value) { | |
43 | return value; | |
44 | } | |
45 | // return realm if there is no comment | |
46 | text = info.comment || info.realm; | |
47 | ||
48 | if (info.tfa) { | |
49 | text += " (+ " + info.tfa + ")"; | |
50 | } | |
51 | ||
91535f2b | 52 | return Ext.String.htmlEncode(text); |
ac404578 DM |
53 | } |
54 | } | |
55 | ], | |
1774f148 | 56 | idProperty: 'realm', |
ac404578 DM |
57 | proxy: { |
58 | type: 'pve', | |
59 | url: "/api2/json/access/domains" | |
60 | } | |
61 | }); | |
62 | ||
63 | Ext.define('KeyValue', { | |
64 | extend: "Ext.data.Model", | |
147a74c6 EK |
65 | fields: [ 'key', 'value' ], |
66 | idProperty: 'key' | |
ac404578 DM |
67 | }); |
68 | ||
69 | Ext.define('KeyValuePendingDelete', { | |
70 | extend: "Ext.data.Model", | |
71 | fields: [ 'key', 'value', 'pending', 'delete' ], | |
72 | idProperty: 'key' | |
73 | }); | |
74 | ||
75 | Ext.define('pve-string-list', { | |
76 | extend: 'Ext.data.Model', | |
77 | fields: [ 'n', 't' ], | |
78 | idProperty: 'n' | |
79 | }); | |
80 | ||
81 | Ext.define('pve-tasks', { | |
82 | extend: 'Ext.data.Model', | |
83 | fields: [ | |
84 | { name: 'starttime', type : 'date', dateFormat: 'timestamp' }, | |
85 | { name: 'endtime', type : 'date', dateFormat: 'timestamp' }, | |
86 | { name: 'pid', type: 'int' }, | |
87 | 'node', 'upid', 'user', 'status', 'type', 'id' | |
88 | ], | |
89 | idProperty: 'upid' | |
90 | }); | |
91 | ||
92 | Ext.define('pve-cluster-log', { | |
93 | extend: 'Ext.data.Model', | |
94 | fields: [ | |
95 | { name: 'uid' , type: 'int' }, | |
96 | { name: 'time', type : 'date', dateFormat: 'timestamp' }, | |
97 | { name: 'pri', type: 'int' }, | |
98 | { name: 'pid', type: 'int' }, | |
0c8d7402 | 99 | 'node', 'user', 'tag', 'msg', 'id' |
ac404578 DM |
100 | ], |
101 | idProperty: 'id' | |
102 | }); | |
103 | }); |