Skip to content

Commit b90a064

Browse files
authored
fix: Switch to 'all' after filters change on kubernetes dashboard page (#1337)
Fixes: HDX-2789
1 parent 44caf19 commit b90a064

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.changeset/lucky-colts-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
fix: Switch to 'all' after filters change on kubernetes dashboard page

packages/app/src/KubernetesDashboardPage.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ export const InfraPodsStatusTable = ({
140140
where: string;
141141
}) => {
142142
const [phaseFilter, setPhaseFilter] = React.useState('running');
143+
144+
// Auto-switch to "All" when search filters are applied
145+
useEffect(() => {
146+
if (where) {
147+
setPhaseFilter('all');
148+
}
149+
}, [where]);
143150
const [sortState, setSortState] = React.useState<{
144151
column: InfraPodsStatusTableColumn;
145152
order: 'asc' | 'desc';

packages/app/tests/e2e/features/kubernetes.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,24 @@ test.describe('Kubernetes Dashboard', { tag: ['@kubernetes'] }, () => {
148148
'ResourceAttributes.k8s.namespace.name:"default"',
149149
);
150150
});
151+
152+
test('should switch to "All" tab when filtering by pod or namespace', async ({
153+
page,
154+
}) => {
155+
// Verify initial state is "Running"
156+
const podsTable = page.getByTestId('k8s-pods-table');
157+
const runningTab = podsTable.getByRole('radio', { name: 'Running' });
158+
await expect(runningTab).toBeChecked();
159+
160+
// Filter by namespace
161+
const namespaceFilter = page.getByTestId('namespace-filter-select');
162+
await namespaceFilter.click();
163+
await page.getByRole('option', { name: 'default' }).click();
164+
165+
await page.waitForTimeout(500);
166+
167+
// Verify it switched to "All" tab
168+
const allTab = podsTable.getByRole('radio', { name: 'All' });
169+
await expect(allTab).toBeChecked();
170+
});
151171
});

0 commit comments

Comments
 (0)