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.

Fix verbose governed resource labels

rcourtmanca408179223d
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 3c949994bc..45b1d71bc1 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -251,6 +251,12 @@ and it no longer repeats that same provenance as a separate `Mode` row because
the drawer header badges already own canonical source display,
and the drawer header no longer carries the technical primary identity line;
that canonical identifier now lives in the `Identity` card as `Primary ID`,
+and governed consumer identity labels now split from governed detail summaries:
+table rows, selectors, and other primary UI labels must collapse generated
+policy summaries such as `type; status; sources; redaction suffix` down to a
+concise non-sensitive identity label like `backup server (online)`, while the
+drawer governance summary and other explanation surfaces still show the full
+canonical `aiSafeSummary`,
`resourceDetailDrawerServiceModel.ts` owns the pure Docker/PBS/PMG service
summary and breakdown derivations that feed the overview service-details
surface,
diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
index 325c849416..6732e74b90 100644
--- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
+++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
@@ -17,7 +17,7 @@ import {
import { areSystemSettingsLoaded, shouldHideDockerUpdateActions } from '@/stores/systemSettings';
import {
getResourcePolicyBadges,
- getResourcePolicyDisplayLabel,
+ getResourcePolicyGovernedSummary,
getResourcePolicyRedactionLabels,
getResourceRoutingScopeLabel,
hasDefaultResourcePolicyPosture,
@@ -99,7 +99,7 @@ export const useResourceDetailDrawerDerivedState = (
const policyRedactions = createMemo(() => getResourcePolicyRedactionLabels(resource.policy));
const governanceSummary = createMemo(() =>
requiresGovernedResourceDisplay(resource.policy)
- ? getResourcePolicyDisplayLabel(resource)
+ ? getResourcePolicyGovernedSummary(resource)
: (resource.aiSafeSummary?.trim() ?? ''),
);
const hasGovernanceData = createMemo(
diff --git a/frontend-modern/src/types/__tests__/resource.test.ts b/frontend-modern/src/types/__tests__/resource.test.ts
index afa44c3d56..89c8d0059d 100644
--- a/frontend-modern/src/types/__tests__/resource.test.ts
+++ b/frontend-modern/src/types/__tests__/resource.test.ts
@@ -124,6 +124,22 @@ describe('Resource Helper Functions', () => {
expect(getPreferredResourceDisplayName(resource)).toBe('Production VM');
});
+ it('condenses generated governed summaries into concise UI labels', () => {
+ const resource = createResource({
+ name: 'pbs-secret',
+ displayName: 'PBS Secret',
+ type: 'pbs',
+ policy: {
+ sensitivity: 'sensitive',
+ routing: { scope: 'local-first', redact: ['hostname', 'platform-id'] },
+ },
+ aiSafeSummary:
+ 'backup server resource; status online; sources pbs; 1 child resources; redacted for cloud summary',
+ } as Partial<Resource>);
+
+ expect(getPreferredResourceDisplayName(resource)).toBe('backup server (online)');
+ });
+
it('falls back to the redacted policy label when the safe summary is missing', () => {
const resource = createResource({
name: 'secret-vm-1',
diff --git a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
index 2bd88058b7..df1271bc57 100644
--- a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
@@ -462,6 +462,25 @@ describe('resourceIdentity', () => {
),
).toBe('restricted host summary safe for remote AI consumption');
+ expect(
+ getPreferredResourceDisplayName(
+ makeResource({
+ name: 'pbs-secret',
+ displayName: 'PBS Secret',
+ type: 'pbs',
+ policy: {
+ sensitivity: 'sensitive',
+ routing: {
+ scope: 'local-first',
+ redact: ['hostname', 'platform-id'],
+ },
+ },
+ aiSafeSummary:
+ 'backup server resource; status online; sources pbs; 1 child resources; redacted for cloud summary',
+ }),
+ ),
+ ).toBe('backup server (online)');
+
expect(
getPreferredResourceDisplayName(
makeResource({
diff --git a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
index 2f65a3d884..4580555242 100644
--- a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
@@ -6,6 +6,7 @@ import {
RESOURCE_POLICY_SENSITIVITY_ORDER,
hasDefaultResourcePolicyPosture,
getResourcePolicyTableBadges,
+ getResourcePolicyGovernedSummary,
getResourcePolicyDisplayLabel,
getResourcePolicyRedactionSummaries,
getResourcePolicyRoutingSummaries,
@@ -76,7 +77,7 @@ describe('resourcePolicyPresentation utils', () => {
).toBe(false);
});
- it('uses the governed aiSafeSummary for redacted resources', () => {
+ it('uses concise governed labels for redacted resources', () => {
expect(
getResourcePolicyDisplayLabel({
name: 'sensitive-host',
@@ -92,6 +93,22 @@ describe('resourcePolicyPresentation utils', () => {
}),
).toBe('restricted host summary safe for remote AI consumption');
+ expect(
+ getResourcePolicyDisplayLabel({
+ name: 'pbs-secret',
+ displayName: 'PBS Secret',
+ policy: {
+ sensitivity: 'sensitive',
+ routing: {
+ scope: 'local-first',
+ redact: ['hostname', 'platform-id'],
+ },
+ },
+ aiSafeSummary:
+ 'backup server resource; status online; sources pbs; 1 child resources; redacted for cloud summary',
+ }),
+ ).toBe('backup server (online)');
+
expect(
getResourcePolicyDisplayLabel({
name: 'storage-1',
@@ -107,6 +124,26 @@ describe('resourcePolicyPresentation utils', () => {
).toBe('redacted by policy');
});
+ it('preserves the full governed summary for detail surfaces', () => {
+ expect(
+ getResourcePolicyGovernedSummary({
+ name: 'pbs-secret',
+ displayName: 'PBS Secret',
+ policy: {
+ sensitivity: 'sensitive',
+ routing: {
+ scope: 'local-first',
+ redact: ['hostname', 'platform-id'],
+ },
+ },
+ aiSafeSummary:
+ 'backup server resource; status online; sources pbs; 1 child resources; redacted for cloud summary',
+ }),
+ ).toBe(
+ 'backup server resource; status online; sources pbs; 1 child resources; redacted for cloud summary',
+ );
+ });
+
it('hides raw alternate names when policy requires governed handling', () => {
expect(
shouldShowResourceAlternateName({
diff --git a/frontend-modern/src/utils/resourcePolicyPresentation.ts b/frontend-modern/src/utils/resourcePolicyPresentation.ts
index d9c651a402..6af2d340a5 100644
--- a/frontend-modern/src/utils/resourcePolicyPresentation.ts
+++ b/frontend-modern/src/utils/resourcePolicyPresentation.ts
@@ -190,18 +190,52 @@ export const getResourcePolicyRedactionSummaries = (
false,
);
+const getConciseGovernedDisplaySummary = (summary: string): string => {
+ const trimmed = summary.trim();
+ if (!trimmed) return '';
+ if (!trimmed.includes(';')) {
+ return trimmed;
+ }
+
+ const parts = trimmed
+ .split(';')
+ .map((part) => part.trim())
+ .filter((part) => part.length > 0);
+ if (parts.length === 0) {
+ return '';
+ }
+
+ const baseLabel = parts[0].replace(/\s+resource$/i, '').trim() || parts[0];
+ const statusPart = parts.find((part, index) => index > 0 && /^status\s+/i.test(part));
+ const status = statusPart?.replace(/^status\s+/i, '').trim();
+
+ return status ? `${baseLabel} (${status})` : baseLabel;
+};
+
+export const getResourcePolicyGovernedSummary = (
+ resource?: ResourcePolicyDisplayResource | null,
+): string => {
+ if (!resource) return '';
+
+ const policy = resource.policy;
+ if (!policy || !requiresGovernedResourceDisplay(policy)) {
+ return resource.displayName?.trim() || resource.name?.trim() || '';
+ }
+
+ return resource.aiSafeSummary?.trim() || 'redacted by policy';
+};
+
export const getResourcePolicyDisplayLabel = (
resource?: ResourcePolicyDisplayResource | null,
): string => {
if (!resource) return '';
- const summary = resource.aiSafeSummary?.trim() ?? '';
const policy = resource.policy;
if (!policy) {
return resource.displayName?.trim() || resource.name?.trim() || '';
}
if (requiresGovernedResourceDisplay(policy)) {
- return summary || 'redacted by policy';
+ return getConciseGovernedDisplaySummary(getResourcePolicyGovernedSummary(resource));
}
return resource.displayName?.trim() || resource.name?.trim() || '';