-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathproxmoxlib.js.patch
97 lines (87 loc) · 3.1 KB
/
proxmoxlib.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
diff --git a/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js b/../proxmoxlib.js
index 631a0a9..3fb21ae 100644
--- a/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
+++ b/../proxmoxlib.js
@@ -1027,40 +1027,44 @@ utilities: {
if (!Ext.isNumeric(value)) {
return '';
}
return Proxmox.Utils.format_size(value);
},
render_cpu_model: function(cpu) {
let socketText = cpu.sockets > 1 ? gettext('Sockets') : gettext('Socket');
return `${cpu.cpus} x ${cpu.model} (${cpu.sockets.toString()} ${socketText})`;
},
/* this is different for nodes */
render_node_cpu_usage: function(value, record) {
return Proxmox.Utils.render_cpu_usage(value, record.cpus);
},
render_node_size_usage: function(record) {
return Proxmox.Utils.render_size_usage(record.used, record.total);
},
+ render_node_temp: function(record) {
+ return record.used.toFixed(1) + '°C (crit: ' + record.total.toFixed(1) + '°C)';
+ },
+
loadTextFromFile: function(file, callback, maxBytes) {
let maxSize = maxBytes || 8192;
if (file.size > maxSize) {
Ext.Msg.alert(gettext('Error'), gettext("Invalid file size: ") + file.size);
return;
}
let reader = new FileReader();
reader.onload = evt => callback(evt.target.result);
reader.readAsText(file);
},
parsePropertyString: function(value, defaultKey) {
var res = {},
error;
if (typeof value !== 'string' || value === '') {
return res;
}
Ext.Array.each(value.split(','), function(p) {
@@ -1467,44 +1471,45 @@ Ext.define('Proxmox.Async', {
// response on failure
api2: function(reqOpts) {
return new Promise((resolve, reject) => {
delete reqOpts.callback; // not allowed in this api
reqOpts.success = response => resolve(response);
reqOpts.failure = response => reject(response);
Proxmox.Utils.API2Request(reqOpts);
});
},
// Delay for a number of milliseconds.
sleep: function(millis) {
return new Promise((resolve, _reject) => setTimeout(resolve, millis));
},
});
Ext.override(Ext.data.Store, {
// If the store's proxy is changed while it is waiting for an AJAX
// response, `onProxyLoad` will still be called for the outdated response.
// To avoid displaying inconsistent information, only process responses
- // belonging to the current proxy.
+ // belonging to the current proxy. However, do not apply this workaround
+ // to the mobile UI, as Sencha Touch has an incompatible internal API.
onProxyLoad: function(operation) {
let me = this;
- if (operation.getProxy() === me.getProxy()) {
+ if (Proxmox.Utils.toolkit === 'touch' || operation.getProxy() === me.getProxy()) {
me.callParent(arguments);
} else {
console.log(`ignored outdated response: ${operation.getRequest().getUrl()}`);
}
},
});
Ext.define('Proxmox.Schema', { // a singleton
singleton: true,
authDomains: {
pam: {
name: 'Linux PAM',
add: false,
edit: false,
pwchange: true,
sync: false,
},
openid: {
name: gettext('OpenID Connect Server'),
ipanel: 'pmxAuthOpenIDPanel',