]>
Commit | Line | Data |
---|---|---|
11eae1a0 FE |
1 | Ext.define('PMG.NodeInfoPanel', { |
2 | extend: 'Proxmox.panel.StatusView', | |
3 | alias: 'widget.pmgNodeInfoPanel', | |
4 | ||
5 | layout: { | |
6 | type: 'table', | |
7 | columns: 2, | |
8 | tableAttrs: { | |
9 | style: { | |
10 | width: '100%', | |
11 | }, | |
12 | }, | |
13 | }, | |
14 | ||
15 | defaults: { | |
16 | xtype: 'pmxInfoWidget', | |
17 | padding: '0 10 5 10', | |
18 | }, | |
19 | ||
11eae1a0 FE |
20 | items: [ |
21 | { | |
22 | itemId: 'nodecpu', | |
23 | iconCls: 'fa fa-fw pmx-itype-icon-processor pmx-icon', | |
24 | title: gettext('CPU usage'), | |
25 | valueField: 'cpu', | |
26 | maxField: 'cpuinfo', | |
27 | renderer: Proxmox.Utils.render_node_cpu_usage, | |
28 | }, | |
29 | { | |
30 | itemId: 'wait', | |
31 | iconCls: 'pmx-icon-size fa fa-fw fa-clock-o', | |
32 | title: gettext('IO delay'), | |
33 | valueField: 'wait', | |
34 | }, | |
35 | { | |
36 | xtype: 'box', | |
37 | colspan: 2, | |
38 | padding: '0 0 20 0', | |
39 | }, | |
40 | { | |
41 | iconCls: 'fa fa-fw pmx-itype-icon-memory pmx-icon', | |
42 | itemId: 'memory', | |
43 | title: gettext('RAM usage'), | |
44 | valueField: 'memory', | |
45 | maxField: 'memory', | |
46 | renderer: Proxmox.Utils.render_node_size_usage, | |
47 | }, | |
48 | { | |
49 | itemId: 'load', | |
50 | iconCls: 'pmx-icon-size fa fa-fw fa-tasks', | |
51 | title: gettext('Load average'), | |
52 | printBar: false, | |
53 | textField: 'loadavg', | |
54 | }, | |
55 | { | |
56 | iconCls: 'pmx-icon-size fa fa-fw fa-hdd-o', | |
57 | itemId: 'rootfs', | |
58 | title: gettext('HD space') + ' (root)', | |
59 | valueField: 'rootfs', | |
60 | maxField: 'rootfs', | |
2142eeff | 61 | renderer: ({ used, total }) => Proxmox.Utils.render_size_usage(used, total, true), |
11eae1a0 FE |
62 | }, |
63 | { | |
64 | iconCls: 'pmx-icon-size fa fa-fw fa-refresh', | |
65 | itemId: 'swap', | |
66 | printSize: true, | |
67 | title: gettext('SWAP usage'), | |
68 | valueField: 'swap', | |
69 | maxField: 'swap', | |
70 | renderer: Proxmox.Utils.render_node_size_usage, | |
71 | }, | |
72 | { | |
73 | xtype: 'box', | |
74 | colspan: 2, | |
75 | padding: '0 0 20 0', | |
76 | }, | |
77 | { | |
78 | itemId: 'cpus', | |
79 | colspan: 2, | |
80 | printBar: false, | |
81 | title: gettext('CPU(s)'), | |
82 | textField: 'cpuinfo', | |
83 | renderer: Proxmox.Utils.render_cpu_model, | |
84 | value: '', | |
85 | }, | |
86 | { | |
11eae1a0 FE |
87 | colspan: 2, |
88 | title: gettext('Kernel Version'), | |
89 | printBar: false, | |
378a1024 TL |
90 | // TODO: remove with next major and only use newish current-kernel textfield |
91 | multiField: true, | |
92 | //textField: 'current-kernel', | |
93 | renderer: ({ data }) => { | |
94 | if (!data['current-kernel']) { | |
95 | return data.kversion; | |
96 | } | |
97 | let kernel = data['current-kernel']; | |
98 | let buildDate = kernel.version.match(/\((.+)\)\s*$/)?.[1] ?? 'unknown'; | |
99 | return `${kernel.sysname} ${kernel.release} (${buildDate})`; | |
100 | }, | |
11eae1a0 FE |
101 | value: '', |
102 | }, | |
505f5d7f TL |
103 | { |
104 | colspan: 2, | |
105 | title: gettext('Boot Mode'), | |
106 | printBar: false, | |
107 | textField: 'boot-info', | |
108 | renderer: boot => { | |
109 | if (boot.mode === 'legacy-bios') { | |
110 | return 'Legacy BIOS'; | |
111 | } else if (boot.mode === 'efi') { | |
112 | return `EFI${boot.secureboot ? ' (Secure Boot)' : ''}`; | |
113 | } | |
114 | return Proxmox.Utils.unknownText; | |
115 | }, | |
116 | value: '', | |
117 | }, | |
11eae1a0 | 118 | { |
48e23079 | 119 | xtype: 'pmxNodeInfoRepoStatus', |
11eae1a0 | 120 | itemId: 'repositoryStatus', |
48e23079 FE |
121 | product: 'Proxmox Mail Gateway', |
122 | repoLink: '#pmgServerAdministration:aptrepositories', | |
11eae1a0 FE |
123 | }, |
124 | ], | |
125 | ||
126 | updateTitle: function() { | |
127 | var me = this; | |
128 | var uptime = Proxmox.Utils.render_uptime(me.getRecordValue('uptime')); | |
129 | me.setTitle(Proxmox.NodeName + ' (' + gettext('Uptime') + ': ' + uptime + ')'); | |
130 | }, | |
131 | ||
11eae1a0 FE |
132 | initComponent: function() { |
133 | let me = this; | |
134 | ||
135 | me.rstore = Ext.create('Proxmox.data.ObjectStore', { | |
136 | interval: 3000, | |
137 | url: '/api2/json/nodes/localhost/status', | |
138 | autoStart: true, | |
139 | }); | |
140 | ||
141 | me.callParent(); | |
142 | ||
143 | me.on('destroy', function() { me.rstore.stopUpdate(); }); | |
144 | }, | |
145 | }); |