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.

Offer the update itself beside an available update in Worth checking

rcourtmane787ca857d82
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 3edf69b023..42fe48806c 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -5525,7 +5525,16 @@ health alert leaves "Health check: Failing" in Details rather than repeating
it. An offline resource's "Observed state" is danger-toned with when it was
last seen, so it is lifted without an alert. A passing availability check moves into
Details, except on an endpoint that is itself a check (`network-endpoint`,
-platform `availability`), whose cards are its whole reading and stay in front. "Worth checking" renders through
+platform `availability`), whose cards are its whole reading and stay in front. A container's lifted
+"Image update: Available" carries its next steps in place: the same shared
+`UpdateButton` as the containers table's Updates column (both built by
+`getDockerContainerUpdateAction` in `features/docker/dockerContainerUpdateAction.ts`,
+so readiness and refusal read the same) and a "View image tags" registry link.
+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
`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 002c667242..427b3cbe0e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -2395,6 +2395,10 @@ 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`.
+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
+drawer, so an update the server refuses is refused the same way in both.
Those open alerts come from the websocket `activeAlerts` map through
`getAlertsForUnifiedResource` in `frontend-modern/src/utils/alerts.ts`, which
the Docker host drawer (`DockerHostDrawerOverview.tsx`) uses the same way.
diff --git a/frontend-modern/browser-tests/proxmox-docker-rows.cjs b/frontend-modern/browser-tests/proxmox-docker-rows.cjs
index a8d285cb42..2dc8f765b4 100644
--- a/frontend-modern/browser-tests/proxmox-docker-rows.cjs
+++ b/frontend-modern/browser-tests/proxmox-docker-rows.cjs
@@ -373,6 +373,21 @@ const observations = (mode) => [
const detail = page.getByTestId('resource-drawer-exceptions');
await detail.getByText('Restarts', { exact: true }).waitFor();
await detail.getByText('7', { exact: true }).waitFor();
+ // The lifted update offers its next steps: the row's update control and
+ // where to see the new image.
+ const updateLine = detail.locator('tr').filter({ hasText: 'Image update' });
+ const drawerUpdate = updateLine.getByRole('button').filter({ hasText: 'Update' });
+ await drawerUpdate.waitFor();
+ assert.equal(await drawerUpdate.isEnabled(), true);
+ if (width === 390) {
+ // Outside the table a phone taps this control: 44px tall at least.
+ const box = await drawerUpdate.boundingBox();
+ assert.ok(box && box.height >= 44, JSON.stringify(box));
+ }
+ assert.match(
+ await updateLine.getByRole('link', { name: 'View image tags' }).getAttribute('href'),
+ /nginx/,
+ );
// The drawer header dot agrees with the row's: unhealthy is red, not green.
const headerDot = page.getByRole('img', { name: 'Unhealthy' }).first();
await headerDot.waitFor();
diff --git a/frontend-modern/browser-tests/proxmox-docker-rows.tsx b/frontend-modern/browser-tests/proxmox-docker-rows.tsx
index 2f0285c0be..1c1c42dc55 100644
--- a/frontend-modern/browser-tests/proxmox-docker-rows.tsx
+++ b/frontend-modern/browser-tests/proxmox-docker-rows.tsx
@@ -19,8 +19,13 @@ import { groupStorageRecords } from '../src/features/storageBackups/storageModel
import { EMPTY_STORAGE_ALERT_STATE } from '../src/features/storageBackups/storageAlertState';
import { DarkModeContext, WebSocketContext } from '../src/contexts/appRuntime';
import type { Resource } from '../src/types/resource';
+import { markSystemSettingsLoadedWithDefaults } from '../src/stores/systemSettings';
import '../src/index.css';
+// The app loads system settings before update controls act; this fixture has
+// no app shell, so it states the defaults instead of leaving them loading.
+markSystemSettingsLoadedWithDefaults();
+
const [wsState, setWsState] = createStore({
resources: [] as Resource[],
lastUpdate: 0,
diff --git a/frontend-modern/browser-verification/70c3e647ec412467.json b/frontend-modern/browser-verification/70c3e647ec412467.json
new file mode 100644
index 0000000000..0e2a90fca3
--- /dev/null
+++ b/frontend-modern/browser-verification/70c3e647ec412467.json
@@ -0,0 +1,44 @@
+{
+ "version": 1,
+ "base_sha": "4bb2ce4e70638dcb453c172771e7a2b20d077f46",
+ "verified_at": "2026-10-14T14:16:44Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx",
+ "frontend-modern/src/components/shared/ContainerUpdateBadge.tsx",
+ "frontend-modern/src/components/shared/containerUpdateBadgeModel.ts",
+ "frontend-modern/src/features/docker/DockerContainersTable.tsx",
+ "frontend-modern/src/features/docker/dockerContainerUpdateAction.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx": "6b8707b57e6ac7d227270acb5eae663220fc3a54ad0bc512ec53e46344b383c0",
+ "frontend-modern/src/components/shared/ContainerUpdateBadge.tsx": "f88feb6935b0035af45d4861e0f612b3dedebc8ed4df6cfb59b898d72e6fab4a",
+ "frontend-modern/src/components/shared/containerUpdateBadgeModel.ts": "14669da470bb235fc5100fbdaa535a9c9071c02496dab61de788d0a454f390e2",
+ "frontend-modern/src/features/docker/DockerContainersTable.tsx": "04c3e2a730fac9ebdf8c212e34c93af758e0cef89837c55567f0ea0cef5cbbc5",
+ "frontend-modern/src/features/docker/dockerContainerUpdateAction.ts": "a19e5160da9ace56562968cf9d9c43f3137a93da57b07fb53af1f7b6c7b67724"
+ },
+ "routes": [
+ "browser-tests/proxmox-docker-rows.html (production DockerContainersTable and ResourceDetailDrawer with system settings loaded, Chromium via Playwright 1.56.1 on pulse-dev)"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "container with an available update: Worth checking shows \"Available\", the shared Update button (enabled, the same control as the row) and \"View image tags\"",
+ "phone 390px: Update button at least 44px tall, link wraps inside the card, label aligned with the first line",
+ "table Updates column keeps the compact pill",
+ "refused update (unit test): locked \"Update available\" with the reason, 44px class, no button",
+ "reviewed twice by Sol from the screenshots"
+ ],
+ "interactions": [
+ "row expand by pointer and tap",
+ "update control rendered enabled; review dialog and its survival across refresh covered by unit tests"
+ ]
+}
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx
index 8fb4f1d1f1..8aa387769f 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx
@@ -1,4 +1,4 @@
-import { For, Show, type Component, type JSX } from 'solid-js';
+import { For, Show, getOwner, runWithOwner, type Component, type JSX } from 'solid-js';
import type { Resource } from '@/types/resource';
import { isContainerUpdatePinned } from '@/components/shared/containerUpdateBadgeModel';
import { DetailSectionTable } from '@/components/shared/DetailSectionTable';
@@ -14,6 +14,8 @@ import { TagBadges } from '@/components/shared/TagBadges';
import { formatBytes, formatRelativeTime, formatUptime } from '@/utils/format';
import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import { getDockerImageRegistryLink } from '@/features/docker/dockerImageReference';
+import { getDockerContainerUpdateAction } from '@/features/docker/dockerContainerUpdateAction';
+import { UpdateButton } from '@/components/shared/ContainerUpdateBadge';
import {
getDockerContainerHealthCheckPresentation,
getDockerContainerRunStatePresentation,
@@ -102,7 +104,52 @@ const dockerRuntimeRow = (
})
: null;
-const dockerSection = (docker: NonNullable<Resource['docker']>, now: number): DetailSection => {
+// An available update's next steps: the containers table's own update control
+// and where to see the new image. The drawer rebuilds its inventory rows on
+// every refresh and clock tick, so this is created once and reused; a
+// recreated button would drop its state, including an open review dialog.
+const ContainerUpdateNextSteps: Component<{ resource: Resource }> = (props) => {
+ const action = () => getDockerContainerUpdateAction(props.resource);
+ const registryLink = () => getDockerImageRegistryLink(props.resource.docker?.image);
+ // One wrapping flex box (overriding the drawer row's inline children), so on
+ // a phone the controls wrap inside the card and keep their own tap sizes.
+ return (
+ <span class="!inline-flex max-w-full flex-wrap items-center gap-x-2 gap-y-1">
+ <span>Available</span>
+ <Show when={action()}>
+ {(update) => (
+ <UpdateButton
+ agentId={update().agentId}
+ containerId={update().containerId}
+ containerName={update().containerName}
+ updateStatus={update().updateStatus}
+ resourceId={update().resourceId}
+ actionReadiness={update().actionReadiness}
+ touchTarget
+ />
+ )}
+ </Show>
+ <Show when={registryLink()}>
+ {(link) => (
+ <a
+ href={link().href}
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex items-center font-normal text-sky-700 hover:underline max-sm:min-h-11 dark:text-sky-300"
+ >
+ {link().label}
+ </a>
+ )}
+ </Show>
+ </span>
+ );
+};
+
+const dockerSection = (
+ docker: NonNullable<Resource['docker']>,
+ now: number,
+ updateNextSteps: () => JSX.Element,
+): DetailSection => {
const labels = docker.labels ?? {};
const labelEntries = Object.entries(labels);
const createdAt = dockerTimestampMillis(docker.createdAt);
@@ -140,6 +187,8 @@ const dockerSection = (docker: NonNullable<Resource['docker']>, now: number): De
tone: update?.updateAvailable ? 'accent' : update?.error ? 'danger' : 'default',
// An available update is something to act on: drawers lift it in front.
lift: update?.updateAvailable === true,
+ // An available update offers its next steps where it is stated.
+ valueContent: update?.updateAvailable ? updateNextSteps() : undefined,
}),
makeDetailRow('Current digest', trimmedDockerValue(update?.currentDigest), {
valueClass: 'break-all font-mono text-[10px]',
@@ -256,6 +305,14 @@ export const useResourceSummarySections = (
// same, so container and controller ages read the shared clock to keep
// moving.
const now = useRelativeTimeNow();
+ // Created on first need under the drawer's owner, then reused by every
+ // rebuild of the rows below.
+ const owner = getOwner();
+ let nextSteps: JSX.Element | undefined;
+ const updateNextSteps = () =>
+ (nextSteps ??= runWithOwner(owner, () => (
+ <ContainerUpdateNextSteps resource={props.resource} />
+ )));
return (): DetailSection[] => {
const docker = dockerContainerMeta(props.resource);
// An offline resource has no current uptime: the retained value is from
@@ -359,7 +416,7 @@ export const useResourceSummarySections = (
]),
}
: null,
- props.content !== 'overview' && docker ? dockerSection(docker, now()) : null,
+ props.content !== 'overview' && docker ? dockerSection(docker, now(), updateNextSteps) : null,
props.content !== 'overview' ? buildKubernetesControllerSection(props.resource, now()) : null,
props.content !== 'overview'
? {
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.docker-container.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.docker-container.test.tsx
index 812769d11c..b15a15f6d5 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.docker-container.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.docker-container.test.tsx
@@ -1,8 +1,10 @@
import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { ResourceActionsAPI } from '@/api/resourceActions';
import type { Resource } from '@/types/resource';
import { ResourceDetailDrawer } from '../ResourceDetailDrawer';
+import { markSystemSettingsLoadedWithDefaults } from '@/stores/systemSettings';
vi.mock('@/contexts/appRuntime', async (importOriginal) => ({
...(await importOriginal<typeof import('@/contexts/appRuntime')>()),
@@ -308,6 +310,136 @@ describe('ResourceDetailDrawer for Docker containers', () => {
expect(within(section).getByText(/traefik\.enable/)).toBeInTheDocument();
});
+ it('offers the update and the new image beside an available update in Worth checking', () => {
+ render(() => (
+ <ResourceDetailDrawer
+ presentation="table-row"
+ resource={resource({
+ id: 'app-container-proxy',
+ name: 'edge-proxy',
+ docker: {
+ hostSourceId: 'agent-edge',
+ containerId: 'proxy123',
+ containerState: 'running',
+ image: 'nginx:1.27',
+ updateStatus: {
+ updateAvailable: true,
+ currentDigest: 'sha256:current',
+ latestDigest: 'sha256:latest',
+ lastChecked: '2026-10-14T10:00:00Z',
+ },
+ },
+ })}
+ />
+ ));
+ const lifted = screen.getByTestId('resource-drawer-exceptions');
+ expect(within(lifted).getByText('Image update')).toBeInTheDocument();
+ expect(within(lifted).getByText('Available')).toBeInTheDocument();
+ // The same update control the containers table offers, so a phone, whose
+ // row hides the Updates column, can still act.
+ // (System settings never load here, so it shows its loading state.)
+ expect(within(lifted).getByRole('button')).toHaveTextContent('Update');
+ expect(within(lifted).getByRole('link', { name: 'View image tags' })).toHaveAttribute(
+ 'href',
+ expect.stringContaining('nginx'),
+ );
+ });
+
+ it('keeps an open update review through resource refreshes and clock ticks', async () => {
+ markSystemSettingsLoadedWithDefaults();
+ vi.useFakeTimers();
+ try {
+ const proxy = (cpu: number) =>
+ resource({
+ id: 'app-container-proxy',
+ name: 'edge-proxy',
+ cpu: { current: cpu },
+ docker: {
+ hostSourceId: 'agent-edge',
+ containerId: 'proxy123',
+ containerState: 'running',
+ image: 'nginx:1.27',
+ createdAt: '2026-10-01T10:00:00Z',
+ updateStatus: { updateAvailable: true, lastChecked: '2026-10-14T10:00:00Z' },
+ },
+ });
+ const [current, setCurrent] = createSignal(proxy(10));
+ render(() => <ResourceDetailDrawer presentation="table-row" resource={current()} />);
+ fireEvent.click(within(screen.getByTestId('resource-drawer-exceptions')).getByRole('button'));
+ await vi.advanceTimersByTimeAsync(0);
+ const dialog = await screen.findByRole('dialog');
+ setCurrent(proxy(20));
+ await vi.advanceTimersByTimeAsync(61_000);
+ expect(screen.getByRole('dialog')).toBe(dialog);
+ expect(dialog.isConnected).toBe(true);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it('says why Pulse cannot apply an update that is refused, at a tappable size', () => {
+ markSystemSettingsLoadedWithDefaults();
+ render(() => (
+ <ResourceDetailDrawer
+ presentation="table-row"
+ resource={resource({
+ id: 'app-container-proxy',
+ name: 'edge-proxy',
+ actionReadiness: [
+ { name: 'update', available: false, reason: 'Command agent disconnected' },
+ ],
+ docker: {
+ hostSourceId: 'agent-edge',
+ containerId: 'proxy123',
+ containerState: 'running',
+ image: 'nginx:1.27',
+ updateStatus: { updateAvailable: true, lastChecked: '2026-10-14T10:00:00Z' },
+ },
+ })}
+ />
+ ));
+ const lifted = screen.getByTestId('resource-drawer-exceptions');
+ const locked = within(lifted).getByLabelText(
+ /Pulse cannot apply it: Command agent disconnected/,
+ );
+ expect(locked).toHaveTextContent('Update available');
+ expect(locked).toHaveClass('max-sm:min-h-11');
+ expect(within(lifted).queryByRole('button')).toBeNull();
+ });
+
+ it('keeps the same update control through resource refreshes and clock ticks', async () => {
+ vi.useFakeTimers();
+ try {
+ const proxy = (cpu: number) =>
+ resource({
+ id: 'app-container-proxy',
+ name: 'edge-proxy',
+ cpu: { current: cpu },
+ docker: {
+ hostSourceId: 'agent-edge',
+ containerId: 'proxy123',
+ containerState: 'running',
+ image: 'nginx:1.27',
+ createdAt: '2026-10-01T10:00:00Z',
+ updateStatus: { updateAvailable: true, lastChecked: '2026-10-14T10:00:00Z' },
+ },
+ });
+ const [current, setCurrent] = createSignal(proxy(10));
+ render(() => <ResourceDetailDrawer presentation="table-row" resource={current()} />);
+ const button = () =>
+ within(screen.getByTestId('resource-drawer-exceptions')).getByRole('button');
+ const first = button();
+ // A fresh snapshot of the same container, then the shared clock moving
+ // its ages: the rows rebuild, the control (and any open review) stays.
+ setCurrent(proxy(20));
+ await vi.advanceTimersByTimeAsync(61_000);
+ expect(button()).toBe(first);
+ expect(first.isConnected).toBe(true);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it('names a failing health check apart from the running state', () => {
render(() => (
<ResourceDetailDrawer
diff --git a/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx b/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx
index 84ef026639..9e72185576 100644
--- a/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx
+++ b/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx
@@ -214,6 +214,8 @@ export const UpdateIcon: Component<UpdateIconProps> = (props) => {
* While system settings are loading, the button displays in a disabled/loading state
* to prevent premature clicks before the server configuration is known.
*/
+const UPDATE_TOUCH_TARGET_CLASS = ' max-sm:min-h-11 max-sm:px-3';
+
export const UpdateButton: Component<UpdateButtonProps> = (props) => {
const state = useContainerUpdateButtonState(props);
const readOnlyUpdateExplanation = () =>
@@ -241,7 +243,9 @@ export const UpdateButton: Component<UpdateButtonProps> = (props) => {
<div class="inline-flex items-center gap-1" data-prevent-toggle>
<button
type="button"
- class={getUpdateButtonClass(state.currentState(), state.isUpdateUnavailable())}
+ class={`${getUpdateButtonClass(state.currentState(), state.isUpdateUnavailable())}${
+ props.touchTarget ? UPDATE_TOUCH_TARGET_CLASS : ''
+ }`}
onClick={state.handleClick}
onMouseDown={(e) => {
e.stopPropagation();
@@ -309,7 +313,9 @@ export const UpdateButton: Component<UpdateButtonProps> = (props) => {
}
>
<span
- class="inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-900/25 dark:text-amber-200 cursor-help focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary"
+ class={`inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-900/25 dark:text-amber-200 cursor-help focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary${
+ props.touchTarget ? UPDATE_TOUCH_TARGET_CLASS : ''
+ }`}
tabindex="0"
aria-label={readOnlyUpdateExplanation()}
data-prevent-toggle
diff --git a/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx b/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx
index ae2c584814..a408400ae2 100644
--- a/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/ContainerUpdateBadge.test.tsx
@@ -137,6 +137,31 @@ describe('ContainerUpdateBadge', () => {
expect(screen.getByRole('button', { name: /update/i })).toBeInTheDocument();
});
+ it('grows to a 44px phone target only where the caller asks for it', () => {
+ const status = {
+ updateAvailable: true,
+ currentDigest: 'sha256:current',
+ latestDigest: 'sha256:latest',
+ lastChecked: 0,
+ };
+ const table = render(() => (
+ <UpdateButton agentId="agent-1" containerId="c-1" containerName="web" updateStatus={status} />
+ ));
+ expect(screen.getByRole('button', { name: /update/i })).not.toHaveClass('max-sm:min-h-11');
+ table.unmount();
+
+ render(() => (
+ <UpdateButton
+ agentId="agent-1"
+ containerId="c-2"
+ containerName="web"
+ updateStatus={status}
+ touchTarget
+ />
+ ));
+ expect(screen.getByRole('button', { name: /update/i })).toHaveClass('max-sm:min-h-11');
+ });
+
it('shows update availability and host guidance without an action when the server refuses updates', () => {
render(() => (
<UpdateButton
diff --git a/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts b/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts
index 31e1c4434e..9874a107fd 100644
--- a/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts
+++ b/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts
@@ -24,6 +24,12 @@ export interface UpdateButtonProps {
// reason, instead of letting the click fail at POST /api/actions/plan.
actionReadiness?: ResourceActionReadiness[];
compact?: boolean;
+ /**
+ * A 44px minimum height below the `sm` breakpoint, for a control a phone
+ * user taps outside a dense table (the container drawer). Tables keep the
+ * compact pill.
+ */
+ touchTarget?: boolean;
onUpdateTriggered?: () => void;
externalState?: 'updating' | 'queued' | 'error';
}
diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsx
index 01ec130c58..0e8ac69090 100644
--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx
+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx
@@ -3,6 +3,7 @@ import { For, Show, Suspense, createMemo, lazy, type Component, type JSX } from
import { useSearchParams } from '@solidjs/router';
import { type FilterDef } from '@/components/shared/FilterBar';
import { UpdateButton } from '@/components/shared/ContainerUpdateBadge';
+import { getDockerContainerUpdateAction } from './dockerContainerUpdateAction';
import { isContainerUpdatePinned } from '@/components/shared/containerUpdateBadgeModel';
import {
GroupedTableModeSegmentedControl,
@@ -86,7 +87,6 @@ import {
type DockerContainerSortKey,
type DockerContainerTableColumn,
} from './dockerContainerTableModel';
-import type { DockerContainerUpdateStatus } from '@/types/api';
import type { Resource } from '@/types/resource';
import { DockerContainerLifecycleControls } from './DockerContainerLifecycleControls';
import { CONTAINER_CPU_CAPACITY_DESCRIPTION } from './dockerCpuPresentation';
@@ -214,55 +214,6 @@ const updateStatusTitle = (resource: Resource): string => {
);
};
-const updateLastCheckedMillis = (lastChecked: string | undefined): number => {
- if (!lastChecked) return 0;
- const parsed = Date.parse(lastChecked);
- return Number.isFinite(parsed) ? parsed : 0;
-};
-
-const containerUpdateStatus = (resource: Resource): DockerContainerUpdateStatus | undefined => {
- const update = resource.docker?.updateStatus;
- if (!update) return undefined;
-
- const error = asTrimmedString(update.error);
- if (typeof update.updateAvailable !== 'boolean' && !error) return undefined;
-
- return {
- updateAvailable: update.updateAvailable === true,
- currentDigest: asTrimmedString(update.currentDigest) || undefined,
- latestDigest: asTrimmedString(update.latestDigest) || undefined,
- lastChecked: updateLastCheckedMillis(update.lastChecked),
- error: error || undefined,
- };
-};
-
-const containerUpdateAction = (
- resource: Resource,
-):
- | {
- agentId: string;
- containerId: string;
- containerName: string;
- updateStatus: DockerContainerUpdateStatus;
- }
- | undefined => {
- const updateStatus = containerUpdateStatus(resource);
- const agentId = asTrimmedString(resource.docker?.hostSourceId);
- const containerId = asTrimmedString(resource.docker?.containerId);
- if (!updateStatus || !agentId || !containerId) return undefined;
-
- return {
- agentId,
- containerId,
- containerName:
- asTrimmedString(resource.name) ||
- asTrimmedString(resource.displayName) ||
- asTrimmedString(resource.docker?.displayName) ||
- containerId,
- updateStatus,
- };
-};
-
// Scalar per column that user-controlled sorting orders on. '—' style empty
// renders map to null so rows without the datum sink to the bottom.
const getDockerContainerSortValue = (
@@ -574,7 +525,7 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
const mounts = () => mountsSummary(resource);
const updates = () => updateStatusLabel(resource);
const updateTitle = () => updateStatusTitle(resource);
- const action = containerUpdateAction(resource);
+ const action = getDockerContainerUpdateAction(resource);
const detailRowId = () => drawer.detailRowId(resource);
const isExpanded = () => drawer.isExpanded(resource);
const renderColumnCell = (column: DockerContainerTableColumn): JSX.Element => {
@@ -722,16 +673,7 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
</span>
}
>
- {(updateAction) => (
- <UpdateButton
- agentId={updateAction().agentId}
- containerId={updateAction().containerId}
- containerName={updateAction().containerName}
- updateStatus={updateAction().updateStatus}
- resourceId={resource.id}
- actionReadiness={resource.actionReadiness}
- />
- )}
+ {(updateAction) => <UpdateButton {...updateAction()} />}
</Show>
</TableCell>
);
diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
index 7bd2c8f2ed..65feaf6f9e 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
@@ -1098,6 +1098,8 @@ describe('Docker native tables', () => {
// The phone reflow boundary must include the governed action, not just read-only badges.
expect(updateButton.closest('td')).toHaveClass('docker-container-update-cell');
expect(updateButton).toHaveTextContent('Update');
+ // The table keeps the compact pill; only the drawer asks for a phone target.
+ expect(updateButton).not.toHaveClass('max-sm:min-h-11');
fireEvent.click(updateButton);
await waitFor(() =>
diff --git a/frontend-modern/src/features/docker/__tests__/dockerContainerUpdateAction.test.ts b/frontend-modern/src/features/docker/__tests__/dockerContainerUpdateAction.test.ts
new file mode 100644
index 0000000000..8f10da8d93
--- /dev/null
+++ b/frontend-modern/src/features/docker/__tests__/dockerContainerUpdateAction.test.ts
@@ -0,0 +1,60 @@
+import { describe, expect, it } from 'vitest';
+import type { Resource } from '@/types/resource';
+import {
+ getDockerContainerUpdateAction,
+ getDockerContainerUpdateStatus,
+} from '../dockerContainerUpdateAction';
+
+const container = (docker: Resource['docker']): Resource =>
+ ({
+ id: 'app-container:edge-web',
+ type: 'app-container',
+ name: 'edge-web',
+ status: 'online',
+ actionReadiness: [{ name: 'update', available: true }],
+ docker,
+ }) as unknown as Resource;
+
+describe('docker container update action', () => {
+ it('addresses the update by host and container, with the resource and its readiness', () => {
+ const action = getDockerContainerUpdateAction(
+ container({
+ hostSourceId: ' agent-edge ',
+ containerId: 'abc',
+ updateStatus: { updateAvailable: true, lastChecked: '2026-10-14T10:00:00Z' },
+ }),
+ );
+ expect(action).toMatchObject({
+ agentId: 'agent-edge',
+ containerId: 'abc',
+ containerName: 'edge-web',
+ resourceId: 'app-container:edge-web',
+ actionReadiness: [{ name: 'update', available: true }],
+ updateStatus: { updateAvailable: true, lastChecked: Date.parse('2026-10-14T10:00:00Z') },
+ });
+ });
+
+ it('offers nothing a container cannot be updated through', () => {
+ const update = { updateAvailable: true };
+ expect(
+ getDockerContainerUpdateAction(container({ containerId: 'abc', updateStatus: update })),
+ ).toBeUndefined();
+ expect(
+ getDockerContainerUpdateAction(container({ hostSourceId: 'h', updateStatus: update })),
+ ).toBeUndefined();
+ expect(
+ getDockerContainerUpdateAction(container({ hostSourceId: 'h', containerId: 'abc' })),
+ ).toBeUndefined();
+ });
+
+ it('reads an unchecked status as no status, and keeps a check error', () => {
+ expect(
+ getDockerContainerUpdateStatus(container({ updateStatus: {} as never })),
+ ).toBeUndefined();
+ expect(
+ getDockerContainerUpdateStatus(
+ container({ updateStatus: { error: ' registry 401 ' } as never }),
+ ),
+ ).toMatchObject({ updateAvailable: false, error: 'registry 401' });
+ });
+});
diff --git a/frontend-modern/src/features/docker/dockerContainerUpdateAction.ts b/frontend-modern/src/features/docker/dockerContainerUpdateAction.ts
new file mode 100644
index 0000000000..e8b872a8ca
--- /dev/null
+++ b/frontend-modern/src/features/docker/dockerContainerUpdateAction.ts
@@ -0,0 +1,57 @@
+import type { DockerContainerUpdateStatus } from '@/types/api';
+import type { Resource } from '@/types/resource';
+import type { UpdateButtonProps } from '@/components/shared/containerUpdateBadgeModel';
+import { asTrimmedString } from '@/utils/stringUtils';
+
+const updateLastCheckedMillis = (lastChecked: string | undefined): number => {
+ if (!lastChecked) return 0;
+ const parsed = Date.parse(lastChecked);
+ return Number.isFinite(parsed) ? parsed : 0;
+};
+
+/** The container's reported image update state, as the update controls read it. */
+export const getDockerContainerUpdateStatus = (
+ resource: Resource,
+): DockerContainerUpdateStatus | undefined => {
+ const update = resource.docker?.updateStatus;
+ if (!update) return undefined;
+
+ const error = asTrimmedString(update.error);
+ if (typeof update.updateAvailable !== 'boolean' && !error) return undefined;
+
+ return {
+ updateAvailable: update.updateAvailable === true,
+ currentDigest: asTrimmedString(update.currentDigest) || undefined,
+ latestDigest: asTrimmedString(update.latestDigest) || undefined,
+ lastChecked: updateLastCheckedMillis(update.lastChecked),
+ error: error || undefined,
+ };
+};
+
+/**
+ * Everything the shared `UpdateButton` needs for one container, or nothing
+ * when the container cannot be addressed for an update. The containers table
+ * and the container drawer both build their update control from this, so the
+ * two offer the same action with the same readiness.
+ */
+export const getDockerContainerUpdateAction = (
+ resource: Resource,
+): UpdateButtonProps | undefined => {
+ const updateStatus = getDockerContainerUpdateStatus(resource);
+ const agentId = asTrimmedString(resource.docker?.hostSourceId);
+ const containerId = asTrimmedString(resource.docker?.containerId);
+ if (!updateStatus || !agentId || !containerId) return undefined;
+
+ return {
+ agentId,
+ containerId,
+ containerName:
+ asTrimmedString(resource.name) ||
+ asTrimmedString(resource.displayName) ||
+ asTrimmedString(resource.docker?.displayName) ||
+ containerId,
+ updateStatus,
+ resourceId: resource.id,
+ actionReadiness: resource.actionReadiness,
+ };
+};