Simplify drawer host detail summary

This commit is contained in:
rcourtman 2026-03-23 11:44:12 +00:00
parent c2b788f553
commit cc5954ecd9
4 changed files with 20 additions and 10 deletions

View file

@ -498,6 +498,8 @@ read side by side on wider screens instead of as a single full-width stack.
Host details uses that same flex-wrap pattern inside the disclosure for the
system, hardware, storage, and network cards, so the drawer matches the
shared workload-card density instead of stretching those cards one per row.
The collapsed `Host details` summary now names the available categories only,
instead of exposing internal card counts in the disclosure label.
When `Service details` is expanded, each service card remains summary-first and
pushes heavier breakdowns or update controls behind one more service-local
reveal, so the opened state still scans as current state before deeper

View file

@ -214,9 +214,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
));
expect(getByText('Host details')).toBeInTheDocument();
expect(
getByText('4 detail cards covering system, hardware, network, and disks.'),
).toBeInTheDocument();
expect(getByText('System, Hardware, Network, and Disks')).toBeInTheDocument();
expect(queryByText('Hardware')).toBeNull();
expect(queryByText('Network')).toBeNull();

View file

@ -116,7 +116,7 @@ describe('resourceDetailDrawerOperationalModel', () => {
'temperatures',
]);
expect(buildHostDetailSummary(cards)).toBe(
'8 detail cards covering system, hardware, storage, network, disks, and temperatures.',
'System, Hardware, Storage, Network, Disks, and Temperatures',
);
expect(hasRuntimeOperationalContext([], [])).toBe(false);
});

View file

@ -155,15 +155,25 @@ export const buildHostDetailCards = (options: {
export const buildHostDetailSummary = (hostDetailCards: string[]): string | null => {
const labels = Array.from(new Set(hostDetailCards));
if (labels.length === 0) return null;
const presentation: Record<string, string> = {
system: 'System',
hardware: 'Hardware',
storage: 'Storage',
network: 'Network',
disks: 'Disks',
raid: 'RAID',
temperatures: 'Temperatures',
};
const displayLabels = labels.map((label) => presentation[label] ?? label);
const categories =
labels.length === 1
? labels[0]
: labels.length === 2
? `${labels[0]} and ${labels[1]}`
: `${labels.slice(0, -1).join(', ')}, and ${labels[labels.length - 1]}`;
displayLabels.length === 1
? displayLabels[0]
: displayLabels.length === 2
? `${displayLabels[0]} and ${displayLabels[1]}`
: `${displayLabels.slice(0, -1).join(', ')}, and ${displayLabels[displayLabels.length - 1]}`;
return `${hostDetailCards.length} detail card${hostDetailCards.length === 1 ? '' : 's'} covering ${categories}.`;
return categories;
};
export const buildRelatedLinks = (