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.

Centralize Docker command label formatting

rcourtman5f90b66ec9eb
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index 36285dd38b..2469a941c7 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -67,7 +67,7 @@ import {
getResourceChangeSourceTypePresentation,
} from '@/utils/resourceChangePresentation';
import { formatConfidenceLabel } from '@/utils/confidencePresentation';
-import { humanizeToken } from '@/utils/textPresentation';
+import { formatIdentifierLabel, humanizeToken } from '@/utils/textPresentation';
import type { ResourceIntelligence } from '@/types/aiIntelligence';
import { buildInfrastructureResourceHref } from '@/routing/resourceLinks';
@@ -1105,7 +1105,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
<div class="flex items-center justify-between gap-2">
<span class="text-muted">Command</span>
<span class="font-medium text-base-content">
- {(dockerHostCommand()?.type || 'command').replace(/_/g, ' ')}
+ {formatIdentifierLabel(dockerHostCommand()?.type, { fallback: 'command' })}
</span>
</div>
<div class="mt-1 flex items-center justify-between gap-2">
@@ -1113,7 +1113,7 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
<span
class={`font-medium ${dockerHostCommandActive() ? 'text-sky-700 dark:text-sky-300' : 'text-base-content'}`}
>
- {(dockerHostCommand()?.status || 'unknown').replace(/_/g, ' ')}
+ {formatIdentifierLabel(dockerHostCommand()?.status, { fallback: 'unknown' })}
</span>
</div>
<Show when={dockerHostCommand()?.message}>
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index d91e56f732..6166b020a6 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -1920,6 +1920,7 @@ describe('frontend resource type boundaries', () => {
expect(confidencePresentationSource).toContain('formatConfidenceLabel');
expect(approvalPresentationSource).toContain('getResourceApprovalLevelLabel');
expect(throughputPresentationSource).toContain('formatThroughputRate');
+ expect(resourceDetailDrawerSource).toContain('formatIdentifierLabel');
expect(resourceChangePresentationSource).toContain('humanizeToken');
expect(resourceRelationshipPresentationSource).toContain('humanizeToken');
expect(resourceCorrelationPresentationSource).toContain('humanizeToken');