Rework Dashboard, add toasts, container folders/icons/WebUI links, detail tabs
Dashboard: - Plain-count stat tiles (Running/Stopped/Pods/Images/Volumes/Networks) separated from a single "Resource Usage" card (CPU/Memory/Swap/Storage meter rows) instead of forcing both into one tile grid, which produced awkward spanning-tile/dead-cell layouts. - Fixed CPU usage never changing (libpod's own cpuUtilization is computed once and never resampled) by computing it from /proc/stat deltas instead. - Fixed memory usage reading far too high by using /proc/meminfo's MemAvailable instead of libpod's raw (non-reclaimable-aware) memFree. - Added an Autostart Queue table reusing podman-autostart.sh's own failure-counter files. - Dashboard and Containers now auto-refresh every ~2s (paused when the tab is hidden or a modal is open). Toasts: - Real success/warn/error/info toast notifications replacing every alert() used for one-way feedback, across every panel. Container detail modal: - 5 new tabs: Resources, Logs, Console, Events, Healthcheck. Containers panel: - Folders to group containers (name + icon), stored in the plugin's own folders.json — a folder's header always shows an icon+name+status chip per member, matching Unraid's own Docker page folders. "Move to Folder" becomes "Remove from Folder" once a container is already grouped. - Containers can carry an icon URL and a WebUI URL (small button next to the name), both stored as container labels and auto-filled from templates where applicable. - Settings: an "Add container" control for the Autostart order table. Fixes: - Context menus now measure their own rendered size and flip above the anchor when there isn't room below, instead of running off-screen. - Containers table now uses table-layout:fixed with explicit column widths — auto layout was shifting every column (and the header) on every folder expand/collapse, and briefly again when a flex wrapper was mistakenly placed directly on a <td>. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,41 @@ final class PodmanClient
|
||||
return self::demuxStream($raw);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /events?stream=false&since=...&filters={"container":["<id>"]} —
|
||||
* a bounded, already-happened event history for one container, NOT a
|
||||
* live stream (stream=false makes libpod return what already matched
|
||||
* and close the connection immediately, verified live). This is
|
||||
* enough for a container's "Events" detail tab without needing the
|
||||
* persistent-connection event-streaming infrastructure a live,
|
||||
* fleet-wide event feed would require (see dashboard.js's own header
|
||||
* comment on why that's out of scope for now).
|
||||
*
|
||||
* @return array<int,array<string,mixed>>
|
||||
*/
|
||||
public function containerEvents(string $id, int $sinceUnixSeconds): array
|
||||
{
|
||||
$query = [
|
||||
'stream' => 'false',
|
||||
'since' => (string) $sinceUnixSeconds,
|
||||
'filters' => json_encode(['container' => [$id]]),
|
||||
];
|
||||
$raw = $this->requestRaw('GET', '/events', $query);
|
||||
// Newline-delimited JSON, not a single JSON array — each line is
|
||||
// its own event object.
|
||||
$events = [];
|
||||
foreach (explode("\n", trim($raw)) as $line) {
|
||||
if ($line === '') {
|
||||
continue;
|
||||
}
|
||||
$decoded = json_decode($line, true);
|
||||
if (is_array($decoded)) {
|
||||
$events[] = $decoded;
|
||||
}
|
||||
}
|
||||
return $events;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Exec — see webui/plugins/podman/ajax/exec.php for the important
|
||||
// caveat: this implements one-shot "run a command, return its output"
|
||||
|
||||
Reference in New Issue
Block a user