]>
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', | |
22 | root: config.root || 'data' | |
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 | ||
52 | return text; | |
53 | } | |
54 | } | |
55 | ], | |
56 | proxy: { | |
57 | type: 'pve', | |
58 | url: "/api2/json/access/domains" | |
59 | } | |
60 | }); | |
61 | ||
62 | Ext.define('KeyValue', { | |
63 | extend: "Ext.data.Model", | |
64 | fields: [ 'key', 'value' ], | |
65 | idProperty: 'key' | |
66 | }); | |
67 | ||
68 | Ext.define('KeyValuePendingDelete', { | |
69 | extend: "Ext.data.Model", | |
70 | fields: [ 'key', 'value', 'pending', 'delete' ], | |
71 | idProperty: 'key' | |
72 | }); | |
73 | ||
74 | Ext.define('pve-string-list', { | |
75 | extend: 'Ext.data.Model', | |
76 | fields: [ 'n', 't' ], | |
77 | idProperty: 'n' | |
78 | }); | |
79 | ||
80 | Ext.define('pve-tasks', { | |
81 | extend: 'Ext.data.Model', | |
82 | fields: [ | |
83 | { name: 'starttime', type : 'date', dateFormat: 'timestamp' }, | |
84 | { name: 'endtime', type : 'date', dateFormat: 'timestamp' }, | |
85 | { name: 'pid', type: 'int' }, | |
86 | 'node', 'upid', 'user', 'status', 'type', 'id' | |
87 | ], | |
88 | idProperty: 'upid' | |
89 | }); | |
90 | ||
91 | Ext.define('pve-cluster-log', { | |
92 | extend: 'Ext.data.Model', | |
93 | fields: [ | |
94 | { name: 'uid' , type: 'int' }, | |
95 | { name: 'time', type : 'date', dateFormat: 'timestamp' }, | |
96 | { name: 'pri', type: 'int' }, | |
97 | { name: 'pid', type: 'int' }, | |
98 | 'node', 'user', 'tag', 'msg', | |
99 | { | |
100 | name: 'id', | |
101 | convert: function(value, record) { | |
102 | var info = record.data; | |
103 | var text; | |
104 | ||
105 | if (value) { | |
106 | return value; | |
107 | } | |
108 | // compute unique ID | |
109 | return info.uid + ':' + info.node; | |
110 | } | |
111 | } | |
112 | ], | |
113 | idProperty: 'id' | |
114 | }); | |
115 | }); |