// SPDX-License-Identifier: GPL-3.0-or-later
/* === System view: the machine wiki ===
A complete, readable profile from the report payload — no new probes, no
new endpoints. Sections mirror how admins actually ask about a box: what
OS, what hardware, what session. Rendered on every report so the view
never goes stale behind Overview. */
function fmtGB(bytes) {
if (typeof bytes !== "number" || !Number.isFinite(bytes) || bytes <= 0) return null;
return (bytes / 1024 ** 3).toFixed(1) + " GB";
}
function systemType(sys) {
if (sys.atomicVariant) return "immutable (" + sys.atomicVariant + ")";
if (sys.imageBased || sys.immutable) return "immutable";
return "classic";
}
/* A fact row. Values that are identifiers (kernel, hostname, version, the
profile, the desktop) are mono and copyable — clicking copies, the same
delegated data-copy handler the findings use. */
function systemFactsHtml(data) {
const sys = data.system || {};
const counts = { high: 0, medium: 0, info: 0 };
for (const f of data.findings || []) counts[f.severity] = (counts[f.severity] || 0) + 1;
const fact = (k, v, opts) => {
opts = opts || {};
const val = v == null || v === "" ? "\u2014" : String(v);
const cell = opts.copy
? '"
: '" + esc(val) + "";
return '
' + k + '' + cell + "
";
};
const sub = (t, d) => '
' + t + (d ? '' + d + "" : "") + "
";
const rows = (n) => '' + n + (n === 1 ? " fact" : " facts") + "";
const group = (label, n, body) => '