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 infrastructure resource badge stacking

rcourtman1531f8cef465
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index db75414486..5c887d6e42 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -971,14 +971,18 @@ surplus width is redistributed across peer metric, source, uptime, and action
columns instead of being dumped into the first column and wasting operator
visible table density.
That hot-path contract now includes policy badge rendering on resource rows.
+Policy-rich table rows must collapse to a single inline policy summary chip
+instead of stacking sensitivity and routing badges inside the resource column.
Agentless availability evidence belongs on that same bounded row path.
Infrastructure `network-endpoint` rows may replace otherwise empty host metric
-slots with one compact inline probe method/result readout. Recent check timing,
-latency history, and fuller failure context may stay in bounded tooltip or
-drawer detail, but the table must not duplicate the same probe evidence across
-the resource identity cell and metric cells. That text must derive from the
-existing resource payload and shared presentation helper instead of adding a
-per-row fetch, extra hydration pass, or unbounded badge stack.
+slots with one compact inline target/result readout, while the System column
+owns the protocol identity badge (`ICMP`, `TCP`, or `HTTP`). Recent check
+timing, latency history, and fuller failure context may stay in bounded
+tooltip or drawer detail, but the table must not duplicate the same probe
+protocol and result text across the resource identity cell and metric cells.
+That text must derive from the existing resource payload and shared
+presentation helper instead of adding a per-row fetch, extra hydration pass, or
+unbounded badge stack.
The infrastructure summary hot path is now explicit shared ownership too:
`InfrastructureSummary.tsx` stays a render shell,
`useInfrastructureSummaryState.ts` owns chart polling and cache lifecycle, and
@@ -990,8 +994,10 @@ The summary API feeding that hot path must also normalize mixed-resolution
history into equal-time summary buckets before it reaches the shell/runtime
owners, so long-range cards do not bunch recent higher-resolution samples at
the right edge.
-It now also includes the compact resource-facet summary chips rendered next
-to policy metadata, and those chips must stay within the same bounded
+It now also includes compact resource-facet summary chips rendered next to
+policy metadata, and table-row uses must set an explicit visible chip limit
+with overflow disclosure instead of allowing mock-rich resource rows to wrap
+an unbounded badge list. Those chips must stay within the same bounded
windowing and mounted-row budget proved by
`UnifiedResourceTable.performance.contract.test.tsx`.
The same facet summary contract applies to the service-resource rows inside
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 2d70776f39..38716fc97a 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -528,11 +528,14 @@ availability data is still `platformType=availability`, `sourceType=api`, and
must not regress to a generic platform badge in infrastructure rows or drawers.
Infrastructure row presentation must also consume that availability payload as
operator evidence, not only as badge identity. `network-endpoint` rows should
-surface one visible probe readout, method plus latest latency or failure
-result, from either the top-level availability field or the live-state
-`platformData.availability` mirror. Recent check timing and fuller failure
-context may stay in tooltip or drawer detail, but the table row must not show
-the same probe evidence in both the resource identity cell and metric cell.
+surface one visible probe readout from either the top-level availability field
+or the live-state `platformData.availability` mirror: the System column uses
+the probe protocol as the compact identity badge (`ICMP`, `TCP`, or `HTTP`),
+while the metric cell shows only the target detail and latest latency or
+failure result, such as `6053: 11 ms`, `/status: 503`, `3 ms`, or `timed out`.
+Recent check timing and fuller failure context may stay in tooltip or drawer
+detail, but the table row must not duplicate the same probe protocol and
+result text across both identity and metric cells.
That same frontend-owned compatibility boundary must remain intentionally
narrow. Shared resource adapters may admit explicit aliases such as `host`,
`truenas`, and `ceph`, and VMware detail mappers may project typed metadata
@@ -723,7 +726,7 @@ defaults. The shared resource graph must therefore see one coherent mock
platform set regardless of whether a platform is snapshot-backed or
supplemental-provider-backed.
Agentless availability fixtures join that same graph-owned seed contract:
-mock UPS, MQTT, HTTP, and controller endpoints must project as
+mock UPS, MQTT, ESPHome, HTTP, and controller endpoints must project as
`SourceAvailability` `network-endpoint` resources with real availability
payloads, incidents, and source status rather than as generic host rows or
settings-only sample data.
@@ -1599,10 +1602,14 @@ must preserve both canonical unified-resource semantics and the table
performance proof route. The shared resource table and resource drawer now
surface compact timeline summary chips, so facet presentation changes must
continue to flow through the same governed resource-row surface rather than
-inventing a separate ad hoc summary path. Those row summaries now prefer
-canonical `facetCounts` on the resource object when available, so the backend
-list/read shapes remain the source of truth instead of forcing the frontend to
-infer totals only from loaded slices. The drawer now fetches those facets
+inventing a separate ad hoc summary path. Dense table rows must bound those
+chips with an explicit visible limit and overflow label, while policy-rich
+table rows collapse sensitivity/routing posture into a single inline summary
+chip so mock-rich canonical resources cannot stack badges inside the resource
+column. Those row summaries now prefer canonical `facetCounts` on the
+resource object when available, so the backend list/read shapes remain the
+source of truth instead of forcing the frontend to infer totals only from
+loaded slices. The drawer now fetches those facets
through one backend bundle endpoint, and that shared facet bundle preserves
the timeline slice plus recent-change counts so the overview card and history
summary can report the loaded history instead of collapsing to the currently
diff --git a/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
index 3d1281f6c6..265e8c1702 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx
@@ -19,6 +19,7 @@ export interface ResourceFacetSummaryProps {
recentChanges?: readonly ResourceChange[] | null;
counts?: ResourceFacetCounts | null;
showTimeline?: boolean;
+ maxVisibleBadges?: number;
class?: string;
testId?: string;
}
@@ -104,6 +105,23 @@ export const ResourceFacetSummary: Component<ResourceFacetSummaryProps> = (props
showTimeline: props.showTimeline ?? true,
}),
);
+ const visibleBadgeLimit = createMemo(() => {
+ const limit = props.maxVisibleBadges;
+ return typeof limit === 'number' && Number.isFinite(limit) && limit >= 0
+ ? Math.floor(limit)
+ : null;
+ });
+ const visibleBadges = createMemo(() => {
+ const limit = visibleBadgeLimit();
+ return limit === null ? badges() : badges().slice(0, limit);
+ });
+ const hiddenBadges = createMemo(() => badges().slice(visibleBadges().length));
+ const hiddenBadgeCount = createMemo(() => hiddenBadges().length);
+ const hiddenBadgeTitle = createMemo(() =>
+ hiddenBadges()
+ .map((badge) => badge.title)
+ .join(', '),
+ );
return (
<Show when={badges().length > 0}>
@@ -111,13 +129,22 @@ export const ResourceFacetSummary: Component<ResourceFacetSummaryProps> = (props
data-testid={props.testId ?? 'resource-facet-summary'}
class={`flex flex-wrap gap-1 ${props.class ?? ''}`}
>
- <For each={badges()}>
+ <For each={visibleBadges()}>
{(badge) => (
<span class={badge.className} title={badge.title}>
{badge.label}
</span>
)}
</For>
+ <Show when={hiddenBadgeCount() > 0}>
+ <span
+ class={`${badgeBase} bg-surface-alt text-muted`}
+ aria-label={`Additional resource changes: ${hiddenBadgeTitle()}`}
+ title={hiddenBadgeTitle()}
+ >
+ +{hiddenBadgeCount()}
+ </span>
+ </Show>
</div>
</Show>
);
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
index 91b7dd32a3..00533bf62c 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
@@ -374,7 +374,7 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
size="xs"
/>
<div class="flex min-w-0 flex-1 flex-col">
- <div class="flex min-w-0 items-baseline gap-1">
+ <div class="flex min-w-0 items-center gap-1">
<span
class="block min-w-0 flex-1 truncate font-medium text-[11px] text-base-content select-text"
title={displayName()}
@@ -386,23 +386,25 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
({resource.name})
</span>
</Show>
+ <For each={policyBadges()}>
+ {(badge) => (
+ <span
+ class={`${badge.className} max-w-[44%] shrink-0 overflow-hidden px-1`}
+ title={badge.title}
+ >
+ <span class="min-w-0 truncate">{badge.label}</span>
+ </span>
+ )}
+ </For>
+ <Show when={policyBadges().length === 0}>
+ <ResourceFacetSummary
+ recentChanges={resource.recentChanges}
+ counts={resource.facetCounts}
+ maxVisibleBadges={1}
+ class="hidden max-w-[48%] shrink-0 flex-nowrap overflow-hidden lg:flex"
+ />
+ </Show>
</div>
- <Show when={policyBadges().length > 0}>
- <div class="mt-0.5 flex flex-wrap gap-1">
- <For each={policyBadges()}>
- {(badge) => (
- <span class={badge.className} title={badge.title}>
- {badge.label}
- </span>
- )}
- </For>
- </div>
- </Show>
- <ResourceFacetSummary
- recentChanges={resource.recentChanges}
- counts={resource.facetCounts}
- class="mt-0.5"
- />
</div>
<Show when={workloadsHref()}>
{(href) => (
@@ -531,14 +533,29 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
class="mx-auto inline-flex max-w-full min-w-0 items-baseline justify-center gap-1 whitespace-nowrap text-[11px] leading-tight"
title={probe().detailLabel}
>
- <span class="min-w-0 truncate text-muted">
- {probe().methodLabel}:
- </span>
- <span
- class={`shrink-0 font-medium tabular-nums ${probe().toneClassName}`}
+ <Show
+ when={probe().targetLabel}
+ fallback={
+ <span
+ class={`font-medium tabular-nums ${probe().toneClassName}`}
+ >
+ {probe().resultLabel}
+ </span>
+ }
>
- {probe().resultLabel}
- </span>
+ {(targetLabel) => (
+ <>
+ <span class="min-w-0 truncate text-muted">
+ {targetLabel()}:
+ </span>
+ <span
+ class={`shrink-0 font-medium tabular-nums ${probe().toneClassName}`}
+ >
+ {probe().resultLabel}
+ </span>
+ </>
+ )}
+ </Show>
</div>
)}
</Show>
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx
index bc73df75ad..4fefdbfb05 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx
@@ -202,7 +202,8 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSe
<ResourceFacetSummary
recentChanges={resource.recentChanges}
counts={resource.facetCounts}
- class="mt-0.5"
+ maxVisibleBadges={1}
+ class="hidden max-w-[48%] shrink-0 flex-nowrap overflow-hidden lg:flex"
/>
</div>
</TableCell>
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx
index acd1c19d53..6b5b704fa8 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx
@@ -216,7 +216,8 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSe
<ResourceFacetSummary
recentChanges={resource.recentChanges}
counts={resource.facetCounts}
- class="mt-0.5"
+ maxVisibleBadges={1}
+ class="hidden max-w-[48%] shrink-0 flex-nowrap overflow-hidden lg:flex"
/>
</div>
</TableCell>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
index b0a1291b11..a451eab88d 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
@@ -258,9 +258,10 @@ describe('UnifiedResourceTable performance contract', () => {
));
await waitFor(() => {
- expect(getByText('TCP 1883:')).toBeInTheDocument();
+ expect(getByText('1883:')).toBeInTheDocument();
expect(getByText('7 ms')).toBeInTheDocument();
});
+ expect(queryByText('TCP 1883:')).toBeNull();
expect(queryByText('TCP 1883 - 7 ms - checked 14s ago')).toBeNull();
expect(getAllByText('7 ms')).toHaveLength(1);
});
@@ -410,6 +411,35 @@ describe('UnifiedResourceTable performance contract', () => {
expect(queryByText('Relationships 1')).toBeNull();
});
+ it('collapses resource facet badges behind an overflow chip when a table row sets a visible limit', async () => {
+ const { getByText, queryByText } = render(() => (
+ <ResourceFacetSummary
+ counts={{
+ recentChanges: 3,
+ recentChangeKinds: {
+ restart: 2,
+ config_update: 1,
+ metric_anomaly: 1,
+ },
+ recentChangeSourceTypes: {
+ platform_event: 1,
+ pulse_diff: 2,
+ },
+ recentChangeSourceAdapters: {
+ docker_adapter: 2,
+ proxmox_adapter: 1,
+ },
+ }}
+ recentChanges={[]}
+ maxVisibleBadges={1}
+ />
+ ));
+
+ expect(getByText('Timeline 3')).toBeInTheDocument();
+ expect(getByText('+7')).toBeInTheDocument();
+ expect(queryByText('Config update 1')).toBeNull();
+ });
+
it('formats sensor labels through the shared resource detail mapper helper', () => {
expect(formatSensorName('fan1_cpu_temp')).toBe('Cpu Temp');
expect(formatSensorName('psu_temp')).toBe('Temp');
@@ -668,8 +698,10 @@ describe('UnifiedResourceTable performance contract', () => {
expect(bodyQueries.queryByText('Internal')).not.toBeInTheDocument();
expect(bodyQueries.queryByText('Cloud Summary')).not.toBeInTheDocument();
- expect(bodyQueries.getByText('Sensitive')).toBeInTheDocument();
- expect(bodyQueries.getByText('Local First')).toBeInTheDocument();
+ const policyBadge = bodyQueries.getByText('Sensitive');
+ expect(policyBadge).toBeInTheDocument();
+ expect(policyBadge.closest('[title]')?.getAttribute('title')).toContain('Local First');
+ expect(bodyQueries.queryByText('Local First')).not.toBeInTheDocument();
});
it('renders facet summary badges without changing the Profile S row budget', async () => {
@@ -730,8 +762,9 @@ describe('UnifiedResourceTable performance contract', () => {
});
await waitFor(() => {
expect(getByText('Timeline 3')).toBeInTheDocument();
- expect(getByText('Config update 1')).toBeInTheDocument();
+ expect(getByText('+7')).toBeInTheDocument();
});
+ expect(container.querySelector('tbody')?.textContent).not.toContain('Config update 1');
await waitFor(() => {
expect(getBodyRowCount(container)).toBe(PROFILES.S);
});
diff --git a/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts b/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts
index 0d710a8ddd..50c3511b7c 100644
--- a/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/availabilityProbePresentation.test.ts
@@ -27,8 +27,8 @@ const makeAvailabilityResource = (overrides?: Partial<Resource>): Resource => ({
});
describe('availabilityProbePresentation', () => {
- it('labels ICMP as ping so agentless rows explain the probe method plainly', () => {
- expect(getAvailabilityProbeMethodLabel({ protocol: 'icmp' })).toBe('Ping');
+ it('labels ICMP by protocol so the system badge and probe detail agree', () => {
+ expect(getAvailabilityProbeMethodLabel({ protocol: 'icmp' })).toBe('ICMP');
});
it('builds compact row evidence for a successful TCP availability probe', () => {
@@ -38,8 +38,10 @@ describe('availabilityProbePresentation', () => {
expect(presentation).toMatchObject({
methodLabel: 'TCP 1883',
+ targetLabel: '1883',
resultLabel: '7 ms',
- rowLabel: 'TCP 1883 - 7 ms - checked 14s ago',
+ netIoLabel: '1883: 7 ms',
+ rowLabel: '1883: 7 ms - checked 14s ago',
});
expect(presentation?.detailLabel).toContain('TCP 1883 - 7 ms');
expect(presentation?.toneClassName).toContain('emerald');
@@ -66,8 +68,10 @@ describe('availabilityProbePresentation', () => {
expect(presentation).toMatchObject({
methodLabel: 'TCP 6053',
+ targetLabel: '6053',
resultLabel: '11 ms',
- rowLabel: 'TCP 6053 - 11 ms - checked 5s ago',
+ netIoLabel: '6053: 11 ms',
+ rowLabel: '6053: 11 ms - checked 5s ago',
});
});
@@ -90,12 +94,43 @@ describe('availabilityProbePresentation', () => {
);
expect(presentation).toMatchObject({
- methodLabel: 'Ping',
+ methodLabel: 'ICMP',
+ targetLabel: null,
resultLabel: 'timed out',
- rowLabel: 'Ping - timed out - checked 11s ago',
+ netIoLabel: 'timed out',
+ rowLabel: 'timed out - checked 11s ago',
});
expect(presentation?.detailLabel).toContain('3/2 failures');
expect(presentation?.detailLabel).toContain('icmp probe timed out');
expect(presentation?.toneClassName).toContain('red');
});
+
+ it('uses the HTTP path as the network evidence target without repeating the protocol', () => {
+ vi.spyOn(Date, 'now').mockReturnValue(new Date('2026-05-06T13:00:20Z').getTime());
+
+ const presentation = getAvailabilityProbePresentation(
+ makeAvailabilityResource({
+ status: 'degraded',
+ availability: {
+ protocol: 'http',
+ path: '/status',
+ available: false,
+ lastChecked: '2026-05-06T13:00:02Z',
+ consecutiveFailures: 1,
+ failureThreshold: 2,
+ lastError: 'http probe returned 503 Service Unavailable',
+ },
+ }),
+ );
+
+ expect(presentation).toMatchObject({
+ methodLabel: 'HTTP /status',
+ targetLabel: '/status',
+ resultLabel: '503',
+ netIoLabel: '/status: 503',
+ rowLabel: '/status: 503 - checked 18s ago',
+ });
+ expect(presentation?.detailLabel).toContain('HTTP /status - 503');
+ expect(presentation?.detailLabel).toContain('http probe returned 503 Service Unavailable');
+ });
});
diff --git a/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts b/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts
index 0deba89d40..07c894a46f 100644
--- a/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceBadgePresentation.test.ts
@@ -111,7 +111,7 @@ describe('resourceBadgePresentation', () => {
expect(getInfrastructureSystemIdentitySortLabel(resource)).toBe('PVE');
});
- it('uses availability identity for agentless network endpoints', () => {
+ it('uses probe protocol identity for agentless network endpoints', () => {
const resource = makeResource({
type: 'network-endpoint',
platformType: 'generic',
@@ -127,12 +127,34 @@ describe('resourceBadgePresentation', () => {
});
expect(getInfrastructureSystemIdentityBadges(resource).map((badge) => badge.label)).toEqual([
- 'Availability',
+ 'TCP',
]);
expect(getInfrastructureSystemIdentityBadges(resource)[0]?.title).toBe(
- 'TCP power-meter-01.lab.local:1883',
+ 'TCP availability probe power-meter-01.lab.local:1883',
+ );
+ expect(getInfrastructureSystemIdentitySortLabel(resource)).toBe('TCP');
+ });
+
+ it('uses ICMP identity for ping-only availability endpoints', () => {
+ const resource = makeResource({
+ type: 'network-endpoint',
+ platformType: 'generic',
+ sourceType: 'api',
+ platformData: {
+ sources: ['availability'],
+ availability: {
+ protocol: 'icmp',
+ address: 'ups-rack-a.lab.local',
+ },
+ },
+ });
+
+ expect(getInfrastructureSystemIdentityBadges(resource).map((badge) => badge.label)).toEqual([
+ 'ICMP',
+ ]);
+ expect(getInfrastructureSystemIdentityBadges(resource)[0]?.title).toBe(
+ 'ICMP availability probe ups-rack-a.lab.local',
);
- expect(getInfrastructureSystemIdentitySortLabel(resource)).toBe('Availability');
});
it('falls back to reported OS identity for agent-only systems', () => {
diff --git a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
index 4580555242..194d857ac5 100644
--- a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
@@ -64,7 +64,25 @@ describe('resourcePolicyPresentation utils', () => {
redact: ['hostname'],
},
}).map((badge) => badge.label),
- ).toEqual(['Sensitive', 'Local First']);
+ ).toEqual(['Sensitive']);
+ expect(
+ getResourcePolicyTableBadges({
+ sensitivity: 'sensitive',
+ routing: {
+ scope: 'local-first',
+ redact: ['hostname'],
+ },
+ })[0]?.title,
+ ).toContain('Local First');
+ expect(
+ getResourcePolicyTableBadges({
+ sensitivity: 'internal',
+ routing: {
+ scope: 'cloud-summary',
+ redact: ['hostname'],
+ },
+ }).map((badge) => badge.label),
+ ).toEqual(['Redacted']);
expect(
hasDefaultResourcePolicyPosture({
diff --git a/frontend-modern/src/utils/availabilityProbePresentation.ts b/frontend-modern/src/utils/availabilityProbePresentation.ts
index 90b150a2bd..94455dc7e9 100644
--- a/frontend-modern/src/utils/availabilityProbePresentation.ts
+++ b/frontend-modern/src/utils/availabilityProbePresentation.ts
@@ -3,7 +3,9 @@ import { formatRelativeTime } from '@/utils/format';
export interface AvailabilityProbePresentation {
methodLabel: string;
+ targetLabel: string | null;
resultLabel: string;
+ netIoLabel: string;
rowLabel: string;
detailLabel: string;
toneClassName: string;
@@ -26,7 +28,7 @@ export const getAvailabilityProbeMethodLabel = (
availability?: ResourceAvailabilityMeta | null,
): string => {
const protocol = normalizeAvailabilityProtocol(availability?.protocol);
- if (protocol === 'icmp') return 'Ping';
+ if (protocol === 'icmp') return 'ICMP';
if (protocol === 'tcp') {
return availability?.port ? `TCP ${availability.port}` : 'TCP';
}
@@ -37,6 +39,21 @@ export const getAvailabilityProbeMethodLabel = (
return protocol ? protocol.toUpperCase() : 'Probe';
};
+export const getAvailabilityProbeTargetLabel = (
+ availability?: ResourceAvailabilityMeta | null,
+): string | null => {
+ const protocol = normalizeAvailabilityProtocol(availability?.protocol);
+ if (protocol === 'tcp') {
+ const port = availability?.port;
+ return typeof port === 'number' && Number.isFinite(port) && port > 0 ? String(port) : null;
+ }
+ if (protocol === 'http' || protocol === 'https') {
+ const path = (availability?.path ?? '').trim();
+ return path || null;
+ }
+ return null;
+};
+
const getAvailabilityProbeFailureLabel = (availability: ResourceAvailabilityMeta): string => {
const lastError = (availability.lastError ?? '').trim();
const normalizedError = lastError.toLowerCase();
@@ -45,7 +62,7 @@ const getAvailabilityProbeFailureLabel = (availability: ResourceAvailabilityMeta
}
const httpStatus = lastError.match(/\b([45]\d{2})\b/);
if (httpStatus) {
- return `HTTP ${httpStatus[1]}`;
+ return httpStatus[1];
}
return 'failed';
};
@@ -112,7 +129,9 @@ export const getAvailabilityProbePresentation = (
}
const methodLabel = getAvailabilityProbeMethodLabel(availability);
+ const targetLabel = getAvailabilityProbeTargetLabel(availability);
const resultLabel = getAvailabilityProbeResultLabel(resource, availability);
+ const netIoLabel = targetLabel ? `${targetLabel}: ${resultLabel}` : resultLabel;
const checked = formatRelativeTime(availability.lastChecked);
const failures = getFailureCountLabel(availability);
const detailParts = [`${methodLabel} - ${resultLabel}`];
@@ -124,13 +143,13 @@ export const getAvailabilityProbePresentation = (
}
if (availability.lastError) detailParts.push(availability.lastError);
- const rowLabel = checked
- ? `${methodLabel} - ${resultLabel} - checked ${checked}`
- : `${methodLabel} - ${resultLabel}`;
+ const rowLabel = checked ? `${netIoLabel} - checked ${checked}` : netIoLabel;
return {
methodLabel,
+ targetLabel,
resultLabel,
+ netIoLabel,
rowLabel,
detailLabel: detailParts.join(' - '),
toneClassName: getAvailabilityProbeToneClassName(resource, availability),
diff --git a/frontend-modern/src/utils/resourceBadgePresentation.ts b/frontend-modern/src/utils/resourceBadgePresentation.ts
index 3bbf5ff2aa..5cb4078f5d 100644
--- a/frontend-modern/src/utils/resourceBadgePresentation.ts
+++ b/frontend-modern/src/utils/resourceBadgePresentation.ts
@@ -230,13 +230,26 @@ const getAvailabilitySystemIdentityBadge = (
if (!isAvailabilityEndpoint) return null;
- const protocol = trimString(availability?.protocol).toUpperCase();
+ const protocol = trimString(availability?.protocol);
+ const normalizedProtocol = protocol.toLowerCase();
+ const protocolLabel =
+ normalizedProtocol === 'icmp'
+ ? 'ICMP'
+ : normalizedProtocol === 'tcp'
+ ? 'TCP'
+ : normalizedProtocol === 'http' || normalizedProtocol === 'https'
+ ? normalizedProtocol.toUpperCase()
+ : protocol.toUpperCase() || 'Probe';
const address = trimString(availability?.address);
- const port = Number.isFinite(availability?.port) && availability?.port ? `:${availability.port}` : '';
+ const port =
+ Number.isFinite(availability?.port) && availability?.port ? `:${availability.port}` : '';
return {
- label: 'Availability',
+ label: protocolLabel,
classes: `${baseBadge} ${availabilityBadgeClasses}`,
- title: titleFromParts(protocol || 'Availability', address ? `${address}${port}` : undefined),
+ title: titleFromParts(
+ `${protocolLabel} availability probe`,
+ address ? `${address}${port}` : undefined,
+ ),
};
};
diff --git a/frontend-modern/src/utils/resourcePolicyPresentation.ts b/frontend-modern/src/utils/resourcePolicyPresentation.ts
index c5c69f7e15..3a5b2ea636 100644
--- a/frontend-modern/src/utils/resourcePolicyPresentation.ts
+++ b/frontend-modern/src/utils/resourcePolicyPresentation.ts
@@ -95,6 +95,12 @@ const routingPresentation: Record<
},
};
+const redactionBadgePresentation: Pick<PolicyBadgePresentation, 'label' | 'title' | 'className'> = {
+ label: 'Redacted',
+ title: 'Resource identity fields are redacted before governed handling.',
+ className: `${badgeBaseClass} bg-slate-200 text-slate-700 dark:bg-slate-800 dark:text-slate-300`,
+};
+
const redactionLabels: Record<ResourceRedactionHint, string> = {
hostname: 'Hostname',
'ip-address': 'IP Address',
@@ -111,19 +117,45 @@ export const getResourcePolicyBadges = (policy?: ResourcePolicy): PolicyBadgePre
export const hasDefaultResourcePolicyPosture = (policy?: ResourcePolicy): boolean =>
Boolean(
policy &&
- policy.sensitivity === 'internal' &&
- policy.routing.scope === 'cloud-summary' &&
- (policy.routing.redact?.length ?? 0) === 0,
+ policy.sensitivity === 'internal' &&
+ policy.routing.scope === 'cloud-summary' &&
+ (policy.routing.redact?.length ?? 0) === 0,
);
-export const getResourcePolicyTableBadges = (policy?: ResourcePolicy): PolicyBadgePresentation[] => {
+export const getResourcePolicyTableBadges = (
+ policy?: ResourcePolicy,
+): PolicyBadgePresentation[] => {
if (!policy) return [];
if (hasDefaultResourcePolicyPosture(policy)) {
return [];
}
- return getResourcePolicyBadges(policy);
+ const sensitivity = sensitivityPresentation[policy.sensitivity];
+ const routing = routingPresentation[policy.routing.scope];
+ const redactions = getResourcePolicyRedactionLabels(policy);
+ const hasNonDefaultSensitivity = policy.sensitivity !== 'internal';
+ const hasNonDefaultRouting = policy.routing.scope !== 'cloud-summary';
+ const primary = hasNonDefaultSensitivity
+ ? sensitivity
+ : hasNonDefaultRouting
+ ? routing
+ : redactionBadgePresentation;
+ const redactionTitle = redactions.length > 0 ? `Redacts ${redactions.join(', ')}.` : undefined;
+
+ return [
+ {
+ label: primary.label,
+ className: primary.className,
+ title: [
+ `${sensitivity.label}: ${sensitivity.title}`,
+ `${routing.label}: ${routing.title}`,
+ redactionTitle,
+ ]
+ .filter(Boolean)
+ .join(' '),
+ },
+ ];
};
export const getResourceSensitivityLabel = (sensitivity?: ResourceSensitivity): string =>
@@ -133,7 +165,7 @@ export const getResourceRoutingScopeLabel = (scope?: ResourceRoutingScope): stri
scope ? routingPresentation[scope].label : 'Unrouted';
export const getResourceRedactionHintLabel = (hint?: ResourceRedactionHint): string =>
- hint ? redactionLabels[hint] ?? hint : 'Unclassified';
+ hint ? (redactionLabels[hint] ?? hint) : 'Unclassified';
export const getResourcePolicyRedactionLabels = (policy?: ResourcePolicy): string[] =>
(policy?.routing.redact ?? []).map((hint) => getResourceRedactionHintLabel(hint));