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.

Apply policy-aware labels to dashboard summaries

rcourtman9821a6884bc4
diff --git a/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts b/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts
index 769a715ea6..610247a195 100644
--- a/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useDashboardOverview.test.ts
@@ -158,6 +158,8 @@ describe('computeDashboardOverview', () => {
'infra-5',
'infra-1',
]);
+ expect(overview.infrastructure.topCPU[0]?.name).toBe('Node 2');
+ expect(overview.infrastructure.topMemory[0]?.name).toBe('Cluster 6');
expect(overview.workloads.total).toBe(0);
expect(overview.storage.total).toBe(0);
@@ -186,6 +188,37 @@ describe('computeDashboardOverview', () => {
expect(overview.storage.total).toBe(0);
});
+ it('uses governed labels in dashboard summary rows when policy requires them', () => {
+ const resources: Resource[] = [
+ createResource({
+ id: 'infra-sensitive',
+ type: 'agent',
+ displayName: 'Sensitive Host',
+ name: 'sensitive-host',
+ aiSafeSummary: 'restricted host summary safe for remote AI consumption',
+ policy: {
+ sensitivity: 'restricted',
+ routing: {
+ scope: 'local-only',
+ redact: ['hostname', 'alias'],
+ },
+ },
+ status: 'online',
+ cpu: { current: 95 },
+ memory: { current: 88 },
+ }),
+ ];
+
+ const overview = computeDashboardOverview(resources, []);
+
+ expect(overview.infrastructure.topCPU[0]?.name).toBe(
+ 'restricted host summary safe for remote AI consumption',
+ );
+ expect(overview.infrastructure.topMemory[0]?.name).toBe(
+ 'restricted host summary safe for remote AI consumption',
+ );
+ });
+
it('handles full mixed resources including storage thresholds and byte totals', () => {
const resources: Resource[] = [
createResource({
diff --git a/frontend-modern/src/hooks/useDashboardOverview.ts b/frontend-modern/src/hooks/useDashboardOverview.ts
index 2caf6152c7..eaa1bb0b1e 100644
--- a/frontend-modern/src/hooks/useDashboardOverview.ts
+++ b/frontend-modern/src/hooks/useDashboardOverview.ts
@@ -4,6 +4,7 @@ import type { Resource, ResourceMetric, ResourceStatus } from '@/types/resource'
import { isInfrastructure, isStorage, isWorkload } from '@/types/resource';
import { METRIC_THRESHOLDS, getMetricSeverity } from '@/utils/metricThresholds';
import { OFFLINE_HEALTH_STATUSES, DEGRADED_HEALTH_STATUSES } from '@/utils/status';
+import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';
export interface ProblemResource {
resource: Resource;
@@ -99,7 +100,7 @@ function buildTopInfrastructureMetrics(
return {
id: resource.id,
- name: resource.displayName || resource.name,
+ name: getPreferredResourceDisplayName(resource),
percent,
};
})
diff --git a/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx b/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx
index 2036131603..c72e77cda6 100644
--- a/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx
+++ b/frontend-modern/src/pages/DashboardPanels/ProblemResourcesTable.tsx
@@ -21,6 +21,7 @@ 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 AlertTriangleIcon from 'lucide-solid/icons/alert-triangle';
interface ProblemResourcesTableProps {
@@ -78,9 +79,9 @@ export function ProblemResourcesTable(props: ProblemResourcesTableProps) {
<a
href={resourceLink(pr)}
class="text-xs font-medium text-base-content hover:underline truncate block max-w-[200px]"
- title={pr.resource.displayName || pr.resource.name}
+ title={getPreferredResourceDisplayName(pr.resource)}
>
- {pr.resource.displayName || pr.resource.name}
+ {getPreferredResourceDisplayName(pr.resource)}
</a>
</TableCell>
<TableCell class="hidden sm:table-cell">
diff --git a/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx b/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx
index 511688f4cd..983cc9ab8e 100644
--- a/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx
+++ b/frontend-modern/src/pages/DashboardPanels/__tests__/ProblemResourcesTable.test.tsx
@@ -54,4 +54,38 @@ describe('ProblemResourcesTable', () => {
expect(storageLink.tagName).toBe('A');
expect(storageLink.getAttribute('href')).toBe('/storage');
});
+
+ it('renders governed labels for policy-aware problem resources', () => {
+ render(() => (
+ <ProblemResourcesTable
+ problems={[
+ {
+ resource: makeResource({
+ id: 'governed-1',
+ name: 'sensitive-host',
+ displayName: 'Sensitive Host',
+ aiSafeSummary: 'restricted host summary safe for remote AI consumption',
+ policy: {
+ sensitivity: 'restricted',
+ routing: {
+ scope: 'local-only',
+ redact: ['hostname', 'alias'],
+ },
+ },
+ }),
+ problems: ['Offline'],
+ worstValue: 200,
+ },
+ ]}
+ />
+ ));
+
+ const resourceLink = screen.getByText('restricted host summary safe for remote AI consumption');
+ expect(resourceLink.tagName).toBe('A');
+ expect(resourceLink.getAttribute('title')).toBe(
+ 'restricted host summary safe for remote AI consumption',
+ );
+ expect(screen.queryByText('Sensitive Host')).toBeNull();
+ expect(screen.queryByText('sensitive-host')).toBeNull();
+ });
});