-
Notifications
You must be signed in to change notification settings - Fork 12
/
pvemanager-mobile.js.patch
175 lines (156 loc) · 4.57 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
175
diff --git a/usr/share/pve-manager/touch/pvemanager-mobile.js b/../pvemanager-mobile.js
index 9f55939..0f2710c 100644
--- a/usr/share/pve-manager/touch/pvemanager-mobile.js
+++ b/../pvemanager-mobile.js
@@ -3749,56 +3749,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>NVMe temp:</td><td>{[this.nvmetemp(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>',
+ '<tr><td>HD3 temp:</td><td>{[this.hd3temp(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); },
+ nvmetemp: function(values) { return this.rendertemp(values.nvmetemp); },
+ hd1temp: function(values) { return this.rendertemp(values.hd1temp); },
+ hd2temp: function(values) { return this.rendertemp(values.hd2temp); },
+ hd3temp: function(values) { return this.rendertemp(values.hd3temp); }
}
]
},
});
Ext.define('PVE.NodeSummary', {
extend: 'PVE.Page',
alias: 'widget.pveNodeSummary',
statics: {
pathMatch: function(loc) {
return loc.match(/^nodes\/([^\s\/]+)$/);
}
},
nodename: undefined,
config: {
items: [
{
@@ -3896,60 +3914,86 @@ Ext.define('PVE.NodeSummary', {
});
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', {