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.

Move primary id into drawer identity card

rcourtmanc2b788f5532c
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 492677afef..3b35d0da91 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -182,6 +182,8 @@ canonical header badges while only surfacing a `Sources` row when source
health is degraded or unhealthy,
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`,
`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/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index 30f9600582..11657226b9 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -61,9 +61,6 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
{drawer.displayName()}
</div>
</div>
- <div class="text-[11px] text-muted truncate" title={drawer.headerIdentity()}>
- {drawer.headerIdentity()}
- </div>
<div class="flex flex-wrap gap-1.5" data-testid="resource-header-badges">
<For each={drawer.headerBadges()}>
{(badge) => (
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
index 26e7fe268b..8b4743834c 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
@@ -127,6 +127,7 @@ describe('ResourceDetailDrawer change history section', () => {
expect(resourceDetailDrawerShellSource).toContain("from './ResourceDetailDrawerDebugTab'");
expect(resourceDetailDrawerShellSource).toContain('data-testid="resource-header-badges"');
expect(resourceDetailDrawerShellSource).toContain('drawer.headerBadges()');
+ expect(resourceDetailDrawerShellSource).not.toContain('drawer.headerIdentity()');
expect(resourceDetailDrawerShellSource).not.toContain('drawer.unifiedSourceBadges()');
expect(resourceDetailDrawerShellSource).not.toContain('Change history');
expect(resourceDetailDrawerStateSource).toContain("from './useResourceDetailDrawerHistoryState'");
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
index 1d9baaba05..4ad000f24b 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
@@ -117,7 +117,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
},
});
- const { getByTestId, getByText, queryByRole } = render(() => (
+ const { container, getByTestId, getByText, queryByRole } = render(() => (
<ResourceDetailDrawer resource={resource} />
));
@@ -131,6 +131,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getByTestId('resource-current-state-section').querySelector('.border-dashed')).toBeNull();
expect(queryByRole('button', { name: 'Show details' })).toBeNull();
expect(() => getByText('Runtime')).toThrow();
+ expect(container.querySelector('.text-\\[11px\\].text-muted.truncate')).toBeNull();
const headerBadges = getByTestId('resource-header-badges');
expect(within(headerBadges).getAllByText('Agent')).toHaveLength(1);
expect(within(headerBadges).getByText('PVE')).toBeInTheDocument();
@@ -337,6 +338,29 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(sparseRender.getByText('No identity metadata yet.')).toBeInTheDocument();
});
+ it('moves the primary identity into the identity card instead of the header subtitle', () => {
+ const resource = baseResource({
+ displayName: 'delly',
+ name: 'delly',
+ platformId: 'delly',
+ canonicalIdentity: {
+ displayName: 'delly',
+ hostname: 'delly',
+ primaryId: 'node:homelab-delly',
+ aliases: ['node:homelab-delly', 'delly'],
+ },
+ identity: {
+ hostname: 'delly',
+ },
+ });
+
+ const { container, getByText } = render(() => <ResourceDetailDrawer resource={resource} />);
+
+ expect(container.querySelector('.text-\\[11px\\].text-muted.truncate')).toBeNull();
+ expect(getByText('Primary ID')).toBeInTheDocument();
+ expect(getByText('Primary ID').parentElement?.textContent).toContain('node:homelab-delly');
+ });
+
it('shows canonical metrics target identity for docker-backed host resources', () => {
const resource = baseResource({
id: 'hash-docker-resource',
@@ -370,7 +394,8 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getAllByText('docker-host:docker-host-1').length).toBeGreaterThan(1);
expect(getByText('Aliases')).toBeInTheDocument();
expect(getAllByText('docker-host-1').length).toBeGreaterThan(0);
- expect(container.querySelector('.text-\\[11px\\].text-muted.truncate')?.textContent).toBe(
+ expect(container.querySelector('.text-\\[11px\\].text-muted.truncate')).toBeNull();
+ expect(getByText('Primary ID').parentElement?.textContent).toContain(
'docker-host:docker-host-1',
);
});
diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
index 487eb47f0f..dd8aec23e7 100644
--- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
+++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
@@ -11,7 +11,6 @@ import {
getUnifiedSourceBadges,
} from '@/utils/resourceBadgePresentation';
import {
- getPrimaryResourceIdentity,
getPrimaryResourceIdentityRows,
getResourceIdentityAliases,
getPreferredResourceClusterName,
@@ -271,7 +270,6 @@ export const useResourceDetailDrawerDerivedState = (
});
});
- const headerIdentity = createMemo(() => getPrimaryResourceIdentity(resource));
const relatedLinks = createMemo(() => buildRelatedLinks(resource, displayName()));
const hasRuntimeOperationalContext = createMemo(
() => buildHasRuntimeOperationalContext(kubernetesCapabilityBadges(), relatedLinks()),
@@ -408,7 +406,6 @@ export const useResourceDetailDrawerDerivedState = (
hostDetailSummary,
hasServiceDetails,
serviceDetailsSummary,
- headerIdentity,
relatedLinks,
hasRuntimeOperationalContext,
sourceSections,
diff --git a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
index 8c13427065..2bd88058b7 100644
--- a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
@@ -80,10 +80,10 @@ describe('resourceIdentity', () => {
'legacy-host.local',
]);
expect(getPreferredResourceHostname(resource)).toBe('tower.local');
- expect(getPrimaryResourceIdentityRows(resource)[0]).toEqual({
- label: 'Hostname',
- value: 'tower.local',
- });
+ expect(getPrimaryResourceIdentityRows(resource)).toEqual([
+ { label: 'Hostname', value: 'tower.local' },
+ { label: 'Primary ID', value: 'node:instance-pve1' },
+ ]);
});
it('uses actionable linked identities before falling back to unified ids', () => {
@@ -161,6 +161,7 @@ describe('resourceIdentity', () => {
),
).toEqual([
{ label: 'Hostname', value: 'tower.local' },
+ { label: 'Primary ID', value: 'docker-host:docker-host-1' },
{ label: 'Machine ID', value: 'machine-1' },
{ label: 'Cluster', value: 'cluster-a' },
{ label: 'Parent', value: 'parent-1' },
diff --git a/frontend-modern/src/utils/resourceIdentity.ts b/frontend-modern/src/utils/resourceIdentity.ts
index e5c7b00d59..fa618df2b2 100644
--- a/frontend-modern/src/utils/resourceIdentity.ts
+++ b/frontend-modern/src/utils/resourceIdentity.ts
@@ -250,10 +250,26 @@ export const getPreferredNormalizedPlatformId = (resource: APINormalizedIdentity
export const getPrimaryResourceIdentityRows = (resource: Resource): ResourceIdentityRow[] => {
const canonical = getCanonicalIdentityRecord(resource);
const rows: ResourceIdentityRow[] = [];
+ const primaryIdentity = getPrimaryResourceIdentity(resource);
const hostname = asTrimmedString(canonical?.hostname) || resource.identity?.hostname;
if (hostname) {
rows.push({ label: 'Hostname', value: hostname });
}
+ const redundantPrimaryIdentityValues = dedupeTrimmedValues([
+ asTrimmedString(resource.displayName),
+ asTrimmedString(canonical?.displayName),
+ asTrimmedString(resource.name),
+ hostname,
+ asTrimmedString(resource.platformId),
+ ]);
+ if (
+ primaryIdentity &&
+ !redundantPrimaryIdentityValues.some(
+ (value) => value.toLowerCase() === primaryIdentity.toLowerCase(),
+ )
+ ) {
+ rows.push({ label: 'Primary ID', value: primaryIdentity });
+ }
if (resource.identity?.machineId) {
rows.push({ label: 'Machine ID', value: resource.identity.machineId });
}