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.

Use policy-aware labels in thresholds table

rcourtmana40a9ae8f61f
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index c8bca7ba02..843ea6f97d 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -106,6 +106,10 @@ duplicated inline across the alerts page and overview timeline surfaces.
Alert resource tables now route resource labels and row action labels through
the shared policy-aware resource identity helper so governed resources do not
fall back to raw names inside the alerts surface.
+Alert threshold tables now route their visible resource row labels, search
+labels, and persisted override display names through the same shared helper
+so governed agent, guest, and storage rows do not leak raw names when the
+threshold editor saves or re-renders them.
Alert incident timeline event cards now route through
`frontend-modern/src/components/Alerts/IncidentTimelineEventCard.tsx`,
diff --git a/frontend-modern/src/components/Alerts/ThresholdsTable.tsx b/frontend-modern/src/components/Alerts/ThresholdsTable.tsx
index a0027817a4..7e7e9c48ea 100644
--- a/frontend-modern/src/components/Alerts/ThresholdsTable.tsx
+++ b/frontend-modern/src/components/Alerts/ThresholdsTable.tsx
@@ -403,7 +403,7 @@ export function ThresholdsTable(props: ThresholdsTableProps) {
const note = typeof override?.note === 'string' ? override.note : undefined;
const hasNote = Boolean(note && note.trim().length > 0);
- const originalDisplayName = node.displayName?.trim() || node.name;
+ const originalDisplayName = getPreferredResourceDisplayName(node);
const friendlyName = getFriendlyNodeName(originalDisplayName, clusterName);
const rawName = node.name;
const sanitizedName = friendlyName || originalDisplayName || rawName.split('.')[0] || rawName;
@@ -429,7 +429,7 @@ export function ThresholdsTable(props: ThresholdsTableProps) {
id: node.id,
name: sanitizedName,
displayName: sanitizedName,
- rawName: originalDisplayName,
+ rawName: node.name,
host: normalizedHost,
type: 'agent' as const,
resourceType: 'Agent',
@@ -479,11 +479,7 @@ export function ThresholdsTable(props: ThresholdsTableProps) {
);
});
- const displayName =
- agentResource.displayName?.trim() ||
- agentResource.identity?.hostname ||
- agentResource.name ||
- agentResource.id;
+ const displayName = getPreferredResourceDisplayName(agentResource);
const status = agentResource.status;
const data = pd(agentResource);
const agentData = asRecord(data?.agent);
@@ -1196,7 +1192,9 @@ export function ThresholdsTable(props: ThresholdsTableProps) {
return {
id: guestId,
- name: guest.name,
+ name: getPreferredResourceDisplayName(guest),
+ displayName: getPreferredResourceDisplayName(guest),
+ rawName: guest.name,
type: 'guest' as const,
resourceType: guest.type === 'vm' ? 'VM' : 'Container',
vmid,
@@ -1474,7 +1472,9 @@ export function ThresholdsTable(props: ThresholdsTableProps) {
return {
id: storage.id,
- name: storage.name,
+ name: getPreferredResourceDisplayName(storage),
+ displayName: getPreferredResourceDisplayName(storage),
+ rawName: storage.name,
type: 'storage' as const,
resourceType: 'Storage',
node: coords.node,
diff --git a/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx b/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx
index a895418bec..51a90a3530 100644
--- a/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx
+++ b/frontend-modern/src/components/Alerts/__tests__/ThresholdsTable.test.tsx
@@ -305,6 +305,32 @@ describe('ThresholdsTable Resource Rendering', () => {
expect(screen.getByTestId('resource-name-h1')).toHaveTextContent('Host 1');
});
+ it('renders governed agents with the policy-aware display label', async () => {
+ setPathname('/alerts/thresholds/agents');
+ const host = {
+ id: 'h2',
+ hostname: 'secret-host',
+ displayName: 'Secret Host',
+ status: 'online',
+ lastSeen: 123,
+ memory: { total: 100, used: 50, free: 50, usage: 50 },
+ policy: {
+ sensitivity: 'restricted',
+ routing: { scope: 'local-only', redact: ['hostname'] },
+ },
+ aiSafeSummary: 'redacted by policy',
+ } as Agent & { policy: unknown; aiSafeSummary: string };
+
+ render(() => <ThresholdsTable {...(baseProps() as any)} agents={[host]} />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId('resource-table-Agents')).toBeInTheDocument();
+ });
+
+ expect(screen.getByTestId('resource-name-h2')).toHaveTextContent('redacted by policy');
+ expect(screen.getByTestId('resource-name-h2')).not.toHaveTextContent('secret-host');
+ });
+
it('renders proxmox nodes and guests correctly', async () => {
setPathname('/alerts/thresholds/proxmox');
const node = {
@@ -334,6 +360,57 @@ describe('ThresholdsTable Resource Rendering', () => {
expect(screen.getByTestId('section-VMs & Containers')).toBeInTheDocument();
expect(screen.getByTestId('resource-name-guest1')).toHaveTextContent('vm1');
});
+
+ it('renders governed guests with the policy-aware display label', async () => {
+ setPathname('/alerts/thresholds/proxmox');
+ const guest = {
+ id: 'guest2',
+ name: 'secret-vm-2',
+ vmid: 200,
+ status: 'running',
+ node: 'pve1',
+ displayName: 'Secret VM 2',
+ policy: {
+ sensitivity: 'restricted',
+ routing: { scope: 'local-only', redact: ['hostname'] },
+ },
+ aiSafeSummary: 'redacted by policy',
+ } as any;
+
+ render(() => <ThresholdsTable {...(baseProps() as any)} allGuests={() => [guest]} />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId('section-VMs & Containers')).toBeInTheDocument();
+ });
+
+ expect(screen.getByTestId('resource-name-guest2')).toHaveTextContent('redacted by policy');
+ expect(screen.getByTestId('resource-name-guest2')).not.toHaveTextContent('secret-vm-2');
+ });
+
+ it('renders governed storage with the policy-aware display label', async () => {
+ setPathname('/alerts/thresholds/proxmox');
+ const storage = {
+ id: 'storage1',
+ name: 'secret-datastore',
+ status: 'available',
+ node: 'pve1',
+ displayName: 'Secret Datastore',
+ policy: {
+ sensitivity: 'restricted',
+ routing: { scope: 'local-only', redact: ['path'] },
+ },
+ aiSafeSummary: 'redacted by policy',
+ } as any;
+
+ render(() => <ThresholdsTable {...(baseProps() as any)} storage={[storage]} />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId('resource-name-storage1')).toBeInTheDocument();
+ });
+
+ expect(screen.getByTestId('resource-name-storage1')).toHaveTextContent('redacted by policy');
+ expect(screen.getByTestId('resource-name-storage1')).not.toHaveTextContent('secret-datastore');
+ });
});
describe('ThresholdsTable Metric Formatting', () => {