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.

Name Swarm rollouts truly and colour the cells behind each dot

rcourtman3a7304d62696
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b7a85f461b..e30a63f818 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -5561,7 +5561,9 @@ amber or red count. Docker State words read in their row dot's colour through
`dockerStateTextToneClass` (`DockerNativeTableShared.tsx`) with no second dot;
the Docker Networks row's single name-cell dot carries its attached-container
verdict the same way, and each attached-container card's state words take its
-dot's tone through the same helper. "Worth checking" renders through
+dot's tone through the same helper. The Swarm tables follow it too: the cell
+behind a service, task or node dot's verdict (Running count and Update words,
+Current state, Reachability or Availability) reads in that dot's tone. "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 425be7099c..c12204766e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -7041,7 +7041,14 @@ host name and the Update control render whole; the percentage-only CPU and
memory bars yield the difference. Swarm services show the rollout state as
words ("Rollback started") with the raw token, message and completion time in
the title, and Swarm tasks show Started as an age with the RFC3339 stamp in
-the title, matching every other platform table's time cells.
+the title, matching every other platform table's time cells. A service's dot
+names Docker's mid-change update states as themselves ("Update paused",
+"Rolling back", "Rollback paused"; `rollback_started` used to read "Rollback
+paused"), and no replicas running outranks a rollout. The cell behind each
+Swarm dot's verdict reads in its tone: a service's Running count (with
+"/desired" on phones, where Desired is hidden) and its Update words, a task's
+Current state (the dot's own word, Docker's token and error on hover and the
+error in the expansion), a node's Reachability or Availability.
The containers table's State cell says what `docker ps` would flag, through
`dockerContainerStatePresentation.ts` over `mapDockerContainerStatus`, so the
row dot and the words agree: Unhealthy and Starting for a running container's
diff --git a/frontend-modern/browser-tests/proxmox-docker-rows.cjs b/frontend-modern/browser-tests/proxmox-docker-rows.cjs
index 6a4a2b3d67..224967a3e9 100644
--- a/frontend-modern/browser-tests/proxmox-docker-rows.cjs
+++ b/frontend-modern/browser-tests/proxmox-docker-rows.cjs
@@ -622,10 +622,41 @@ const observations = (mode) => [
const started = page.locator('[title="2026-10-03T11:30:00.123456Z"]');
await started.waitFor({ state: 'attached' });
assert.match(await started.innerText(), /ago/);
- await page
+ const taskState = page
.getByRole('region', { name: 'Swarm tasks' })
- .getByTitle('running', { exact: true })
- .waitFor();
+ .locator('[data-docker-task-state]');
+ await taskState.waitFor({ state: 'attached' });
+ // Current reads the task dot's own word; Docker's token stays on hover.
+ assert.equal(await taskState.textContent(), 'Running');
+ assert.equal(await taskState.getAttribute('title'), 'running');
+ // The service dot names the rollout, and the cells behind its verdict
+ // read in its amber: the Update words and the short Running count.
+ const serviceRow = page.locator('[data-docker-service-row="web-service"]');
+ const amber = (colour) => {
+ const [r, g, b] = colour.match(/\d+/g).map(Number);
+ return r > 150 && g > 70 && b < 80;
+ };
+ const colourOf = (locator) =>
+ locator.evaluate((el) =>
+ getComputedStyle(el).backgroundColor === 'rgba(0, 0, 0, 0)'
+ ? getComputedStyle(el).color
+ : getComputedStyle(el).backgroundColor,
+ );
+ const dot = serviceRow.locator('[title="Rolling back"]').first();
+ await dot.waitFor();
+ const running = serviceRow.locator('[data-docker-service-running="warning"]');
+ // A phone hides Desired, so the count reads out of what.
+ assert.equal(
+ (await running.innerText()).replace(/\s+/g, ''),
+ width === 390 ? '2/4' : '2',
+ );
+ for (const colour of [
+ await colourOf(dot),
+ await colourOf(state),
+ await colourOf(serviceRow.locator('[data-docker-service-running="warning"]')),
+ ]) {
+ assert.ok(amber(colour), colour);
+ }
},
);
await capture('swarm');
diff --git a/frontend-modern/browser-verification/20ac4e8d982e49fa.json b/frontend-modern/browser-verification/20ac4e8d982e49fa.json
new file mode 100644
index 0000000000..0c46bd585d
--- /dev/null
+++ b/frontend-modern/browser-verification/20ac4e8d982e49fa.json
@@ -0,0 +1,41 @@
+{
+ "version": 1,
+ "base_sha": "fcc3e695f364602a2a13301a676567f9115d2ffc",
+ "verified_at": "2026-10-14T18:56:31Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/docker/DockerServicesTable.tsx",
+ "frontend-modern/src/features/docker/DockerSwarmNodesTable.tsx",
+ "frontend-modern/src/features/docker/DockerTasksTable.tsx",
+ "frontend-modern/src/features/docker/dockerPageModel.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/docker/DockerServicesTable.tsx": "0122db89daafd9dea33862058f37825215560ecadc1e788cad11fbe3196f97b4",
+ "frontend-modern/src/features/docker/DockerSwarmNodesTable.tsx": "eaae93d27b96f4ddc569cc258b873d886b8a3458cafae27bd3ce27650e281530",
+ "frontend-modern/src/features/docker/DockerTasksTable.tsx": "e845a67b63430b7191cfd6baf5abbe159169e95e025c7e0741a572be002548c6",
+ "frontend-modern/src/features/docker/dockerPageModel.ts": "4a7f741943d8509ed8e57f2ca4f59c27ff3f3d4e2e4f388f3b68c8d1219fa30a"
+ },
+ "routes": [
+ "browser-tests/proxmox-docker-rows.html Swarm view (production DockerServicesTable and DockerTasksTable over REST-mapped rows, Chromium and WebKit via Playwright 1.56.1 on pulse-dev, tree built on origin/main)"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "service with 2 of 4 replicas and rollback_started: amber dot titled \"Rolling back\" (old title: \"Rollback paused\"), Update words and Running count amber",
+ "phone: Running reads \"2/4\" in amber with Desired hidden",
+ "task: Current reads \"Running\" (Docker's token on hover), Desired reads \"Running\"",
+ "Swarm node Reachability and Availability tones covered by unit tests (no node fixture in the page)",
+ "reviewed by Sol from desktop and phone screenshots; its title-case, 2/4 and task-error points applied"
+ ],
+ "interactions": [
+ "service row disclosure by keyboard (desktop) and tap (phone)"
+ ]
+}
diff --git a/frontend-modern/src/features/docker/DockerServicesTable.tsx b/frontend-modern/src/features/docker/DockerServicesTable.tsx
index 907c04d6f2..4877a56def 100644
--- a/frontend-modern/src/features/docker/DockerServicesTable.tsx
+++ b/frontend-modern/src/features/docker/DockerServicesTable.tsx
@@ -23,11 +23,13 @@ import {
createPlatformResourceDetailState,
getPlatformResourceDetailRowClass,
} from '@/features/platformPage/PlatformResourceDetailTableRow';
-import { DockerNativeDetailPanel } from './DockerNativeTableShared';
+import { DockerNativeDetailPanel, dockerStateTextToneClass } from './DockerNativeTableShared';
import type { Resource } from '@/types/resource';
import {
compareDockerServices,
+ dockerServiceReplicaStatus,
dockerServiceStack,
+ dockerServiceUpdateAttention,
filterDockerResources,
mapDockerServiceStatus,
type DockerResourceStatusFilter,
@@ -301,6 +303,15 @@ export const DockerServicesTable: Component<{
const host = () => asTrimmedString(service.docker?.hostname) || '—';
const indicator = () => mapDockerServiceStatus(service);
const update = () => formatServiceUpdate(service.docker?.serviceUpdate);
+ // The cell behind the dot's verdict reads in its colour: the
+ // Running count when replicas are missing, the Update words
+ // when a rollout is paused or rolling back.
+ const runningTone = () =>
+ dockerStateTextToneClass(dockerServiceReplicaStatus(service).variant);
+ const updateTone = () =>
+ dockerStateTextToneClass(
+ dockerServiceUpdateAttention(service)?.variant ?? null,
+ );
const detailRowId = () => drawer.detailRowId(service);
const isExpanded = () => drawer.isExpanded(service);
return (
@@ -352,16 +363,24 @@ export const DockerServicesTable: Component<{
<PlatformTableNumberValue value={service.docker?.desiredTasks ?? 0} />
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}
+ class={`${getPlatformTableCellClassForKind('numeric-value')} ${runningTone() || 'text-base-content'}`}
+ data-docker-service-running={
+ dockerServiceReplicaStatus(service).variant
+ }
>
<PlatformTableNumberValue value={service.docker?.runningTasks ?? 0} />
+ {/* A phone hides Desired, so the count says out of what. */}
+ <span class="platform-table-phone-only-inline tabular-nums">
+ /{service.docker?.desiredTasks ?? 0}
+ </span>
</TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('text')} text-base-content`}
>
<span
- class="block whitespace-normal wrap-break-word leading-3 md:truncate md:leading-normal"
+ class={`block whitespace-normal wrap-break-word leading-3 md:truncate md:leading-normal ${updateTone()}`}
title={update().title}
+ data-docker-service-update-tone={updateTone() ? 'warning' : 'none'}
>
{update().label}
</span>
diff --git a/frontend-modern/src/features/docker/DockerSwarmNodesTable.tsx b/frontend-modern/src/features/docker/DockerSwarmNodesTable.tsx
index 6609f082b0..5e0e52ff09 100644
--- a/frontend-modern/src/features/docker/DockerSwarmNodesTable.tsx
+++ b/frontend-modern/src/features/docker/DockerSwarmNodesTable.tsx
@@ -27,6 +27,7 @@ import {
dockerByteValue,
dockerCpuValue,
dockerResourceName,
+ dockerStateTextToneClass,
dockerTextValue,
type DockerNativeTableProps,
} from './DockerNativeTableShared';
@@ -226,6 +227,18 @@ export const DockerSwarmNodesTable: Component<DockerNativeTableProps> = (props)
dockerTextValue(
resource.docker?.leader ? 'leader' : resource.docker?.managerReachability,
);
+ // The cell behind the dot's verdict reads in its colour: an
+ // unreachable manager in Reachability, a drained or paused
+ // node in Availability.
+ const verdict = () => mapDockerSwarmNodeStatus(resource);
+ const reachabilityTone = () =>
+ verdict().label === 'Manager unreachable'
+ ? dockerStateTextToneClass(verdict().variant)
+ : '';
+ const availabilityTone = () =>
+ verdict().label === 'Drained' || verdict().label === 'Paused'
+ ? dockerStateTextToneClass(verdict().variant)
+ : '';
const detailRowId = () => drawer.detailRowId(resource);
const isExpanded = () => drawer.isExpanded(resource);
@@ -238,7 +251,7 @@ export const DockerSwarmNodesTable: Component<DockerNativeTableProps> = (props)
>
<DockerResourceNameCell
resource={resource}
- indicator={mapDockerSwarmNodeStatus(resource)}
+ indicator={verdict()}
detailToggle={
<PlatformResourceDetailToggleButton
expanded={isExpanded()}
@@ -254,12 +267,15 @@ export const DockerSwarmNodesTable: Component<DockerNativeTableProps> = (props)
{dockerTextValue(resource.docker?.nodeRole)}
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('text')} platform-table-phone-hidden text-base-content`}
+ class={`${getPlatformTableCellClassForKind('text')} platform-table-phone-hidden ${availabilityTone() || 'text-base-content'}`}
>
{dockerTextValue(resource.docker?.availability)}
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('text')} text-base-content`}
+ class={`${getPlatformTableCellClassForKind('text')} ${reachabilityTone() || 'text-base-content'}`}
+ data-docker-node-reachability-tone={
+ reachabilityTone() ? 'danger' : 'none'
+ }
>
{managerReachability()}
</TableCell>
diff --git a/frontend-modern/src/features/docker/DockerTasksTable.tsx b/frontend-modern/src/features/docker/DockerTasksTable.tsx
index 10be8b87a6..d9d49472a8 100644
--- a/frontend-modern/src/features/docker/DockerTasksTable.tsx
+++ b/frontend-modern/src/features/docker/DockerTasksTable.tsx
@@ -2,6 +2,7 @@ import { Show, createMemo, type Component } from 'solid-js';
import { TableCell, TableRow } from '@/components/shared/Table';
import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';
import { asTrimmedString } from '@/utils/stringUtils';
+import { titleCaseDelimitedLabel } from '@/utils/textPresentation';
import {
PlatformWindowedRows,
PLATFORM_HEALTH_FILTER_OPTIONS,
@@ -27,6 +28,7 @@ import {
DockerResourceNameCell,
dockerNumberValue,
dockerResourceName,
+ dockerStateTextToneClass,
dockerTextValue,
type DockerNativeTableProps,
} from './DockerNativeTableShared';
@@ -75,6 +77,17 @@ const getDockerTaskSortValue = (
}
};
+// Why a task failed or what Docker last said about it, for a phone that
+// cannot hover the Current cell.
+const taskReasonFields = (resource: Resource): (readonly [string, string])[] => {
+ const fields: (readonly [string, string])[] = [];
+ const error = asTrimmedString(resource.docker?.error);
+ const message = asTrimmedString(resource.docker?.message);
+ if (error) fields.push(['Error', error]);
+ if (message) fields.push(['Message', message]);
+ return fields;
+};
+
export const DockerTasksTable: Component<DockerNativeTableProps> = (props) => {
const tableState = createPlatformTableFilterState({
resources: () => props.resources,
@@ -232,20 +245,30 @@ export const DockerTasksTable: Component<DockerNativeTableProps> = (props) => {
<TableCell
class={`${getPlatformTableCellClassForKind('text')} platform-table-phone-hidden text-base-content`}
>
- {dockerTextValue(resource.docker?.desiredState)}
+ {/* Read as words beside Current; Docker's token on hover. */}
+ <span title={dockerTextValue(resource.docker?.desiredState)}>
+ {titleCaseDelimitedLabel(resource.docker?.desiredState, {
+ fallback: '—',
+ })}
+ </span>
</TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('text')} text-base-content`}
>
+ {/* The dot's own words and colour; Docker's raw state, error
+ or message stays on hover. */}
<span
- class="block truncate"
+ class={`block truncate ${dockerStateTextToneClass(
+ mapDockerTaskStatus(resource).variant,
+ )}`}
title={dockerTextValue(
resource.docker?.error ||
resource.docker?.message ||
resource.docker?.currentState,
)}
+ data-docker-task-state={mapDockerTaskStatus(resource).variant}
>
- {dockerTextValue(resource.docker?.currentState)}
+ {mapDockerTaskStatus(resource).label}
</span>
</TableCell>
<TableCell
@@ -283,6 +306,7 @@ export const DockerTasksTable: Component<DockerNativeTableProps> = (props) => {
),
],
['Started', dockerTextValue(resource.docker?.startedAt)],
+ ...taskReasonFields(resource),
]}
/>
</InlineDetailTableRow>
diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
index b232dc6298..a387428e38 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
@@ -1882,6 +1882,41 @@ describe('Docker native tables', () => {
expect(screen.getByText('10.0.0.11')).toBeInTheDocument();
});
+ it("reads an unreachable manager's Reachability in its dot's colour", () => {
+ render(() => (
+ <DockerSwarmNodesTable
+ resources={[
+ makeResource({
+ id: 'node-2',
+ type: 'docker-swarm-node',
+ name: 'manager-2',
+ docker: {
+ nodeRole: 'manager',
+ availability: 'active',
+ managerReachability: 'unreachable',
+ },
+ }),
+ makeResource({
+ id: 'node-3',
+ type: 'docker-swarm-node',
+ name: 'worker-3',
+ docker: { nodeRole: 'worker', availability: 'drain' },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No nodes"
+ emptyDescription="No nodes"
+ showToolbar={false}
+ />
+ ));
+
+ expect(screen.getByTitle('Manager unreachable')).toBeInTheDocument();
+ expect(screen.getByText('unreachable')).toHaveClass('text-red-600');
+ expect(screen.getByTitle('Drained')).toBeInTheDocument();
+ expect(screen.getByText('drain')).toHaveClass('text-amber-700');
+ expect(screen.getByText('active')).toHaveClass('text-base-content');
+ });
+
it('renders Docker Swarm service API fields including update status', () => {
render(() => (
<DockerServicesTable
@@ -1928,8 +1963,10 @@ describe('Docker native tables', () => {
'checkout-api:2026.05',
);
expect(screen.getByText('replicated')).toBeInTheDocument();
- expect(screen.getByText('4')).toBeInTheDocument();
+ expect(screen.getAllByText('4').length).toBeGreaterThan(0);
expect(screen.getByText('2')).toBeInTheDocument();
+ // A phone hides Desired, so its Running count reads out of what.
+ expect(screen.getByText('/4')).toHaveClass('platform-table-phone-only-inline');
// The snake_case rollout token reads as words; the raw token stays in the title.
expect(screen.getByText('Rollback started')).toBeInTheDocument();
expect(screen.getByText('Rollback started')).toHaveClass(
@@ -1939,6 +1976,13 @@ describe('Docker native tables', () => {
expect(
screen.getByText('Rollback started').closest('[title]')?.getAttribute('title'),
).toContain('rollback_started');
+ // The dot names the rollout for what it is, and the cells behind its
+ // verdict read amber: the Update words and the short Running count.
+ expect(screen.getByTitle('Rolling back')).toBeInTheDocument();
+ expect(screen.getByText('Rollback started')).toHaveClass('text-amber-700');
+ expect(document.querySelector('[data-docker-service-running="warning"]')).toHaveClass(
+ 'text-amber-700',
+ );
expect(screen.getByText('18080:8080/tcp')).toBeInTheDocument();
expect(screen.getByText('manager-1')).toBeInTheDocument();
expect(document.querySelector('[data-docker-service-row="service-1"]')).not.toBeNull();
@@ -2058,7 +2102,7 @@ describe('Docker native tables', () => {
serviceName: 'web',
slot: 2,
desiredState: 'running',
- currentState: 'running 2 minutes',
+ currentState: 'running',
nodeName: 'worker-1',
startedAt: '2026-05-24T13:05:00Z',
},
@@ -2076,13 +2120,52 @@ describe('Docker native tables', () => {
expect(screen.getByText('Current')).toBeInTheDocument();
expect(screen.getByText('web.2')).toBeInTheDocument();
expect(screen.getByText('web')).toBeInTheDocument();
- expect(screen.getByText('running 2 minutes')).toBeInTheDocument();
+ // Current reads the row dot's words, and Desired reads as words beside it;
+ // Docker's own token stays on hover.
+ expect(document.querySelector('[data-docker-task-state="success"]')).toHaveTextContent(
+ 'Running',
+ );
+ expect(screen.getAllByText('Running')).toHaveLength(2);
+ expect(screen.getAllByTitle('running')).toHaveLength(2);
// The raw RFC3339 stamp moves to the title; the cell shows an age.
const started = screen.getByTitle('2026-05-24T13:05:00Z');
expect(started).toBeInTheDocument();
expect(started.textContent).toMatch(/ago$/);
});
+ it("reads a failed Swarm task's state in its dot's colour, error on hover", () => {
+ render(() => (
+ <DockerTasksTable
+ resources={[
+ makeResource({
+ id: 'task-2',
+ type: 'docker-task',
+ name: 'web.3',
+ docker: {
+ serviceName: 'web',
+ desiredState: 'shutdown',
+ currentState: 'failed',
+ error: 'task: non-zero exit (1)',
+ nodeName: 'worker-1',
+ },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No tasks"
+ emptyDescription="No tasks"
+ showToolbar={false}
+ />
+ ));
+
+ const state = screen.getByText('Failed');
+ expect(state).toHaveClass('text-red-600');
+ expect(state).toHaveAttribute('title', 'task: non-zero exit (1)');
+ // A phone cannot hover: the expansion says why it failed.
+ fireEvent.click(document.querySelector('[data-docker-task-row="task-2"]')!);
+ expect(screen.getByText('Error')).toBeInTheDocument();
+ expect(screen.getByText('task: non-zero exit (1)')).toBeInTheDocument();
+ });
+
it('renders Docker Swarm secret API metadata without secret data', () => {
render(() => (
<DockerSecretsTable
diff --git a/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage2.test.ts b/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage2.test.ts
index d59b6c6e41..16d6312596 100644
--- a/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage2.test.ts
+++ b/frontend-modern/src/features/docker/__tests__/dockerPageModel.coverage2.test.ts
@@ -374,7 +374,7 @@ describe('mapDockerSwarmNodeStatus — down, degraded, ready, and unknown branch
// ---------------------------------------------------------------------------
describe('mapDockerServiceStatus — rollback started branch', () => {
- it('flags rollbackstarted as warning Rollback paused', () => {
+ it('flags rollbackstarted as warning Rolling back', () => {
expect(
mapDockerServiceStatus(
makeResource({
@@ -387,7 +387,7 @@ describe('mapDockerServiceStatus — rollback started branch', () => {
},
}),
),
- ).toEqual({ variant: 'warning', label: 'Rollback paused' });
+ ).toEqual({ variant: 'warning', label: 'Rolling back' });
});
});
diff --git a/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts b/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts
index 225705ff29..f74ab201be 100644
--- a/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts
+++ b/frontend-modern/src/features/docker/__tests__/dockerPageModel.test.ts
@@ -597,7 +597,25 @@ describe('dockerPageModel', () => {
},
}),
),
- ).toEqual({ variant: 'warning', label: 'Rollback paused' });
+ ).toEqual({ variant: 'warning', label: 'Update paused' });
+ });
+
+ it("names each of Docker's mid-change update states as itself", () => {
+ const service = (state: string, runningTasks = 3) =>
+ mapDockerServiceStatus(
+ makeResource({
+ id: `svc-${state}`,
+ type: 'docker-service',
+ docker: { desiredTasks: 3, runningTasks, serviceUpdate: { state } },
+ }),
+ );
+ // Docker reports rollback_started and rollback_paused as snake_case.
+ expect(service('rollback_started')).toEqual({ variant: 'warning', label: 'Rolling back' });
+ expect(service('rollback_paused')).toEqual({ variant: 'warning', label: 'Rollback paused' });
+ expect(service('updating')).toEqual({ variant: 'success', label: 'Healthy' });
+ expect(service('rollback_completed')).toEqual({ variant: 'success', label: 'Healthy' });
+ // No replicas running is down, whatever the rollout says.
+ expect(service('rollback_started', 0)).toEqual({ variant: 'danger', label: '0 / 3 running' });
});
});
diff --git a/frontend-modern/src/features/docker/dockerPageModel.ts b/frontend-modern/src/features/docker/dockerPageModel.ts
index c5d90c620d..1ab37d1b56 100644
--- a/frontend-modern/src/features/docker/dockerPageModel.ts
+++ b/frontend-modern/src/features/docker/dockerPageModel.ts
@@ -178,17 +178,37 @@ export function mapDockerContainerStatus(resource: Resource): StatusIndicator {
return { variant: 'muted', label: titleCase(state) };
}
-export function mapDockerServiceStatus(resource: Resource): StatusIndicator {
+// Docker's update states that leave a service mid-change: an update paused on
+// a failure, a rollback under way, or a rollback that itself paused.
+const DOCKER_SERVICE_UPDATE_ATTENTION: Record<string, string> = {
+ paused: 'Update paused',
+ rollbackstarted: 'Rolling back',
+ rollbackpaused: 'Rollback paused',
+};
+
+// The service's update verdict, when its update state needs a look.
+export const dockerServiceUpdateAttention = (resource: Resource): StatusIndicator | undefined => {
+ const label =
+ DOCKER_SERVICE_UPDATE_ATTENTION[normalizeDockerToken(resource.docker?.serviceUpdate?.state)];
+ return label ? { variant: 'warning', label } : undefined;
+};
+
+// The service's replica verdict alone: what its Running count says.
+export const dockerServiceReplicaStatus = (resource: Resource): StatusIndicator => {
const desired = resource.docker?.desiredTasks ?? 0;
const running = resource.docker?.runningTasks ?? 0;
- const updateState = normalizeDockerToken(resource.docker?.serviceUpdate?.state);
- if (updateState === 'paused' || updateState === 'rollbackstarted') {
- return { variant: 'warning', label: 'Rollback paused' };
- }
if (desired <= 0) return { variant: 'muted', label: 'Scaled to 0' };
if (running >= desired) return { variant: 'success', label: 'Healthy' };
if (running <= 0) return { variant: 'danger', label: `0 / ${desired} running` };
return { variant: 'warning', label: `${running} / ${desired} running` };
+};
+
+// The row dot: no replicas running outranks a rollout in progress, which
+// outranks a partial count.
+export function mapDockerServiceStatus(resource: Resource): StatusIndicator {
+ const replicas = dockerServiceReplicaStatus(resource);
+ if (replicas.variant === 'danger') return replicas;
+ return dockerServiceUpdateAttention(resource) ?? replicas;
}
export function mapDockerTaskStatus(resource: Resource): StatusIndicator {