]> git.proxmox.com Git - proxmox-widget-toolkit.git/blob - data/ProxmoxProxy.js
use eslint and execute as check target
[proxmox-widget-toolkit.git] / data / ProxmoxProxy.js
1 Ext.define('Proxmox.RestProxy', {
2 extend: 'Ext.data.RestProxy',
3 alias: 'proxy.proxmox',
4
5 pageParam: null,
6 startParam: null,
7 limitParam: null,
8 groupParam: null,
9 sortParam: null,
10 filterParam: null,
11 noCache: false,
12
13 afterRequest: function(request, success) {
14 this.fireEvent('afterload', this, request, success);
15 },
16
17 constructor: function(config) {
18 Ext.applyIf(config, {
19 reader: {
20 type: 'json',
21 rootProperty: config.root || 'data',
22 },
23 });
24
25 this.callParent([config]);
26 },
27 }, function() {
28 Ext.define('KeyValue', {
29 extend: "Ext.data.Model",
30 fields: ['key', 'value'],
31 idProperty: 'key',
32 });
33
34 Ext.define('KeyValuePendingDelete', {
35 extend: "Ext.data.Model",
36 fields: ['key', 'value', 'pending', 'delete'],
37 idProperty: 'key',
38 });
39
40 Ext.define('proxmox-tasks', {
41 extend: 'Ext.data.Model',
42 fields: [
43 { name: 'starttime', type: 'date', dateFormat: 'timestamp' },
44 { name: 'endtime', type: 'date', dateFormat: 'timestamp' },
45 { name: 'pid', type: 'int' },
46 'node', 'upid', 'user', 'status', 'type', 'id',
47 ],
48 idProperty: 'upid',
49 });
50
51 Ext.define('proxmox-cluster-log', {
52 extend: 'Ext.data.Model',
53 fields: [
54 { name: 'uid', type: 'int' },
55 { name: 'time', type: 'date', dateFormat: 'timestamp' },
56 { name: 'pri', type: 'int' },
57 { name: 'pid', type: 'int' },
58 'node', 'user', 'tag', 'msg',
59 {
60 name: 'id',
61 convert: function(value, record) {
62 let info = record.data;
63
64 if (value) {
65 return value;
66 }
67 // compute unique ID
68 return info.uid + ':' + info.node;
69 },
70 },
71 ],
72 idProperty: 'id',
73 });
74 });