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.

Converge platform table value summaries

rcourtman9cc679528894
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 8d9cb4fd6a..52efa23316 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -2596,6 +2596,12 @@ Platform table title-case fallback formatting follows the same rule.
`Unknown` fallback behavior for state/status labels that need simple title
case. TrueNAS platform tables must compose that helper instead of declaring
local `titleCase` helpers.
+Platform table compact list summaries follow the same rule.
+`summarizePlatformTableValues` owns the repeated trimming, empty-marker label,
+visible-value count, `+N` overflow suffix, full-title text, and normalized
+value-list behavior for dense platform table cells. vSphere datastore/network
+tables and TrueNAS network-share tables must compose that helper instead of
+declaring local `compactList` or `summarizeValues` helpers.
Platform table uptime formatting follows that rule too.
`formatPlatformTableUptimeValue` owns the repeated one-unit uptime label plus
canonical empty-cell marker behavior for dense platform table cells. Docker /
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index be378b1743..98ce984a54 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -233,6 +233,12 @@ Simple title-case state/status label fallback follows that boundary too:
unified-resource consumers own which TrueNAS state or status value is shown,
but TrueNAS platform tables must use `formatPlatformTableTitleCaseValue`
instead of recreating local `titleCase` helpers.
+Compact list summaries follow the same boundary: unified-resource consumers
+own which source values belong in host, VM, access, client, or security cells,
+while platform tables must use `summarizePlatformTableValues` for trimming,
+empty-marker labels, `+N` overflow labels, full title text, and normalized
+value lists instead of recreating local `compactList` or `summarizeValues`
+helpers.
One-unit platform table uptime labels follow the same boundary:
unified-resource consumers own which uptime field is displayed, but platform
tables must use `formatPlatformTableUptimeValue` instead of recreating local
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index f8b2b5636c..87b93f08ca 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -1235,6 +1235,39 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "platform-table-value-summary",
+ "category": "platform-table-text-value",
+ "summary": "Platform tables must use the shared compact value summary helper for trimmed list labels and full title text instead of recreating local compactList or summarizeValues helpers.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "summarizePlatformTableValues"
+ },
+ "requiredConsumers": [
+ { "path": "src/features/truenas/TrueNASNetworkSharesTable.tsx" },
+ { "path": "src/features/vmware/VsphereDatastoresTable.tsx" },
+ { "path": "src/features/vmware/VsphereNetworksTable.tsx" }
+ ],
+ "forbiddenPatterns": [
+ {
+ "path": "src/features/truenas/TrueNASNetworkSharesTable.tsx",
+ "patterns": ["const compactList", "const summarizeValues"]
+ },
+ {
+ "path": "src/features/vmware/VsphereDatastoresTable.tsx",
+ "patterns": ["const compactList", "const summarizeValues"]
+ },
+ {
+ "path": "src/features/vmware/VsphereNetworksTable.tsx",
+ "patterns": ["const compactList", "const summarizeValues"]
+ }
+ ],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "platform-table-uptime-value-fallback",
"category": "platform-table-text-value",
@@ -1768,6 +1801,46 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "platform-table-local-compact-list-helper",
+ "category": "platform-table-text-value",
+ "summary": "Platform tables must not recreate local compactList helpers for compact value summaries.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "summarizePlatformTableValues"
+ },
+ "scopes": ["src/features/truenas", "src/features/vmware"],
+ "extensions": [".tsx"],
+ "allPatterns": ["const compactList"],
+ "legacyReason": "Retired migration debt. Platform table compact list normalization must use summarizePlatformTableValues for shared trimming and normalized values.",
+ "allowedPaths": [],
+ "ignoredPaths": [],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
+ {
+ "id": "platform-table-local-value-summary-helper",
+ "category": "platform-table-text-value",
+ "summary": "Platform tables must not recreate local summarizeValues helpers for compact value summaries.",
+ "canonical": {
+ "path": "src/features/platformPage/sharedPlatformPage.tsx",
+ "export": "summarizePlatformTableValues"
+ },
+ "scopes": ["src/features/truenas", "src/features/vmware"],
+ "extensions": [".tsx"],
+ "allPatterns": ["const summarizeValues"],
+ "legacyReason": "Retired migration debt. Platform table compact value summaries must use summarizePlatformTableValues for shared labels, overflow counts, and title text.",
+ "allowedPaths": [],
+ "ignoredPaths": [],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/features/platformPage/__tests__/sharedPlatformPage.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "platform-table-local-uptime-helper",
"category": "platform-table-text-value",
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 14c3dad237..756a4023b9 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -263,6 +263,8 @@ import truenasSystemsTableSource from '@/features/truenas/TrueNASSystemsTable.ts
import truenasVirtualMachinesTableSource from '@/features/truenas/TrueNASVirtualMachinesTable.tsx?raw';
import vsphereActivityTableSource from '@/features/vmware/VsphereActivityTable.tsx?raw';
import vsphereAlertsTableSource from '@/features/vmware/VsphereAlertsTable.tsx?raw';
+import vsphereDatastoresTableSource from '@/features/vmware/VsphereDatastoresTable.tsx?raw';
+import vsphereNetworksTableSource from '@/features/vmware/VsphereNetworksTable.tsx?raw';
const sharedSources = import.meta.glob(['./*.tsx', './cards/*.tsx', './responsive/*.tsx'], {
query: '?raw',
@@ -1959,9 +1961,7 @@ describe('shared primitive guardrails', () => {
expect(localEntityTypeFormatterGuard?.canonical?.path).toBe(
'src/utils/alertDetailPresentation.ts',
);
- expect(localEntityTypeFormatterGuard?.canonical?.export).toBe(
- 'formatPlatformAlertEntityType',
- );
+ expect(localEntityTypeFormatterGuard?.canonical?.export).toBe('formatPlatformAlertEntityType');
expect(localEntityTypeFormatterGuard?.allPatterns).toEqual([
'const formatEntityType',
'VmwareIncidentRow',
@@ -3508,7 +3508,7 @@ describe('shared primitive guardrails', () => {
expect(localHelperGuard?.ignoredPaths ?? []).toHaveLength(0);
expect(sharedPlatformPageSource).toContain('export const formatPlatformTableTextValue');
- expect(sharedPlatformPageSource).toContain("asTrimmedString(value) || emptyText");
+ expect(sharedPlatformPageSource).toContain('asTrimmedString(value) || emptyText');
for (const [path, source] of kubernetesTextValueConsumers) {
expect(source).toContain('formatPlatformTableTextValue');
@@ -3581,7 +3581,7 @@ describe('shared primitive guardrails', () => {
expect(localHelperGuard?.ignoredPaths ?? []).toHaveLength(0);
expect(sharedPlatformPageSource).toContain('export const formatPlatformTableTitleCaseValue');
- expect(sharedPlatformPageSource).toContain("if (!normalized) return emptyText");
+ expect(sharedPlatformPageSource).toContain('if (!normalized) return emptyText');
for (const [, source] of truenasTitleCaseConsumers) {
expect(source).toContain('formatPlatformTableTitleCaseValue');
@@ -3662,6 +3662,79 @@ describe('shared primitive guardrails', () => {
}
});
+ it('keeps platform table compact value summaries on the shared helper', () => {
+ const registry = JSON.parse(sharedTemplateRegistrySource) as {
+ rules?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ requiredConsumers?: Array<{ path?: string }>;
+ forbiddenPatterns?: Array<{ path?: string; patterns?: string[] }>;
+ }>;
+ patternGuards?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ allPatterns?: string[];
+ scopes?: string[];
+ allowedPaths?: string[];
+ ignoredPaths?: string[];
+ }>;
+ };
+ const registeredRule = registry.rules?.find(
+ (rule) => rule.id === 'platform-table-value-summary',
+ );
+ const localCompactListGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'platform-table-local-compact-list-helper',
+ );
+ const localSummaryGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'platform-table-local-value-summary-helper',
+ );
+ const platformValueSummaryConsumers: Array<[string, string]> = [
+ ['src/features/truenas/TrueNASNetworkSharesTable.tsx', truenasNetworkSharesTableSource],
+ ['src/features/vmware/VsphereDatastoresTable.tsx', vsphereDatastoresTableSource],
+ ['src/features/vmware/VsphereNetworksTable.tsx', vsphereNetworksTableSource],
+ ];
+ const platformValueSummaryConsumerPaths = platformValueSummaryConsumers.map(([path]) => path);
+
+ expect(registeredRule?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(registeredRule?.canonical?.export).toBe('summarizePlatformTableValues');
+ expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(
+ platformValueSummaryConsumerPaths,
+ );
+ expect(registeredRule?.forbiddenPatterns).toEqual(
+ platformValueSummaryConsumerPaths.map((path) => ({
+ path,
+ patterns: ['const compactList', 'const summarizeValues'],
+ })),
+ );
+ expect(localCompactListGuard?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(localCompactListGuard?.canonical?.export).toBe('summarizePlatformTableValues');
+ expect(localCompactListGuard?.allPatterns).toEqual(['const compactList']);
+ expect(localCompactListGuard?.scopes).toEqual(['src/features/truenas', 'src/features/vmware']);
+ expect(localCompactListGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(localCompactListGuard?.ignoredPaths ?? []).toHaveLength(0);
+ expect(localSummaryGuard?.canonical?.path).toBe(
+ 'src/features/platformPage/sharedPlatformPage.tsx',
+ );
+ expect(localSummaryGuard?.canonical?.export).toBe('summarizePlatformTableValues');
+ expect(localSummaryGuard?.allPatterns).toEqual(['const summarizeValues']);
+ expect(localSummaryGuard?.scopes).toEqual(['src/features/truenas', 'src/features/vmware']);
+ expect(localSummaryGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(localSummaryGuard?.ignoredPaths ?? []).toHaveLength(0);
+
+ expect(sharedPlatformPageSource).toContain('export const summarizePlatformTableValues');
+ expect(sharedPlatformPageSource).toContain('export type PlatformTableValueSummary');
+
+ for (const [, source] of platformValueSummaryConsumers) {
+ expect(source).toContain('summarizePlatformTableValues');
+ expect(source).not.toContain('const compactList');
+ expect(source).not.toContain('const summarizeValues');
+ }
+ });
+
it('keeps platform table metric fallbacks on the shared helper', () => {
const registry = JSON.parse(sharedTemplateRegistrySource) as {
rules?: Array<{
diff --git a/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts b/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts
index fea2bda4d9..8db6437d91 100644
--- a/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts
+++ b/frontend-modern/src/features/platformPage/__tests__/sharedPlatformPage.test.ts
@@ -8,6 +8,7 @@ import {
filterPlatformResources,
formatPlatformTableTextValue,
getPlatformTableFiniteMetric,
+ summarizePlatformTableValues,
type PlatformResourceStatusFilter,
} from '../sharedPlatformPage';
@@ -132,11 +133,8 @@ describe('filterPlatformResources', () => {
});
it('supports platform table status resolvers for source-aware display state', () => {
- const filtered = filterPlatformResources(
- resources,
- '',
- 'degraded',
- (resource) => (resource.id === 'host-alpha' ? 'degraded' : resource.status),
+ const filtered = filterPlatformResources(resources, '', 'degraded', (resource) =>
+ resource.id === 'host-alpha' ? 'degraded' : resource.status,
);
expect(filtered.map((r) => r.id).sort()).toEqual(
['host-alpha', 'host-charlie', 'host-foxtrot', 'host-golf'].sort(),
@@ -237,6 +235,42 @@ describe('formatPlatformTableTitleCaseValue', () => {
});
});
+describe('summarizePlatformTableValues', () => {
+ it('trims values and keeps empty summaries display-only', () => {
+ expect(summarizePlatformTableValues([undefined, null, '', ' '])).toEqual({
+ label: '—',
+ title: '',
+ values: [],
+ });
+ expect(summarizePlatformTableValues(undefined, { emptyText: '-' })).toEqual({
+ label: '-',
+ title: '',
+ values: [],
+ });
+ });
+
+ it('builds compact labels with full title text and normalized values', () => {
+ expect(summarizePlatformTableValues([' alpha ', 'bravo', 'charlie'])).toEqual({
+ label: 'alpha, bravo +1',
+ title: 'alpha, bravo, charlie',
+ values: ['alpha', 'bravo', 'charlie'],
+ });
+ });
+
+ it('supports caller-owned visibility and value transforms', () => {
+ expect(
+ summarizePlatformTableValues(['nfs', 'smb', 'iscsi', 'webdav'], {
+ maxVisible: 3,
+ transform: (value) => value.toUpperCase(),
+ }),
+ ).toEqual({
+ label: 'NFS, SMB, ISCSI +1',
+ title: 'NFS, SMB, ISCSI, WEBDAV',
+ values: ['NFS', 'SMB', 'ISCSI', 'WEBDAV'],
+ });
+ });
+});
+
describe('formatPlatformTableUptimeValue', () => {
it('formats one-unit platform table uptime labels with the canonical empty marker', () => {
expect(formatPlatformTableUptimeValue(undefined)).toBe('—');
diff --git a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
index 7ea578a7db..a05a99521a 100644
--- a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
+++ b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
@@ -145,6 +145,37 @@ export const getPlatformTableCellClassForKind = (kind: PlatformTableColumnKind):
export const formatPlatformTableTextValue = (value: unknown, emptyText = '—'): string =>
asTrimmedString(value) || emptyText;
+export type PlatformTableValueSummary = { label: string; title: string; values: string[] };
+
+export type PlatformTableValueSummaryOptions = {
+ emptyText?: string;
+ maxVisible?: number;
+ transform?: (value: string) => string;
+};
+
+export const summarizePlatformTableValues = (
+ values: readonly unknown[] | undefined,
+ options: PlatformTableValueSummaryOptions = {},
+): PlatformTableValueSummary => {
+ const emptyText = options.emptyText ?? '—';
+ const maxVisible = options.maxVisible ?? 2;
+ const normalized = (values ?? [])
+ .map((value) => asTrimmedString(value))
+ .filter((value): value is string => Boolean(value))
+ .map((value) => options.transform?.(value) ?? value);
+
+ if (normalized.length === 0) return { label: emptyText, title: '', values: [] };
+
+ const visible = normalized.slice(0, maxVisible);
+ const suffix =
+ normalized.length > visible.length ? ` +${normalized.length - visible.length}` : '';
+ return {
+ label: `${visible.join(', ')}${suffix}`,
+ title: normalized.join(', '),
+ values: normalized,
+ };
+};
+
export const formatPlatformTableTitleCaseValue = (
value: unknown,
emptyText = 'Unknown',
diff --git a/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx b/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx
index 8adacc6595..8a185eb9f9 100644
--- a/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx
+++ b/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx
@@ -10,6 +10,7 @@ import {
formatPlatformTableTitleCaseValue,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
+ summarizePlatformTableValues,
type PlatformTableFilterOption,
PlatformTableShell,
} from '@/features/platformPage/sharedPlatformPage';
@@ -41,58 +42,44 @@ const shareMeta = (resource: Resource): ResourceTrueNASShareMeta | undefined =>
const formatProtocol = (share: ResourceTrueNASShareMeta | undefined): string =>
asTrimmedString(share?.protocol)?.toUpperCase() || '-';
-const compactList = (values: Array<string | undefined>): string[] =>
- values.map((value) => asTrimmedString(value)).filter((value): value is string => Boolean(value));
-
-const summarizeValues = (
- values: string[],
- empty = '-',
- visibleCount = 2,
-): { label: string; title: string } => {
- if (values.length === 0) return { label: empty, title: '' };
- const visible = values.slice(0, visibleCount);
- const suffix = values.length > visible.length ? ` +${values.length - visible.length}` : '';
- return { label: `${visible.join(', ')}${suffix}`, title: values.join(', ') };
-};
-
const formatAccess = (
share: ResourceTrueNASShareMeta | undefined,
): { label: string; title: string } => {
- const flags = compactList([
+ const flags = [
share?.readOnly === true ? 'Read-only' : share?.readOnly === false ? 'Read/write' : undefined,
share?.browsable === true ? 'Browsable' : share?.browsable === false ? 'Hidden' : undefined,
share?.accessBasedEnumeration ? 'ABE' : undefined,
share?.auditEnabled ? 'Audit' : undefined,
share?.exposeSnapshots ? 'Snapshots' : undefined,
- ]);
- return summarizeValues(flags, '-', 3);
+ ];
+ return summarizePlatformTableValues(flags, { emptyText: '-', maxVisible: 3 });
};
const formatClients = (
share: ResourceTrueNASShareMeta | undefined,
): { label: string; title: string } => {
- const networks = compactList(share?.networks ?? []);
- const hosts = compactList(share?.hosts ?? []);
- const aliases = compactList(share?.aliases ?? []);
+ const networks = summarizePlatformTableValues(share?.networks, { emptyText: '-' }).values;
+ const hosts = summarizePlatformTableValues(share?.hosts, { emptyText: '-' }).values;
+ const aliases = summarizePlatformTableValues(share?.aliases, { emptyText: '-' }).values;
const values = [
...networks.map((network) => `net:${network}`),
...hosts.map((host) => `host:${host}`),
...aliases.map((alias) => `alias:${alias}`),
];
- return summarizeValues(values);
+ return summarizePlatformTableValues(values, { emptyText: '-' });
};
const formatSecurity = (
share: ResourceTrueNASShareMeta | undefined,
): { label: string; title: string } => {
const values = [
- ...compactList(share?.security ?? []),
- ...compactList([
+ ...(share?.security ?? []),
+ ...[
share?.mapRootUser ? `root:${share.mapRootUser}` : undefined,
share?.mapAllUser ? `all:${share.mapAllUser}` : undefined,
- ]),
+ ],
];
- return summarizeValues(values);
+ return summarizePlatformTableValues(values, { emptyText: '-' });
};
const shareName = (resource: Resource, share: ResourceTrueNASShareMeta | undefined): string =>
diff --git a/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx b/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
index 9c12469d71..f6b2326732 100644
--- a/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
@@ -11,6 +11,7 @@ import {
createPlatformTableFilterState,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
+ summarizePlatformTableValues,
type PlatformTableFilterOption,
PlatformTableShell,
} from '@/features/platformPage/sharedPlatformPage';
@@ -65,26 +66,12 @@ const datastoreType = (resource: Resource): string =>
asTrimmedString(resource.storage?.type)?.toUpperCase() ||
'—';
-const compactList = (values: Array<string | undefined>): string[] =>
- values.map((value) => asTrimmedString(value)).filter((value): value is string => Boolean(value));
-
-const summarizeValues = (
- values: string[],
- empty = '—',
- visibleCount = 2,
-): { label: string; title: string } => {
- if (values.length === 0) return { label: empty, title: '' };
- const visible = values.slice(0, visibleCount);
- const suffix = values.length > visible.length ? ` +${values.length - visible.length}` : '';
- return { label: `${visible.join(', ')}${suffix}`, title: values.join(', ') };
-};
-
const hostSummary = (resource: Resource): { label: string; title: string } =>
- summarizeValues(compactList(resource.storage?.nodes ?? []), '—', 2);
+ summarizePlatformTableValues(resource.storage?.nodes);
const consumerSummary = (resource: Resource): { label: string; title: string } => {
const consumers = resource.storage?.topConsumers?.map((consumer) => consumer.name) ?? [];
- return summarizeValues(compactList(consumers), '—', 2);
+ return summarizePlatformTableValues(consumers);
};
const consumerCount = (resource: Resource): number => resource.storage?.consumerCount ?? 0;
diff --git a/frontend-modern/src/features/vmware/VsphereNetworksTable.tsx b/frontend-modern/src/features/vmware/VsphereNetworksTable.tsx
index 92069a8bc1..e9cc609f46 100644
--- a/frontend-modern/src/features/vmware/VsphereNetworksTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereNetworksTable.tsx
@@ -10,6 +10,7 @@ import {
createPlatformTableFilterState,
getPlatformTableCellClassForKind,
getPlatformTableHeadClassForKind,
+ summarizePlatformTableValues,
type PlatformTableFilterOption,
PlatformTableShell,
} from '@/features/platformPage/sharedPlatformPage';
@@ -65,25 +66,11 @@ const networkType = (resource: Resource): string => {
return NETWORK_TYPE_LABELS[raw.toUpperCase()] ?? raw;
};
-const compactList = (values: Array<string | undefined>): string[] =>
- values.map((value) => asTrimmedString(value)).filter((value): value is string => Boolean(value));
-
-const summarizeValues = (
- values: string[],
- empty = '—',
- visibleCount = 2,
-): { label: string; title: string } => {
- if (values.length === 0) return { label: empty, title: '' };
- const visible = values.slice(0, visibleCount);
- const suffix = values.length > visible.length ? ` +${values.length - visible.length}` : '';
- return { label: `${visible.join(', ')}${suffix}`, title: values.join(', ') };
-};
-
const hostSummary = (resource: Resource): { label: string; title: string } =>
- summarizeValues(compactList(resource.vmware?.networkHostNames ?? []), '—', 2);
+ summarizePlatformTableValues(resource.vmware?.networkHostNames);
const vmSummary = (resource: Resource): { label: string; title: string } =>
- summarizeValues(compactList(resource.vmware?.networkVmNames ?? []), '—', 2);
+ summarizePlatformTableValues(resource.vmware?.networkVmNames);
const vmCount = (resource: Resource): number =>
resource.vmware?.networkVmNames?.length ?? resource.vmware?.networkVmIds?.length ?? 0;