-
Notifications
You must be signed in to change notification settings - Fork 11
/
pvemanager-mobile.js.patch
174 lines (156 loc) · 4.61 KB
/
pvemanager-mobile.js.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
diff --git a/usr/share/pve-manager/touch/pvemanager-mobile.js b/../pvemanager-mobile.js
index d19b4f8..716650f 100644
--- a/usr/share/pve-manager/touch/pvemanager-mobile.js
+++ b/../pvemanager-mobile.js
@@ -5165,56 +5165,74 @@ Ext.define('PVE.Datacenter', {
me.reload();
},
});
Ext.define('PVE.NodeInfo', {
extend: 'Ext.Component',
alias: 'widget.pveNodeInfo',
config: {
style: 'background-color: white;',
styleHtmlContent: true,
data: [],
tpl: [
'<table style="margin-bottom:0px;">',
'<tr><td>Version:</td><td>{pveversion}</td></tr>',
'<tr><td>Memory:</td><td>{[this.meminfo(values)]}</td></tr>',
'<tr><td>CPU:</td><td>{[this.cpuinfo(values)]}</td></tr>',
'<tr><td>Uptime:</td><td>{[Proxmox.Utils.format_duration_long(values.uptime)]}</td></tr>',
+ '<tr><td>CPU temp:</td><td>{[this.cputemp(values)]}</td></tr>',
+ '<tr><td>PCH temp:</td><td>{[this.pchtemp(values)]}</td></tr>',
+ '<tr><td>NVMe1 temp:</td><td>{[this.nvme1temp(values)]}</td></tr>',
+ '<tr><td>NVMe2 temp:</td><td>{[this.nvme2temp(values)]}</td></tr>',
+ '<tr><td>HD1 temp:</td><td>{[this.hd1temp(values)]}</td></tr>',
+ '<tr><td>HD2 temp:</td><td>{[this.hd2temp(values)]}</td></tr>',
'</table>',
{
meminfo: function(values) {
var d = values.memory;
if (!d) {
return '-';
}
return Proxmox.Utils.format_size(d.used || 0) + " of " + Proxmox.Utils.format_size(d.total);
},
cpuinfo: function(values) {
if (!values.cpuinfo) {
return '-';
}
var per = values.cpu * 100;
return per.toFixed(2) + "% (" + values.cpuinfo.cpus + " CPUs)";
},
+ rendertemp: function(temp) {
+ if (!temp) {
+ return '-';
+ }
+ return temp.used.toFixed(1) + '°C (crit: ' + temp.total.toFixed(1) + '°C)';
+ },
+ cputemp: function(values) { return this.rendertemp(values.cputemp); },
+ pchtemp: function(values) { return this.rendertemp(values.pchtemp); },
+ nvme1temp: function(values) { return this.rendertemp(values.nvme1temp); },
+ nvme2temp: function(values) { return this.rendertemp(values.nvme2temp); },
+ hd1temp: function(values) { return this.rendertemp(values.hd1temp); },
+ hd2temp: function(values) { return this.rendertemp(values.hd2temp); },
},
],
},
});
Ext.define('PVE.NodeSummary', {
extend: 'PVE.Page',
alias: 'widget.pveNodeSummary',
statics: {
pathMatch: function(loc) {
return loc.match(/^nodes\/([^\s/]+)$/);
},
},
nodename: undefined,
config: {
items: [
{
@@ -5311,60 +5329,86 @@ Ext.define('PVE.NodeSummary', {
failure: error_handler,
});
Proxmox.Utils.API2Request({
url: '/nodes/' + me.nodename + '/qemu',
method: 'GET',
success: function(response) {
var d = response.result.data;
d.forEach(function(el) { el.type = 'qemu'; el.nodename = me.nodename; });
me.store.each(function(rec) {
if (rec.get('type') === 'qemu') {
rec.destroy();
}
});
me.store.add(d);
},
failure: error_handler,
});
},
+ autoRefreshTask: null,
+ setMenuItems: function() {
+ var me = this;
+ if (me.autoRefreshTask === null) {
+ var refreshButton = {
+ text: gettext('Enable Auto-refresh'),
+ handler: function() {
+ me.autoRefreshTask = setInterval(function() { me.reload(); }, 3000);
+ me.setMenuItems();
+ }
+ }
+ } else {
+ var refreshButton = {
+ text: gettext('Disable Auto-refresh'),
+ handler: function() {
+ clearInterval(me.autoRefreshTask);
+ me.autoRefreshTask = null;
+ me.setMenuItems();
+ }
+ }
+ };
+
+ me.down('pveMenuButton').setMenuItems([
+ {
+ text: gettext('Tasks'),
+ handler: function() {
+ PVE.Workspace.gotoPage('nodes/' + me.nodename + '/tasks');
+ },
+ },
+ refreshButton,
+ ]);
+ },
+
initialize: function() {
var me = this;
var match = me.self.pathMatch(me.getAppUrl());
if (!match) {
throw "pathMatch failed";
}
me.nodename = match[1];
me.down('titlebar').setTitle(gettext('Node') + ': ' + me.nodename);
- me.down('pveMenuButton').setMenuItems([
- {
- text: gettext('Tasks'),
- handler: function() {
- PVE.Workspace.gotoPage('nodes/' + me.nodename + '/tasks');
- },
- },
- ]);
+ me.setMenuItems();
me.store = Ext.create('Ext.data.Store', {
fields: ['name', 'vmid', 'nodename', 'type', 'memory', 'uptime', 'mem', 'maxmem', 'cpu', 'cpus'],
sorters: ['vmid'],
grouper: {
groupFn: function(record) {
return record.get('type');
},
},
});
var list = me.down('list');
list.setStore(me.store);
me.reload();
this.callParent();
},
});
Ext.define('PVE.MigrateBase', {