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.

Restore Docker container update action

rcourtmancb17e4b8c5dc
diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsx
index 31acd5356b..64067d31cd 100644
--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx
+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx
@@ -1,6 +1,7 @@
import { For, Show, createMemo, type Component } from 'solid-js';
import { useSearchParams } from '@solidjs/router';
import type { FilterDef } from '@/components/shared/FilterBar';
+import { UpdateButton } from '@/components/shared/ContainerUpdateBadge';
import { TableCard } from '@/components/shared/TableCard';
import { TableCardHeader } from '@/components/shared/TableCardHeader';
import {
@@ -44,6 +45,7 @@ import {
mapDockerContainerStatus,
type DockerResourceStatusFilter,
} from './dockerPageModel';
+import type { DockerContainerUpdateStatus } from '@/types/api';
import type { Resource } from '@/types/resource';
type DockerNetwork = NonNullable<NonNullable<Resource['docker']>['networks']>[number];
@@ -109,6 +111,55 @@ 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,
+ };
+};
+
export const DockerContainersTable: Component<DockerNativeTableProps> = (props) => {
const tableState = createPlatformTableFilterState({
resources: () => props.resources,
@@ -251,7 +302,7 @@ export const DockerContainersTable: Component<DockerNativeTableProps> = (props)
>
Mounts
</TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} w-[100px]`}>
+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} w-[130px]`}>
Updates
</TableHead>
</TableRow>
@@ -270,6 +321,7 @@ export const DockerContainersTable: Component<DockerNativeTableProps> = (props)
const mounts = () => mountsSummary(resource);
const updates = () => updateStatusLabel(resource);
const updateTitle = () => updateStatusTitle(resource);
+ const action = containerUpdateAction(resource);
const detailRowId = () => drawer.detailRowId(resource);
const isExpanded = () => drawer.isExpanded(resource);
@@ -348,9 +400,23 @@ export const DockerContainersTable: Component<DockerNativeTableProps> = (props)
<TableCell
class={`${getPlatformTableCellClassForKind('text')} text-base-content`}
>
- <span class="block max-w-full truncate" title={updateTitle()}>
- {updates()}
- </span>
+ <Show
+ when={action}
+ fallback={
+ <span class="block max-w-full truncate" title={updateTitle()}>
+ {updates()}
+ </span>
+ }
+ >
+ {(updateAction) => (
+ <UpdateButton
+ agentId={updateAction().agentId}
+ containerId={updateAction().containerId}
+ containerName={updateAction().containerName}
+ updateStatus={updateAction().updateStatus}
+ />
+ )}
+ </Show>
</TableCell>
</TableRow>
<PlatformResourceDetailTableRow
diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
index 0b65ed2dd7..280af6e2e9 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
@@ -1,8 +1,9 @@
-import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
import { Route, Router } from '@solidjs/router';
import type { JSX } from 'solid-js';
-import { afterEach, describe, expect, it } from 'vitest';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { MonitoringAPI } from '@/api/monitoring';
import type { Resource } from '@/types/resource';
import { DockerContainersTable } from '../DockerContainersTable';
import { DockerConfigsTable } from '../DockerConfigsTable';
@@ -15,6 +16,26 @@ import { DockerSwarmNodesTable } from '../DockerSwarmNodesTable';
import { DockerTasksTable } from '../DockerTasksTable';
import { DockerVolumesTable } from '../DockerVolumesTable';
+vi.mock('@/api/monitoring', () => ({
+ MonitoringAPI: {
+ updateDockerContainer: vi.fn().mockResolvedValue({ success: true }),
+ },
+}));
+
+vi.mock('@/stores/containerUpdates', () => ({
+ clearContainerUpdateState: vi.fn(),
+ getContainerUpdateState: vi.fn(() => undefined),
+ markContainerQueued: vi.fn(),
+ markContainerUpdateError: vi.fn(),
+ markContainerUpdateSuccess: vi.fn(),
+ updateStates: vi.fn(() => ({})),
+}));
+
+vi.mock('@/stores/systemSettings', () => ({
+ areSystemSettingsLoaded: () => true,
+ shouldHideDockerUpdateActions: () => false,
+}));
+
const makeResource = ({
id,
type,
@@ -44,6 +65,7 @@ const renderInRouter = (component: () => JSX.Element) =>
afterEach(() => {
cleanup();
+ vi.clearAllMocks();
});
describe('Docker native tables', () => {
@@ -107,6 +129,50 @@ describe('Docker native tables', () => {
expect(screen.getByText('Available')).toBeInTheDocument();
});
+ it('renders actionable Docker container updates with native agent and container IDs', async () => {
+ renderInRouter(() => (
+ <DockerContainersTable
+ resources={[
+ makeResource({
+ id: 'container-1',
+ type: 'app-container',
+ name: 'edge-web',
+ status: 'running',
+ docker: {
+ hostSourceId: 'agent-edge',
+ containerId: 'native-container-1',
+ hostname: 'edge-01',
+ image: 'nginx:latest',
+ containerState: 'running',
+ updateStatus: {
+ updateAvailable: true,
+ currentDigest: 'sha256:current',
+ latestDigest: 'sha256:latest',
+ lastChecked: '2026-05-24T13:00:00Z',
+ },
+ },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No containers"
+ emptyDescription="No containers"
+ showToolbar={false}
+ />
+ ));
+
+ const updateButton = screen.getByRole('button', { name: /click to update/i });
+ fireEvent.click(updateButton);
+ fireEvent.click(screen.getByRole('button', { name: /click again to confirm update/i }));
+
+ await waitFor(() =>
+ expect(MonitoringAPI.updateDockerContainer).toHaveBeenCalledWith(
+ 'agent-edge',
+ 'native-container-1',
+ 'edge-web',
+ ),
+ );
+ });
+
it('renders container rows with status mapped from containerState + health + exitCode, attention rows first', () => {
renderInRouter(() => (
<DockerContainersTable