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:
@@ -18,6 +18,11 @@
|
||||
* kill POST {"id": "...", "signal": "SIGKILL"}
|
||||
* rename POST {"id": "...", "name": "..."}
|
||||
* logs GET (&id=...&tail=200) -> plain text
|
||||
* events GET (&id=...&since=<unix seconds, default 7d ago>) -> array
|
||||
* of this one container's already-happened events (create,
|
||||
* start, stop, died, ...) — a bounded historical query, not a
|
||||
* live stream; see PodmanClient::containerEvents()'s own doc
|
||||
* comment for why that distinction matters here.
|
||||
* list_gpus GET -> detected AMD/Intel GPUs (/dev/dri), for the Create Container form's optional passthrough toggle
|
||||
* check_updates GET -> {"<image ref>": {"updateAvailable": bool, "error": "..."?}} for every image currently in use
|
||||
* create POST {"image": "...", "name": "...", "networkMode": "bridge"|"host"|"none"|"<custom-network-name>",
|
||||
@@ -26,7 +31,8 @@
|
||||
* "volumes": [{"kind": "named"|"path", "source": "myvol"|"/mnt/...", "containerPath": "/data"}],
|
||||
* "env": [{"key": "...", "value": "..."}], "restartPolicy": "no", "pod": "<existing-pod-name>",
|
||||
* "gpuDevices": ["/dev/dri/renderD128", "/dev/dri/card0"],
|
||||
* "privileged": false, "startAfterCreate": true}
|
||||
* "privileged": false, "startAfterCreate": true, "icon": "https://..." (optional),
|
||||
* "webuiUrl": "http://10.1.1.1:8080/" (optional)}
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -57,6 +63,15 @@ switch ($action) {
|
||||
podman_json_response(['text' => $client->containerLogs($id, $tail)]);
|
||||
break;
|
||||
|
||||
case 'events':
|
||||
$id = (string) ($_GET['id'] ?? '');
|
||||
if ($id === '') {
|
||||
podman_json_error('Missing id', 400);
|
||||
}
|
||||
$since = (int) ($_GET['since'] ?? (time() - 7 * 86400));
|
||||
podman_json_response($client->containerEvents($id, $since));
|
||||
break;
|
||||
|
||||
case 'start':
|
||||
$body = podman_read_json_body();
|
||||
$client->startContainer(require_id($body));
|
||||
@@ -278,6 +293,19 @@ function build_container_spec(string $image, array $body): array
|
||||
$spec['name'] = $name;
|
||||
}
|
||||
|
||||
$icon = trim((string) ($body['icon'] ?? ''));
|
||||
$webuiUrl = trim((string) ($body['webuiUrl'] ?? ''));
|
||||
$labels = [];
|
||||
if ($icon !== '') {
|
||||
$labels['podman-webui.icon'] = $icon;
|
||||
}
|
||||
if ($webuiUrl !== '') {
|
||||
$labels['podman-webui.weburl'] = $webuiUrl;
|
||||
}
|
||||
if ($labels !== []) {
|
||||
$spec['labels'] = $labels;
|
||||
}
|
||||
|
||||
$env = [];
|
||||
foreach (($body['env'] ?? []) as $row) {
|
||||
$key = trim((string) ($row['key'] ?? ''));
|
||||
@@ -470,6 +498,14 @@ function containers_list(PodmanClient $client): array
|
||||
'cpuPercent' => $cpuPercent,
|
||||
'memUsageBytes' => $memUsageBytes,
|
||||
'memLimitBytes' => $memLimitBytes,
|
||||
// Set at create time (see build_container_spec()) from either
|
||||
// the template it was created from or a manually-entered URL —
|
||||
// this plugin's own label, not Unraid's real Docker manager's
|
||||
// net.unraid.docker.icon (this isn't Docker, so reusing that
|
||||
// name would misleadingly imply real interop with tools that
|
||||
// read it).
|
||||
'icon' => $c['Labels']['podman-webui.icon'] ?? null,
|
||||
'webUrl' => $c['Labels']['podman-webui.weburl'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user