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.

Hide redundant platform ids in drawer

rcourtmanc69979556fd5
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 92a54758e5..d4ef34a729 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -436,9 +436,10 @@ while deeper machine detail remains available on demand.
That host-details section now reads as a simple vertical stack of detail cards
instead of a wrapped card grid, so the opened state stays linear instead of
feeling like a second dashboard.
-Within that summary shell, current-state facts now stay operational: platform
-IDs, quick links, and platform-signal badges remain with runtime status,
-while aliases, IPs, and tags live only under the dedicated `Identity` card.
+Within that summary shell, current-state facts now stay operational: only
+distinct platform IDs, quick links, and platform-signal badges remain with
+runtime status, while aliases, IPs, and tags live only under the dedicated
+`Identity` card.
That keeps first read status-first while still preserving canonical identity
metadata on the same top-level summary surface instead of mixing identity
support details into current-state chrome.
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
index 7ab0756c96..dba79002c0 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
@@ -36,6 +36,7 @@ import {
} from '@/utils/resourceChangePresentation';
import { formatConfidenceLabel } from '@/utils/confidencePresentation';
import { formatIdentifierLabel } from '@/utils/textPresentation';
+import { shouldShowResourcePlatformId } from '@/utils/resourceIdentity';
import { buildInfrastructureResourceHref } from '@/routing/resourceLinks';
import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
import { formatInteger, formatSourceType } from './resourceDetailMappers';
@@ -83,6 +84,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver
props,
) => {
const { resource, drawer } = props;
+ const showPlatformId = shouldShowResourcePlatformId(resource);
return (
<div class="space-y-3">
@@ -141,7 +143,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver
</span>
</div>
</Show>
- <Show when={resource.platformId && !drawer.hasRuntimeOperationalContext()}>
+ <Show when={showPlatformId && !drawer.hasRuntimeOperationalContext()}>
<div class="flex items-center justify-between gap-2">
<span class="text-muted">Platform ID</span>
<span class="font-medium text-base-content truncate" title={resource.platformId}>
@@ -154,7 +156,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver
<div class="space-y-2.5">
<Show when={drawer.hasRuntimeOperationalContext()}>
<div class="space-y-1.5">
- <Show when={resource.platformId}>
+ <Show when={showPlatformId}>
<div class="flex items-center justify-between gap-2">
<span class="text-muted">Platform ID</span>
<span
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 53d4e27d0b..683ed754d5 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
@@ -321,7 +321,7 @@ describe('ResourceDetailDrawer change history section', () => {
).toBeNull();
expect(screen.queryByText('Details')).toBeNull();
expect(screen.queryByRole('button', { name: 'Show details' })).toBeNull();
- expect(screen.getByText('Platform ID')).toBeInTheDocument();
+ expect(screen.queryByText('Platform ID')).toBeNull();
expect(within(identitySection).getByText('Tags')).toBeInTheDocument();
expect(within(currentStateSection).queryByText('Tags')).toBeNull();
expect(
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 7eb10743a8..7fd27ff2a2 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
@@ -127,7 +127,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getByText('2/2 healthy')).toBeInTheDocument();
expect(getByText('Mode')).toBeInTheDocument();
expect(getByText('Hybrid')).toBeInTheDocument();
- expect(getByText('Platform ID')).toBeInTheDocument();
+ expect(() => getByText('Platform ID')).toThrow();
expect(getByText('Quick links')).toBeInTheDocument();
expect(queryByRole('button', { name: 'Show details' })).toBeNull();
expect(() => getByText('Runtime')).toThrow();
@@ -253,7 +253,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getAllByText('PMG').length).toBeGreaterThan(0);
expect(getByText('Mode')).toBeInTheDocument();
expect(getByText('API')).toBeInTheDocument();
- expect(getByText('Platform ID')).toBeInTheDocument();
+ expect(queryByText('Platform ID')).toBeNull();
expect(queryByText('Details')).toBeNull();
expect(queryByText('Show details')).toBeNull();
});
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.service-cards.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.service-cards.test.tsx
index 9c278cbe0a..12ef896ec6 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.service-cards.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.service-cards.test.tsx
@@ -73,7 +73,7 @@ describe('ResourceDetailDrawer service cards', () => {
type: 'pbs',
name: 'pbs-main',
displayName: 'PBS Main',
- platformId: 'pbs-main',
+ platformId: '192.168.0.8',
platformType: 'proxmox-pbs',
platformData: {
sources: ['pbs'],
@@ -121,7 +121,7 @@ describe('ResourceDetailDrawer service cards', () => {
type: 'pmg',
name: 'pmg-main',
displayName: 'PMG Main',
- platformId: 'pmg-main',
+ platformId: '192.168.0.25',
platformType: 'proxmox-pmg',
platformData: {
sources: ['pmg'],
diff --git a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
index 4b376b8d9a..8c13427065 100644
--- a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
@@ -18,6 +18,7 @@ import {
getPrimaryResourceIdentity,
getPrimaryResourceIdentityRows,
getResourceIdentityAliases,
+ shouldShowResourcePlatformId,
} from '@/utils/resourceIdentity';
import type { Agent, Node } from '@/types/api';
@@ -213,6 +214,38 @@ describe('resourceIdentity', () => {
expect(getPreferredResourceKubernetesContext(resource)).toBe('cluster-a');
});
+ it('hides platform ids that duplicate canonical identity labels', () => {
+ expect(
+ shouldShowResourcePlatformId(
+ makeResource({
+ name: 'delly',
+ displayName: 'delly',
+ platformId: 'delly',
+ canonicalIdentity: {
+ displayName: 'delly',
+ hostname: 'delly',
+ },
+ }),
+ ),
+ ).toBe(false);
+ });
+
+ it('keeps platform ids when they add distinct identity context', () => {
+ expect(
+ shouldShowResourcePlatformId(
+ makeResource({
+ name: 'pbs-main',
+ displayName: 'PBS Main',
+ platformId: '192.168.0.8',
+ canonicalIdentity: {
+ displayName: 'pbs-main',
+ hostname: 'pbs-main',
+ },
+ }),
+ ),
+ ).toBe(true);
+ });
+
it('builds agent-like aliases for legacy summary/detail surfaces', () => {
const agent = {
id: 'agent-explicit',
diff --git a/frontend-modern/src/utils/resourceIdentity.ts b/frontend-modern/src/utils/resourceIdentity.ts
index c7ec8336bd..e5c7b00d59 100644
--- a/frontend-modern/src/utils/resourceIdentity.ts
+++ b/frontend-modern/src/utils/resourceIdentity.ts
@@ -303,6 +303,32 @@ export const getPreferredResourceHostname = (resource: Resource): string | undef
);
};
+export const shouldShowResourcePlatformId = (resource: Resource): boolean => {
+ const canonical = getCanonicalIdentityRecord(resource);
+ const platformData = getPlatformDataRecord(resource);
+ const platformAgent = getPlatformAgentRecord(resource);
+ const docker = platformData?.docker as Record<string, unknown> | undefined;
+ const pbs = platformData?.pbs as Record<string, unknown> | undefined;
+ const pmg = platformData?.pmg as Record<string, unknown> | undefined;
+ const platformId = asTrimmedString(resource.platformId);
+
+ if (!platformId) return false;
+
+ const redundantIdentityValues = dedupeTrimmedValues([
+ asTrimmedString(resource.displayName),
+ asTrimmedString(canonical?.displayName),
+ asTrimmedString(resource.name),
+ asTrimmedString(canonical?.hostname),
+ resource.identity?.hostname,
+ asTrimmedString(platformAgent?.hostname),
+ asTrimmedString(docker?.hostname),
+ asTrimmedString(pbs?.hostname),
+ asTrimmedString(pmg?.hostname),
+ ]);
+
+ return !redundantIdentityValues.some((value) => value.toLowerCase() === platformId.toLowerCase());
+};
+
export { getPreferredResourceKubernetesContext };
export { getPreferredResourceClusterName };