/** * javascript/dashboard.js * * Dashboard panel: summary stat tiles fed by ajax/system.php?action=summary. * The Activity list and the CPU/Memory sparkline in the mockup were * illustrative sample data with no backing API (libpod has no "recent * events for a container fleet" convenience endpoint beyond raw * /events streaming, which is a separate follow-up — see the note * rendered in place of it below) — rather than fake data pretending to be * live, this real implementation shows what's genuinely available now * (the summary counts) and a clear placeholder for what needs the events * stream, so nobody mistakes a mock for a working feature. */ (function () { 'use strict'; const P = window.Podman; function render(summary) { if (!summary.reachable) { P.el('podman-panel-dashboard').innerHTML = '
' + 'Cannot reach the Podman API socket (' + P.escapeHtml(summary.socketPath) + '). ' + 'Is rc.podman running? Try rc.podman status from a terminal.' + '
'; return; } P.el('stat-running').textContent = summary.containers.running; P.el('stat-running-total').textContent = '/ ' + summary.containers.total; P.el('stat-pods').textContent = summary.pods; P.el('stat-images').textContent = summary.images; P.el('stat-volumes').textContent = summary.volumes; P.el('stat-networks').textContent = summary.networks; P.el('stat-images-size').textContent = summary.storage.imagesSizeFormatted; const meta = P.el('podman-header-meta'); if (meta) { meta.innerHTML = ' podman.sock connected' + (summary.podmanVersion ? ' · v' + P.escapeHtml(summary.podmanVersion) : '') + ' · ' + summary.containers.running + ' of ' + summary.containers.total + ' containers running'; } } function load() { return P.get('system', 'summary').then(render).catch(function (err) { P.el('podman-panel-dashboard').innerHTML = '
' + P.escapeHtml(err.message) + '
'; }); } P.registerPanel('dashboard', { init: load, refresh: load }); })();