// panes/system.js — /api/version + /api/system.
import { registerPane } from '../app.js';
import { jget, formatUptime } from '../lib/api.js';
import { fmtJSON } from '../lib/ui.js';
const TPL = `
System
Process introspection.
`;
async function load(host) {
try {
const [v, s] = await Promise.all([jget('/api/version'), jget('/api/system')]);
host.querySelector('#sys-v').textContent = fmtJSON(v);
host.querySelector('#sys-s').textContent = fmtJSON(s);
if (s.uptime_seconds != null) host.querySelector('#sys-up').textContent = formatUptime(s.uptime_seconds);
} catch (e) {
host.querySelector('#sys-v').textContent = 'error: ' + e.message;
}
}
registerPane('system', {
label: 'System',
init(host) {
host.innerHTML = TPL;
host.querySelector('#sys-refresh').addEventListener('click', () => load(host));
load(host);
},
refresh: load,
});