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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Clean up dashboard problem resource labels
rcourtman4c3d59f0e9fd
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 0e01a0afc3..6d5a8bea02 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -1776,10 +1776,11 @@ may collapse only when they share the same governed display label, resourcetype, and problem signal; the header count and Pulse Brief counts must continueto represent the underlying affected resources, and grouped links must route tothe broad owning surface rather than inventing a synthetic resource target.-Pulse Brief problem-resource wording must not amplify generic status-shaped-names such as `storage (offline)` into first-viewport prose; when the resource-name is only a type plus status, the brief should summarize the type-level issue-in operator language instead of repeating raw backend-shaped labels.+Problem Resources and Pulse Brief wording must not amplify generic+status-shaped names such as `storage (offline)` into first-viewport prose or+grouped-row sublabels; when the resource name is only a type plus status, the+surface should summarize the type-level issue in operator language instead of+repeating raw backend-shaped labels.That same dashboard overview boundary must consume the governed Patrol findingpresentation helpers when it surfaces Patrol findings in compact form. In`frontend-modern/src/features/dashboardOverview/ActionRequiredPanel.tsx`,diff --git a/frontend-modern/src/features/dashboardOverview/ProblemResourcesTable.tsx b/frontend-modern/src/features/dashboardOverview/ProblemResourcesTable.tsxindex b89c0c90fc..58ef3652ad 100644--- a/frontend-modern/src/features/dashboardOverview/ProblemResourcesTable.tsx+++ b/frontend-modern/src/features/dashboardOverview/ProblemResourcesTable.tsx@@ -20,8 +20,11 @@ import {import { getResourceTypeLabel } from '@/utils/resourceTypePresentation';import { getTypeColumnLabel } from '@/utils/typeColumnPresentation';import { getSimpleStatusIndicator, getStatusIndicatorBadgeToneClasses } from '@/utils/status';-import { getProblemResourceStatusVariant } from '@/utils/problemResourcePresentation';-import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';+import {+ getProblemResourceIssueLabel,+ getProblemResourceMemberLabel,+ getProblemResourceStatusVariant,+} from '@/utils/problemResourcePresentation';import AlertTriangleIcon from 'lucide-solid/icons/alert-triangle';interface ProblemResourcesTableProps {@@ -52,7 +55,11 @@ function normalizeGroupValue(value: string): string {}function problemResourceDisplayName(pr: ProblemResource): string {- return getPreferredResourceDisplayName(pr.resource) || pr.resource.id;+ return getProblemResourceIssueLabel(pr.resource, pr.problems);+}++function problemResourceMemberDisplayName(pr: ProblemResource): string | null {+ return getProblemResourceMemberLabel(pr.resource, pr.problems);}function problemGroupKey(pr: ProblemResource): string {@@ -70,21 +77,22 @@ function problemResourceGroups(problems: ProblemResource[]): ProblemResourceGrouif (existing) {existing.resources.push(problem);existing.worstValue = Math.max(existing.worstValue, problem.worstValue);- const memberName = problemResourceDisplayName(problem);- if (!existing.memberDisplayNames.includes(memberName)) {+ const memberName = problemResourceMemberDisplayName(problem);+ if (memberName && !existing.memberDisplayNames.includes(memberName)) {existing.memberDisplayNames.push(memberName);}continue;}const displayName = problemResourceDisplayName(problem);+ const memberName = problemResourceMemberDisplayName(problem);groups.set(key, {representative: problem,resources: [problem],displayName,typeLabel: getResourceTypeLabel(problem.resource.type) || problem.resource.type,worstValue: problem.worstValue,- memberDisplayNames: [displayName || problem.resource.id],+ memberDisplayNames: memberName ? [memberName] : [],});}@@ -168,17 +176,23 @@ export function ProblemResourcesTable(props: ProblemResourcesTableProps) {<ahref={groupedResourceLink(group)}class="text-xs font-medium text-base-content hover:underline truncate block max-w-[200px]"- title={group.memberDisplayNames.join(', ')}+ title={+ group.memberDisplayNames.length > 0+ ? group.memberDisplayNames.join(', ')+ : `${group.resources.length} ${pluralizeTypeLabel(group.resources.length, group.typeLabel)}`+ }>{group.resources.length}{' '}{pluralizeTypeLabel(group.resources.length, group.typeLabel)}</a>- <span- class="mt-0.5 block text-[10px] text-muted truncate max-w-[220px]"- title={group.memberDisplayNames.join(', ')}- >- {group.memberDisplayNames.join(', ')}- </span>+ <Show when={group.memberDisplayNames.length > 0}>+ <span+ class="mt-0.5 block text-[10px] text-muted truncate max-w-[220px]"+ title={group.memberDisplayNames.join(', ')}+ >+ {group.memberDisplayNames.join(', ')}+ </span>+ </Show></Show></TableCell><TableCell class="hidden sm:table-cell">diff --git a/frontend-modern/src/features/dashboardOverview/__tests__/ProblemResourcesTable.test.tsx b/frontend-modern/src/features/dashboardOverview/__tests__/ProblemResourcesTable.test.tsxindex f200140043..5d8eb7d988 100644--- a/frontend-modern/src/features/dashboardOverview/__tests__/ProblemResourcesTable.test.tsx+++ b/frontend-modern/src/features/dashboardOverview/__tests__/ProblemResourcesTable.test.tsx@@ -113,6 +113,27 @@ describe('ProblemResourcesTable', () => {// Storage groups use resource wording instead of the awkward "storages".expect(screen.getByText('2 storage resources')).toBeInTheDocument();expect(screen.queryByText('2 storages')).toBeNull();+ expect(screen.queryByText('storage')).toBeNull();+ });++ it('hides generated status-shaped member names on grouped rows', () => {+ render(() => (+ <ProblemResourcesTable+ problems={['one', 'two'].map((id) => ({+ resource: makeResource({+ id: `container-${id}`,+ type: 'system-container',+ name: 'system container (offline)',+ displayName: 'system container (offline)',+ }),+ problems: ['Offline'],+ worstValue: 200,+ }))}+ />+ ));++ expect(screen.getByText('2 containers')).toBeInTheDocument();+ expect(screen.queryByText('system container (offline)')).toBeNull();});it('renders governed labels for policy-aware problem resources', () => {diff --git a/frontend-modern/src/features/dashboardOverview/dashboardPulseBriefModel.ts b/frontend-modern/src/features/dashboardOverview/dashboardPulseBriefModel.tsindex 1184a886a8..12f1fdc552 100644--- a/frontend-modern/src/features/dashboardOverview/dashboardPulseBriefModel.ts+++ b/frontend-modern/src/features/dashboardOverview/dashboardPulseBriefModel.ts@@ -1,7 +1,9 @@import type { DashboardRecoverySummary } from '@/hooks/useDashboardRecovery';import type { DashboardOverview, ProblemResource } from '@/hooks/useDashboardOverview';-import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';-import { getResourceTypeLabel } from '@/utils/resourceTypePresentation';+import {+ getProblemResourceDisplayName,+ getProblemResourceIssueLabel,+} from '@/utils/problemResourcePresentation';import type { DashboardEstateSummary } from './estateSummaryModel';export type DashboardPulseBriefTone = 'healthy' | 'attention' | 'critical';@@ -40,37 +42,22 @@ function normalizeCount(value: number | undefined): number {function problemResourceLabel(problem: ProblemResource | undefined): string | null {if (!problem) return null;- const name = getPreferredResourceDisplayName(problem.resource).trim();+ const name = getProblemResourceIssueLabel(problem.resource, problem.problems).trim();if (!name) return null;- const normalizedName = name.toLowerCase();- const typeLabel = getResourceTypeLabel(problem.resource.type)?.trim();- const typeNoun =- typeLabel && typeLabel === typeLabel.toUpperCase() ? typeLabel : typeLabel?.toLowerCase();- const normalizedTypeLabel = typeLabel?.toLowerCase();- const normalizedRawType = problem.resource.type.trim().toLowerCase().replace(/[-_]+/g, ' ');- const genericStatusNames = new Set(- [normalizedTypeLabel, normalizedRawType]- .filter((value): value is string => Boolean(value))- .flatMap((value) => [- value,- ...problem.problems.map((reason) => `${value} (${reason.toLowerCase()})`),- ]),- );- const displayName =- typeNoun && genericStatusNames.has(normalizedName) ? `the ${typeNoun} issue` : name;- const normalizedDisplayName = displayName.toLowerCase();+ const normalizedName = getProblemResourceDisplayName(problem.resource).trim().toLowerCase();+ const normalizedIssueLabel = name.toLowerCase();const reasons = problem.problems.filter((reason) => {const normalizedReason = reason.toLowerCase();return (!normalizedName.includes(normalizedReason) &&- !normalizedDisplayName.includes(normalizedReason)+ !normalizedIssueLabel.includes(normalizedReason));}).slice(0, 2).join(', ').trim();- return reasons ? `${displayName} (${reasons})` : displayName;+ return reasons ? `${name} (${reasons})` : name;}function buildAttentionParts(input: DashboardPulseBriefInput): string[] {@@ -220,7 +207,7 @@ export function buildDashboardPulseBrief(input: DashboardPulseBriefInput): Dashbrecovery: input.recovery,problemResources: input.overview.problemResources.slice(0, 3).map((problem) => ({id: problem.resource.id,- name: getPreferredResourceDisplayName(problem.resource),+ name: getProblemResourceIssueLabel(problem.resource, problem.problems),problems: problem.problems,})),patrol: {diff --git a/frontend-modern/src/utils/__tests__/problemResourcePresentation.test.ts b/frontend-modern/src/utils/__tests__/problemResourcePresentation.test.tsindex 9c305208a4..2417efb6c5 100644--- a/frontend-modern/src/utils/__tests__/problemResourcePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/problemResourcePresentation.test.ts@@ -1,5 +1,22 @@import { describe, expect, it } from 'vitest';-import { getProblemResourceStatusVariant } from '@/utils/problemResourcePresentation';+import type { Resource } from '@/types/resource';+import {+ getProblemResourceIssueLabel,+ getProblemResourceMemberLabel,+ getProblemResourceStatusVariant,+ isGenericProblemResourceDisplayName,+} from '@/utils/problemResourcePresentation';++function resource(overrides: Partial<Resource>): Resource {+ return {+ id: 'resource-1',+ type: 'storage',+ name: 'storage',+ displayName: 'storage',+ status: 'offline',+ ...overrides,+ } as Resource;+}describe('problemResourcePresentation', () => {it('treats degraded dashboard problem resources as warning', () => {@@ -10,4 +27,29 @@ describe('problemResourcePresentation', () => {expect(getProblemResourceStatusVariant(150)).toBe('danger');expect(getProblemResourceStatusVariant(200)).toBe('danger');});++ it('normalizes generic type-plus-status resource names to an issue label', () => {+ const problemResource = resource({+ id: 'storage-offline',+ name: 'storage (offline)',+ displayName: 'storage (offline)',+ });++ expect(isGenericProblemResourceDisplayName(problemResource, ['Offline'])).toBe(true);+ expect(getProblemResourceIssueLabel(problemResource, ['Offline'])).toBe('the storage issue');+ expect(getProblemResourceMemberLabel(problemResource, ['Offline'])).toBeNull();+ });++ it('preserves meaningful resource names for problem rows', () => {+ const problemResource = resource({+ id: 'vm-101',+ type: 'vm',+ name: 'database-vm',+ displayName: 'database-vm',+ });++ expect(isGenericProblemResourceDisplayName(problemResource, ['Offline'])).toBe(false);+ expect(getProblemResourceIssueLabel(problemResource, ['Offline'])).toBe('database-vm');+ expect(getProblemResourceMemberLabel(problemResource, ['Offline'])).toBe('database-vm');+ });});diff --git a/frontend-modern/src/utils/problemResourcePresentation.ts b/frontend-modern/src/utils/problemResourcePresentation.tsindex 4c8543de5f..00d6864637 100644--- a/frontend-modern/src/utils/problemResourcePresentation.ts+++ b/frontend-modern/src/utils/problemResourcePresentation.ts@@ -1,5 +1,60 @@+import type { Resource } from '@/types/resource';+import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';+import { getResourceTypeLabel } from '@/utils/resourceTypePresentation';import type { StatusIndicatorVariant } from '@/utils/status';+function normalizeProblemResourceValue(value?: string | null): string {+ return (value ?? '').trim().toLowerCase().replace(/[-_]+/g, ' ');+}++function getProblemResourceTypeNoun(resource: Resource): string | null {+ const typeLabel = getResourceTypeLabel(resource.type)?.trim();+ if (!typeLabel) return null;+ return typeLabel === typeLabel.toUpperCase() ? typeLabel : typeLabel.toLowerCase();+}++function getGenericProblemResourceNames(resource: Resource, problems: string[]): Set<string> {+ const typeLabel = normalizeProblemResourceValue(getResourceTypeLabel(resource.type));+ const rawType = normalizeProblemResourceValue(resource.type);+ const normalizedProblems = problems.map(normalizeProblemResourceValue).filter(Boolean);++ return new Set(+ [typeLabel, rawType]+ .filter(Boolean)+ .flatMap((value) => [+ value,+ ...normalizedProblems.map((problem) => `${value} (${problem})`),+ ]),+ );+}+export function getProblemResourceStatusVariant(worstValue: number): StatusIndicatorVariant {return worstValue >= 150 ? 'danger' : 'warning';}++export function getProblemResourceDisplayName(resource: Resource): string {+ return getPreferredResourceDisplayName(resource) || resource.id;+}++export function isGenericProblemResourceDisplayName(+ resource: Resource,+ problems: string[],+ displayName = getProblemResourceDisplayName(resource),+): boolean {+ return getGenericProblemResourceNames(resource, problems).has(+ normalizeProblemResourceValue(displayName),+ );+}++export function getProblemResourceIssueLabel(resource: Resource, problems: string[]): string {+ const displayName = getProblemResourceDisplayName(resource);+ const typeNoun = getProblemResourceTypeNoun(resource);+ return typeNoun && isGenericProblemResourceDisplayName(resource, problems, displayName)+ ? `the ${typeNoun} issue`+ : displayName;+}++export function getProblemResourceMemberLabel(resource: Resource, problems: string[]): string | null {+ const displayName = getProblemResourceDisplayName(resource);+ return isGenericProblemResourceDisplayName(resource, problems, displayName) ? null : displayName;+}