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.

Restore TableCardHeader title and update stale frontend test assertions

rcourtman76599b2a90c1
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 fe8a8e0225..97ff756c24 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
@@ -255,12 +255,12 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
<ResourceDetailDrawer resource={resource} />
));
- expect(getByText('Host')).toBeInTheDocument();
+ expect(getByText('Machine')).toBeInTheDocument();
expect(getByText('System, Hardware, Network, and Disks')).toBeInTheDocument();
expect(queryByText('Hardware')).toBeNull();
expect(queryByText('Network')).toBeNull();
- fireEvent.click(getByRole('button', { name: 'Show host' }));
+ fireEvent.click(getByRole('button', { name: 'Show machine' }));
await waitFor(() => {
expect(getByText('Hardware')).toBeInTheDocument();
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 029aa221ea..27ef79fa97 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
@@ -1029,14 +1029,20 @@ describe('UnifiedResourceTable performance contract', () => {
/>
));
- await waitFor(() => {
- expect(getByText('cluster-a')).toBeInTheDocument();
- expect(getByText('cluster-b')).toBeInTheDocument();
- });
- await waitFor(() => {
- expect(getBodyRowCount(container)).toBe(PROFILES.S + 2);
- });
- });
+ await waitFor(
+ () => {
+ expect(getByText('cluster-a')).toBeInTheDocument();
+ expect(getByText('cluster-b')).toBeInTheDocument();
+ },
+ { timeout: 15000 },
+ );
+ await waitFor(
+ () => {
+ expect(getBodyRowCount(container)).toBe(PROFILES.S + 2);
+ },
+ { timeout: 15000 },
+ );
+ }, 30000);
it('renders flat mode with profile S resources', async () => {
const resources = makeResources(PROFILES.S, (i) => ({
@@ -1051,15 +1057,21 @@ describe('UnifiedResourceTable performance contract', () => {
/>
));
- await waitFor(() => {
- expect(container.querySelector('table')).toBeInTheDocument();
- });
- await waitFor(() => {
- expect(getBodyRowCount(container)).toBe(PROFILES.S);
- });
+ await waitFor(
+ () => {
+ expect(container.querySelector('table')).toBeInTheDocument();
+ },
+ { timeout: 15000 },
+ );
+ await waitFor(
+ () => {
+ expect(getBodyRowCount(container)).toBe(PROFILES.S);
+ },
+ { timeout: 15000 },
+ );
expect(queryByText('cluster-a')).not.toBeInTheDocument();
expect(queryByText('cluster-b')).not.toBeInTheDocument();
- });
+ }, 30000);
});
describe('Infrastructure derivation contracts', () => {
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 65d18ff8c1..55f822b84a 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -137,7 +137,7 @@ describe('settings architecture guardrails', () => {
"export const AVAILABILITY_SETTINGS_PATH = '/settings/monitoring/availability';",
);
expect(availabilitySettingsModelSource).toContain(
- 'export function buildAvailabilityTargetAddPath()',
+ 'export function buildAvailabilityTargetAddPath(',
);
});
diff --git a/frontend-modern/src/components/shared/TableCardHeader.tsx b/frontend-modern/src/components/shared/TableCardHeader.tsx
index ff407d43da..1fc22b807a 100644
--- a/frontend-modern/src/components/shared/TableCardHeader.tsx
+++ b/frontend-modern/src/components/shared/TableCardHeader.tsx
@@ -24,31 +24,34 @@ const TABLE_CARD_HEADER_ACTIONS_CLEAR_BUTTON_CLASS = TABLE_CARD_HEADER_CLEAR_BUT
export const TableCardHeader: Component<TableCardHeaderProps> = (props) => {
const hasActions = () => Boolean(props.actions || (props.showClearAction && props.onClear));
+ const hasContent = () => Boolean(props.title) || hasActions();
const clearLabel = () => props.clearLabel ?? 'Clear';
const clearAriaLabel = () => props.clearAriaLabel ?? 'Clear selection';
return (
- <Show when={hasActions()}>
+ <Show when={hasContent()}>
<div class={TABLE_CARD_HEADER_CLASS}>
<Show when={props.title}>
<span>{props.title}</span>
</Show>
- <div class="ml-auto flex items-center gap-2 normal-case tracking-normal">
- {props.actions}
- <Show when={props.showClearAction && props.onClear}>
- <button
- type="button"
- class={TABLE_CARD_HEADER_ACTIONS_CLEAR_BUTTON_CLASS}
- aria-label={clearAriaLabel()}
- onClick={(event) => {
- event.stopPropagation();
- props.onClear?.();
- }}
- >
- {clearLabel()}
- </button>
- </Show>
- </div>
+ <Show when={hasActions()}>
+ <div class="ml-auto flex items-center gap-2 normal-case tracking-normal">
+ {props.actions}
+ <Show when={props.showClearAction && props.onClear}>
+ <button
+ type="button"
+ class={TABLE_CARD_HEADER_ACTIONS_CLEAR_BUTTON_CLASS}
+ aria-label={clearAriaLabel()}
+ onClick={(event) => {
+ event.stopPropagation();
+ props.onClear?.();
+ }}
+ >
+ {clearLabel()}
+ </button>
+ </Show>
+ </div>
+ </Show>
</div>
</Show>
);