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.

Keep Docker row health reactive and phone failure words readable

pulse-triage[bot]42acb257c604
diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsx
index b04a3a7f1a..371966542d 100644
--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx
+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx
@@ -503,7 +503,9 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.resources);
const renderContainerRow = (resource: Resource): JSX.Element => {
- const indicator = mapDockerContainerStatus(resource);
+ // REST reconciliation keeps this resource object and row alive. Read
+ // its current health verdict rather than retaining the first green dot.
+ const indicator = () => mapDockerContainerStatus(resource);
const image = () => dockerTextValue(resource.docker?.image);
const state = () => stateFor(resource);
const stateWords = () => (
@@ -517,9 +519,11 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
);
// Without a State column the words join the name only when the state
// needs attention; a running or stopped container reads in its dot.
+ // Keep bounded failure words readable on phones: the neighbouring name
+ // can truncate first without turning the row back into two lines.
const stateBesideName = () => (
<span
- class={`${getPlatformInlineStateClass(isPlatformAttentionVariant(state().tone))} ${dockerStateTextToneClass(state().tone)}`}
+ class={`${getPlatformInlineStateClass(isPlatformAttentionVariant(state().tone))} ${isPlatformAttentionVariant(state().tone) ? 'shrink-0' : ''} ${dockerStateTextToneClass(state().tone)}`}
title={state().title}
data-docker-container-state={state().tone ?? 'ok'}
>
@@ -567,7 +571,7 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro
return (
<DockerResourceNameCell
resource={resource}
- indicator={indicator}
+ indicator={indicator()}
detail={stateUnderName() ? stateBesideName() : undefined}
detailToggle={
<PlatformResourceDetailToggleButton
diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
index 8acb0c9b02..71f1286e7d 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
@@ -1,6 +1,7 @@
import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
import { Route, Router } from '@solidjs/router';
import { createSignal, type JSX } from 'solid-js';
+import { createStore } from 'solid-js/store';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { ResourceActionsAPI } from '@/api/resourceActions';
@@ -932,6 +933,58 @@ describe('Docker native tables', () => {
expect(screen.getByText('Healthy')).toHaveAttribute('data-docker-container-state', 'ok');
});
+ it.each([320, WORKLOAD_TABLE_WIDE_LAYOUT_WIDTH])(
+ 'updates the same container row dot across health and lifecycle refreshes at %ipx',
+ (width) => {
+ setViewportWidth(width);
+ const [resources, setResources] = createStore<Resource[]>([
+ makeResource({
+ id: 'container-health',
+ type: 'app-container',
+ name: 'edge-api',
+ status: 'running',
+ docker: { hostname: 'edge-01', containerState: 'running', health: 'healthy' },
+ }),
+ ]);
+ const { container } = renderInRouter(() => (
+ <DockerContainersTable
+ resources={resources}
+ emptyIcon={<span />}
+ emptyTitle="No containers"
+ emptyDescription="No containers"
+ showToolbar={false}
+ />
+ ));
+ const row = container.querySelector('[data-docker-container-row="container-health"]')!;
+ const initialResource = resources[0];
+ expect(within(row as HTMLElement).getByTitle('Healthy')).toHaveClass('bg-emerald-500');
+
+ for (const [health, label, colour] of [
+ ['starting', 'Starting', 'bg-amber-500'],
+ ['unhealthy', 'Unhealthy', 'bg-red-500'],
+ ['healthy', 'Healthy', 'bg-emerald-500'],
+ ]) {
+ setResources(0, 'docker', 'health', health);
+ expect(resources[0]).toBe(initialResource);
+ expect(container.querySelector('[data-docker-container-row="container-health"]')).toBe(row);
+ expect(within(row as HTMLElement).getByTitle(label)).toHaveClass(colour);
+ expect(within(row as HTMLElement).getByText(label)).toHaveAttribute(
+ 'data-docker-container-state',
+ health === 'unhealthy' ? 'danger' : health === 'starting' ? 'warning' : 'ok',
+ );
+ }
+
+ setResources(0, 'docker', 'containerState', 'exited');
+ setResources(0, 'docker', 'exitCode', 137);
+ expect(within(row as HTMLElement).getByTitle('Exited (137)')).toHaveClass('bg-red-500');
+ setResources(0, 'docker', 'containerState', 'restarting');
+ expect(within(row as HTMLElement).getByTitle('Restarting')).toHaveClass('bg-amber-500');
+ setResources(0, 'docker', 'containerState', 'exited');
+ setResources(0, 'docker', 'exitCode', 0);
+ expect(within(row as HTMLElement).getByTitle('Exited')).toHaveClass('bg-slate-400');
+ },
+ );
+
it('puts state words that need attention beside the name where a phone row has no State column', () => {
// A narrow table cannot give "Unhealthy" its own column beside the 40%
// name, both metric pills and the Update control without cutting it.
@@ -967,7 +1020,7 @@ describe('Docker native tables', () => {
expect(unhealthy).toHaveAttribute('data-docker-container-state', 'danger');
expect(unhealthy.closest('td')).toBe(screen.getByText('edge-api').closest('td'));
// The words join the name on its line, so the row stays one line tall.
- expect(unhealthy).toHaveClass('min-w-0', 'truncate');
+ expect(unhealthy).toHaveClass('min-w-0', 'truncate', 'shrink-0');
expect(unhealthy.parentElement).toHaveClass('items-center');
expect(unhealthy.parentElement).not.toHaveClass('flex-col');
// A running container reads in its green dot; screen readers keep the words.