fix: Switch to 'all' after filters change on kubernetes dashboard page (#1337)

Fixes: HDX-2789
This commit is contained in:
Tom Alexander 2025-11-11 09:52:47 -05:00 committed by GitHub
parent 44caf197b4
commit b90a0649b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---
fix: Switch to 'all' after filters change on kubernetes dashboard page

View file

@ -140,6 +140,13 @@ export const InfraPodsStatusTable = ({
where: string;
}) => {
const [phaseFilter, setPhaseFilter] = React.useState('running');
// Auto-switch to "All" when search filters are applied
useEffect(() => {
if (where) {
setPhaseFilter('all');
}
}, [where]);
const [sortState, setSortState] = React.useState<{
column: InfraPodsStatusTableColumn;
order: 'asc' | 'desc';

View file

@ -148,4 +148,24 @@ test.describe('Kubernetes Dashboard', { tag: ['@kubernetes'] }, () => {
'ResourceAttributes.k8s.namespace.name:"default"',
);
});
test('should switch to "All" tab when filtering by pod or namespace', async ({
page,
}) => {
// Verify initial state is "Running"
const podsTable = page.getByTestId('k8s-pods-table');
const runningTab = podsTable.getByRole('radio', { name: 'Running' });
await expect(runningTab).toBeChecked();
// Filter by namespace
const namespaceFilter = page.getByTestId('namespace-filter-select');
await namespaceFilter.click();
await page.getByRole('option', { name: 'default' }).click();
await page.waitForTimeout(500);
// Verify it switched to "All" tab
const allTab = podsTable.getByRole('radio', { name: 'All' });
await expect(allTab).toBeChecked();
});
});