Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Colour a container with no reported state by its unified status

rcourtman861d0a94b3a3
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 42fe48806c..250bf4e082 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -5534,7 +5534,9 @@ The drawer passes `touchTarget`, a 44px minimum height below `sm`; tables keep
the compact pill. The control is one `ContainerUpdateNextSteps` element created
once under the drawer's owner and reused by every rebuild of the inventory
rows, so a refresh or clock tick never recreates the button or closes its
-review dialog. "Worth checking" renders through
+review dialog. A container's row dot, State words and drawer header dot share
+`mapDockerContainerStatus`, so a degraded container with no reported state is
+amber in all three. "Worth checking" renders through
`DrawerExceptionList.tsx` directly under the alerts line, above the charts:
one compact label/value line per lifted row with the shared
`detailValueToneClass` tone, not a card per section. A guest memory reading
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 427b3cbe0e..3279b34d43 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -2395,6 +2395,11 @@ row's mapper (`mapDockerContainerStatus`), so its run state and health check
decide the colour and label in both places: a running container failing its
health check is red "Unhealthy" in the row and the header alike. Other
resources keep `getAgentStatusIndicator` on `status`.
+When a container reports no state of its own (blank counts as none), that
+mapper reads its unified status as other resources' dots do: lost contact
+(offline, error, failed, down, unreachable, disconnected, timeout) is danger,
+degraded/warning/partial/recovering is warning and unknown stays muted; a
+reported state, such as exited on a lost host, still wins.
A container's update controls read its `docker.hostSourceId`, `containerId`,
`updateStatus` and the resource's `actionReadiness` through one helper,
`getDockerContainerUpdateAction`, shared by the containers table and the
diff --git a/frontend-modern/browser-tests/proxmox-docker-rows.cjs b/frontend-modern/browser-tests/proxmox-docker-rows.cjs
index 2dc8f765b4..b4a23f462e 100644
--- a/frontend-modern/browser-tests/proxmox-docker-rows.cjs
+++ b/frontend-modern/browser-tests/proxmox-docker-rows.cjs
@@ -91,6 +91,20 @@ const observations = (mode) => [
restartCount: 0,
},
}),
+ // No container state reported: its degraded unified status must read amber.
+ base('edge-queue', 'app-container', {
+ status: 'degraded',
+ metrics: { cpu: { percent: 3 }, memory: { percent: 20 } },
+ docker: {
+ agentId: 'agent-edge',
+ hostSourceId: 'agent-edge',
+ containerId: 'native-edge-queue',
+ hostname: 'edge-long-hostname',
+ runtime: 'docker',
+ runtimeVersion: '27.5.1',
+ image: 'rabbitmq:3',
+ },
+ }),
base('nginx:latest', 'docker-image', {
docker: {
hostname: 'edge-long-hostname',
@@ -266,7 +280,7 @@ const observations = (mode) => [
timeout: 120000,
});
if (width === 390) await page.evaluate(() => document.documentElement.classList.add('dark'));
- await page.getByText('8 REST-mapped rows', { exact: true }).waitFor();
+ await page.getByText('9 REST-mapped rows', { exact: true }).waitFor();
await check(
'REST-first PMG counters and facets are present before any websocket hydration',
async () => {
@@ -402,6 +416,25 @@ const observations = (mode) => [
},
);
await capture('container-detail');
+ await check('A degraded container reads amber in its row and its drawer', async () => {
+ const row = page.locator('[data-docker-container-row="edge-queue"]');
+ const rowDot = row.locator('[title="Degraded"]').first();
+ await rowDot.waitFor();
+ if (width === 390) await row.locator('td').first().tap();
+ else await row.getByRole('button', { name: /details/i }).click();
+ const headerDot = page.getByRole('img', { name: 'Degraded' }).first();
+ await headerDot.waitFor();
+ const colours = await Promise.all(
+ [rowDot, headerDot].map((dot) =>
+ dot.evaluate((el) => getComputedStyle(el).backgroundColor),
+ ),
+ );
+ assert.equal(colours[0], colours[1], JSON.stringify(colours));
+ // Amber: strong red and green, little blue.
+ const [r, g, b] = colours[0].match(/\d+/g).map(Number);
+ assert.ok(r > 200 && g > 120 && b < 80, JSON.stringify(colours));
+ });
+ await capture('container-degraded');
await select('Images');
await check('Image verdict fits; phone hidden headers and cells are symmetric', async () => {
const table = page.getByRole('region', { name: 'Image table' });
diff --git a/frontend-modern/browser-verification/d2a970332ad02def.json b/frontend-modern/browser-verification/d2a970332ad02def.json
new file mode 100644
index 0000000000..05554fcc46
--- /dev/null
+++ b/frontend-modern/browser-verification/d2a970332ad02def.json
@@ -0,0 +1,35 @@
+{
+ "version": 1,
+ "base_sha": "e787ca857d82f793242211dc18c5c881b7a82d6b",
+ "verified_at": "2026-10-14T14:29:40Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/docker/dockerPageModel.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/docker/dockerPageModel.ts": "4ba0f40ecaee1409f93fde377919e8d834f2d3909281c6903f2ad54d0a4e2e39"
+ },
+ "routes": [
+ "browser-tests/proxmox-docker-rows.html (production DockerContainersTable and ResourceDetailDrawer, Chromium via Playwright 1.56.1 on pulse-dev)"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "container with no reported state and status degraded: row dot, State \"Degraded\" and drawer header dot all amber (old mapper: grey)",
+ "Worth checking lifts \"Observed state: Degraded\"",
+ "exited container on an offline host stays muted \"Exited\"",
+ "unhealthy and update-available containers unchanged",
+ "reviewed by Sol from the desktop and phone screenshots"
+ ],
+ "interactions": [
+ "row expand by pointer (desktop) and tap (phone)"
+ ]
+}
diff --git a/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage.test.ts b/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage.test.ts
index 2c8d05c9cb..acc1140e00 100644
--- a/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage.test.ts
+++ b/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage.test.ts
@@ -108,6 +108,55 @@ describe('mapDockerContainerStatus — state fallbacks', () => {
).toEqual({ variant: 'muted', label });
});
+ it.each([
+ ['offline', 'danger', 'Offline'],
+ ['disconnected', 'danger', 'Disconnected'],
+ ['degraded', 'warning', 'Degraded'],
+ ['warning', 'warning', 'Warning'],
+ ['unknown', 'muted', 'Unknown'],
+ ['stopped', 'muted', 'Stopped'],
+ ] as const)(
+ 'reads a %s status as other resources do when no container state is reported',
+ (status, variant, label) => {
+ expect(
+ mapDockerContainerStatus(
+ makeResource({
+ id: `c-status-${status}`,
+ type: 'app-container',
+ status: status as Resource['status'],
+ docker: {},
+ }),
+ ),
+ ).toEqual({ variant, label });
+ },
+ );
+
+ it('treats a blank reported state as no report and falls back to the status', () => {
+ expect(
+ mapDockerContainerStatus(
+ makeResource({
+ id: 'c-blank-degraded',
+ type: 'app-container',
+ status: 'degraded',
+ docker: { containerState: ' ' },
+ }),
+ ),
+ ).toEqual({ variant: 'warning', label: 'Degraded' });
+ });
+
+ it("keeps the container's own reported state ahead of its unified status", () => {
+ expect(
+ mapDockerContainerStatus(
+ makeResource({
+ id: 'c-exited-offline',
+ type: 'app-container',
+ status: 'offline',
+ docker: { containerState: 'exited' },
+ }),
+ ),
+ ).toEqual({ variant: 'muted', label: 'Exited' });
+ });
+
it('treats removing as a fatal state with a title-cased label', () => {
expect(
mapDockerContainerStatus(
diff --git a/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts b/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts
index 52acda32a8..efc0bbb8d6 100644
--- a/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts
+++ b/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts
@@ -1138,3 +1138,24 @@ describe('dockerContainerPortsCompactSummary', () => {
).toBe('—');
});
});
+
+describe('container status without a reported container state', () => {
+ // The row dot, the State words and the drawer header all read this verdict,
+ // so a degraded or lost container must not fall back to a neutral grey.
+ it('reads the unified status as other resources do', () => {
+ const container = (status: string, containerState?: string) =>
+ mapDockerContainerStatus(
+ makeResource({
+ id: `c-${status}-${containerState ?? 'none'}`,
+ type: 'app-container',
+ status: status as Resource['status'],
+ docker: containerState === undefined ? {} : { containerState },
+ }),
+ );
+ expect(container('degraded')).toEqual({ variant: 'warning', label: 'Degraded' });
+ expect(container('offline')).toEqual({ variant: 'danger', label: 'Offline' });
+ expect(container('unknown')).toEqual({ variant: 'muted', label: 'Unknown' });
+ // A reported state still wins, so a cleanly exited container on a lost host stays muted.
+ expect(container('offline', 'exited')).toEqual({ variant: 'muted', label: 'Exited' });
+ });
+});
diff --git a/frontend-modern/src/features/docker/dockerPageModel.ts b/frontend-modern/src/features/docker/dockerPageModel.ts
index 6db2579733..dda1ffa63f 100644
--- a/frontend-modern/src/features/docker/dockerPageModel.ts
+++ b/frontend-modern/src/features/docker/dockerPageModel.ts
@@ -79,6 +79,18 @@ const FATAL_CONTAINER_STATES = new Set(['dead', 'removing', 'oomkilled']);
// problem. Pulse should surface these as muted, not as success or danger.
const STOPPED_CONTAINER_STATES = new Set(['created', 'paused', 'stopped', 'exited']);
+// Unified statuses that stand in when a container reports no state of its own.
+const CONTAINER_LOST_STATUSES = new Set([
+ 'offline',
+ 'error',
+ 'failed',
+ 'down',
+ 'unreachable',
+ 'disconnected',
+ 'timeout',
+]);
+const CONTAINER_DEGRADED_STATUSES = new Set(['degraded', 'warning', 'partial', 'recovering']);
+
const normalizeDockerToken = (value: unknown): string =>
typeof value === 'string'
? value
@@ -97,7 +109,9 @@ const dockerDisplayName = (resource: Resource): string =>
// Docker's own container state, or the unified resource status when an agent
// did not report one; "online" there means the container is running.
export const dockerContainerRunState = (resource: Resource): string => {
- const state = normalizeDockerToken(resource.docker?.containerState || resource.status);
+ // A blank reported state is no report: fall back to the unified status.
+ const state =
+ normalizeDockerToken(resource.docker?.containerState) || normalizeDockerToken(resource.status);
return state === 'online' ? 'running' : state;
};
@@ -128,6 +142,15 @@ export function mapDockerContainerStatus(resource: Resource): StatusIndicator {
if (STOPPED_CONTAINER_STATES.has(state)) {
return { variant: 'muted', label: titleCase(state) };
}
+ // With no container state reported, the unified status stands in, read as
+ // every other resource's dot reads it: lost contact is danger, a degraded
+ // or warning status is warning. Unknown stays muted.
+ if (!normalizeDockerToken(resource.docker?.containerState)) {
+ if (CONTAINER_LOST_STATUSES.has(state)) return { variant: 'danger', label: titleCase(state) };
+ if (CONTAINER_DEGRADED_STATUSES.has(state)) {
+ return { variant: 'warning', label: titleCase(state) };
+ }
+ }
if (!state) return { variant: 'muted', label: 'Unknown' };
return { variant: 'muted', label: titleCase(state) };
}