pikvm/pikvm#1347: added CPU and MEM to /api/info

This commit is contained in:
Maxim Devaev
2024-07-08 04:34:32 +03:00
parent 01fff2c7a9
commit eb1eb527f8
3 changed files with 54 additions and 6 deletions

View File

@@ -132,7 +132,7 @@ export function Session() {
if (__info_hw_state !== null) {
html += `
Platform:
${__formatPlatform(__info_hw_state.platform)}
${__formatMisc(__info_hw_state)}
<hr>
Temperature:
${__formatTemp(__info_hw_state.health.temp)}
@@ -153,8 +153,13 @@ export function Session() {
$("about-hardware").innerHTML = html;
};
var __formatPlatform = function(state) {
return __formatUl([["Base", state.base], ["Serial", state.serial]]);
var __formatMisc = function(state) {
return __formatUl([
["Base", state.platform.base],
["Serial", state.platform.serial],
["CPU", `${state.health.cpu.percent}%`],
["MEM", `${state.health.mem.percent}%`],
]);
};
var __formatFan = function(state) {