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
Centralize policy ordering
rcourtman81446f4bb9a4
diff --git a/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx b/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsxindex bffc862cd9..02c53bd06d 100644--- a/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx@@ -1,33 +1,14 @@import { For, Show, type Component } from 'solid-js';import type { IntelligencePolicyPostureSummary } from '@/types/aiIntelligence';-import type {- ResourceRedactionHint,- ResourceRoutingScope,- ResourceSensitivity,-} from '@/types/resource';import {+ RESOURCE_POLICY_REDACTION_ORDER,+ RESOURCE_POLICY_ROUTING_ORDER,+ RESOURCE_POLICY_SENSITIVITY_ORDER,getResourceRedactionHintLabel,getResourceRoutingScopeLabel,getResourceSensitivityLabel,} from '@/utils/resourcePolicyPresentation';-const policySensitivityOrder: ResourceSensitivity[] = [- 'public',- 'internal',- 'sensitive',- 'restricted',-];--const policyRoutingOrder: ResourceRoutingScope[] = ['cloud-summary', 'local-first', 'local-only'];--const policyRedactionOrder: ResourceRedactionHint[] = [- 'hostname',- 'ip-address',- 'platform-id',- 'alias',- 'path',-];-interface ResourcePolicySummaryProps {posture?: IntelligencePolicyPostureSummary | null;title?: string;@@ -52,7 +33,7 @@ export const ResourcePolicySummary: Component<ResourcePolicySummaryProps> = (pro</div><dl class="mt-3 grid grid-cols-2 gap-2 text-sm">- <For each={policySensitivityOrder}>+ <For each={RESOURCE_POLICY_SENSITIVITY_ORDER}>{(sensitivity) => {const count = () => value().sensitivity_counts?.[sensitivity] ?? 0;return (@@ -65,7 +46,7 @@ export const ResourcePolicySummary: Component<ResourcePolicySummaryProps> = (pro);}}</For>- <For each={policyRoutingOrder}>+ <For each={RESOURCE_POLICY_ROUTING_ORDER}>{(scope) => {const count = () => value().routing_counts?.[scope] ?? 0;return (@@ -81,10 +62,12 @@ export const ResourcePolicySummary: Component<ResourcePolicySummaryProps> = (pro</dl><Show- when={policyRedactionOrder.some((hint) => (value().redaction_counts?.[hint] ?? 0) > 0)}+ when={RESOURCE_POLICY_REDACTION_ORDER.some(+ (hint) => (value().redaction_counts?.[hint] ?? 0) > 0,+ )}><div class="mt-2 flex flex-wrap gap-1">- <For each={policyRedactionOrder}>+ <For each={RESOURCE_POLICY_REDACTION_ORDER}>{(hint) => {const count = value().redaction_counts?.[hint] ?? 0;if (!count) return null;diff --git a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.tsindex 05c43645b1..4d10193aed 100644--- a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts@@ -1,6 +1,9 @@import { describe, expect, it } from 'vitest';import {+ RESOURCE_POLICY_REDACTION_ORDER,+ RESOURCE_POLICY_ROUTING_ORDER,+ RESOURCE_POLICY_SENSITIVITY_ORDER,getResourcePolicyRedactionLabels,getResourceRedactionHintLabel,getResourceRoutingScopeLabel,@@ -27,4 +30,21 @@ describe('resourcePolicyPresentation utils', () => {}),).toEqual(['Hostname', 'IP Address']);});++ it('exports canonical policy ordering', () => {+ expect(RESOURCE_POLICY_SENSITIVITY_ORDER).toEqual([+ 'public',+ 'internal',+ 'sensitive',+ 'restricted',+ ]);+ expect(RESOURCE_POLICY_ROUTING_ORDER).toEqual(['cloud-summary', 'local-first', 'local-only']);+ expect(RESOURCE_POLICY_REDACTION_ORDER).toEqual([+ 'hostname',+ 'ip-address',+ 'platform-id',+ 'alias',+ 'path',+ ]);+ });});diff --git a/frontend-modern/src/utils/resourcePolicyPresentation.ts b/frontend-modern/src/utils/resourcePolicyPresentation.tsindex 1dc09e3b7f..c7ac13934a 100644--- a/frontend-modern/src/utils/resourcePolicyPresentation.ts+++ b/frontend-modern/src/utils/resourcePolicyPresentation.ts@@ -11,6 +11,27 @@ type PolicyBadgePresentation = {className: string;};+export const RESOURCE_POLICY_SENSITIVITY_ORDER: ResourceSensitivity[] = [+ 'public',+ 'internal',+ 'sensitive',+ 'restricted',+];++export const RESOURCE_POLICY_ROUTING_ORDER: ResourceRoutingScope[] = [+ 'cloud-summary',+ 'local-first',+ 'local-only',+];++export const RESOURCE_POLICY_REDACTION_ORDER: ResourceRedactionHint[] = [+ 'hostname',+ 'ip-address',+ 'platform-id',+ 'alias',+ 'path',+];+const badgeBaseClass ='inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium whitespace-nowrap';