Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(list): one filter button per page, and one row of chrome instead of two

Juan Denisc2c04ee34259
diff --git a/frontend/src/components/ds/grid/GridViewPicker.jsx b/frontend/src/components/ds/grid/GridViewPicker.jsx
index dcbd6ac1..1dc17b4e 100644
--- a/frontend/src/components/ds/grid/GridViewPicker.jsx
+++ b/frontend/src/components/ds/grid/GridViewPicker.jsx
@@ -12,7 +12,10 @@ import { cn } from '@/lib/utils';
// Built-in views ship in code; "My views" are the user's own, persisted through
// /api/v1/views by useTableViews. A modified view shows an asterisk plus an
// inline Save / Reset strip, so tweaking a built-in never silently destroys it.
-export function GridViewPicker({ views, counts, onCreate, label = 'items', total }) {
+// `actions` is the table's own controls — the filter button and the "⋮". They
+// belong on the SAME line as the view name: a page whose toolbar has nothing
+// else in it was rendering an empty second bar just to hold two icons.
+export function GridViewPicker({ views, counts, onCreate, label = 'items', total, actions }) {
const [open, setOpen] = useState(false);
const [menuFor, setMenuFor] = useState(null);
const [creating, setCreating] = useState(false);
@@ -165,6 +168,8 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', total
</button>
</div>
)}
+
+ {actions && <div className="sk-viewbar__actions">{actions}</div>}
</div>
);
}
diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsx
index fb74714c..bca51ac5 100644
--- a/frontend/src/pages/Jobs.jsx
+++ b/frontend/src/pages/Jobs.jsx
@@ -19,8 +19,7 @@ import {
SearchField, FilterDrawer, FilterButton, countActiveFilters,
} from '@/components/ds';
import {
- useTableChrome, GridViewPicker, GridChips, GridFilterButton,
- GridToolsMenu, GridFilterDrawer,
+ useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import EmptyState from '../components/EmptyState';
@@ -504,15 +503,11 @@ export default function Jobs() {
<b>{byStatus.failed ?? 0} failed</b>
</>
)}
- tools={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
- </>
- )}
+ // ONE filter button on this page, and it is the top
+ // bar's: it opens the SERVER query drawer, which sees
+ // rows this client never loaded. A second one here
+ // opened a weaker drawer over the loaded page only.
+ tools={<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />}
/>
<GridChips {...chrome.chipProps} />
@@ -565,7 +560,6 @@ export default function Jobs() {
{/* The column-rule drawer. Distinct from the FilterDrawer above it:
that one rewrites the API query, this one narrows the rows the
query already returned. */}
- <GridFilterDrawer {...chrome.drawerProps} />
</div>
);
}
diff --git a/frontend/src/pages/Monitors.jsx b/frontend/src/pages/Monitors.jsx
index 4cebddb7..8cee598e 100644
--- a/frontend/src/pages/Monitors.jsx
+++ b/frontend/src/pages/Monitors.jsx
@@ -18,12 +18,11 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import EmptyState from '../components/EmptyState';
import {
- DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer, ListToolbar,
+ DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer,
Pill, SearchField, Sparkline, countActiveFilters,
} from '@/components/ds';
import {
- useTableChrome, GridViewPicker, GridChips, GridFilterButton,
- GridToolsMenu, GridFilterDrawer,
+ useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -469,17 +468,13 @@ export default function Monitors() {
</>
)}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
- </>
- )}
+ // The "⋮" sits on the view-name line. There is exactly ONE
+ // filter button on this page and it is the top bar's, which
+ // opens the SERVER query drawer; a second one here opened a
+ // second drawer that narrowed the same list a weaker way, which
+ // is the duplicate affordance this whole round removes. Column
+ // rules come from each column's own menu and show in the chips.
+ actions={<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />}
/>
<GridChips {...chrome.chipProps} />
@@ -527,7 +522,6 @@ export default function Monitors() {
title="Filter monitors"
/>
- <GridFilterDrawer {...chrome.drawerProps} />
<Drawer
open={formOpen}
diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsx
index 390801d0..9544f168 100644
--- a/frontend/src/pages/Telemetry.jsx
+++ b/frontend/src/pages/Telemetry.jsx
@@ -27,8 +27,7 @@ import {
Pill, SearchField, countActiveFilters,
} from '@/components/ds';
import {
- useTableChrome, GridViewPicker, GridChips, GridFilterButton,
- GridToolsMenu, GridFilterDrawer,
+ useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -380,17 +379,12 @@ export default function Telemetry() {
label="events"
total={`${events.length} loaded · ${stats?.total || 0} in the last 24h`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={() => fetchEvents(1, true)} />
- </>
- )}
+ // The "..." sits on the view-name line rather than in a toolbar
+ // of its own -- with nothing else to put there, that toolbar was
+ // an empty bar holding one icon. And there is ONE filter button
+ // on this page: the top bar's, which opens the SERVER query
+ // drawer (eight keys, applied to the query, not the loaded 50).
+ actions={<GridToolsMenu {...chrome.toolsProps} onRefresh={() => fetchEvents(1, true)} />}
/>
<GridChips {...chrome.chipProps} />
@@ -519,8 +513,6 @@ export default function Telemetry() {
</div>
</FilterDrawer>
- <GridFilterDrawer {...chrome.drawerProps} />
-
<Drawer
open={Boolean(selectedEvent)}
onOpenChange={(open) => { if (!open) setSelectedEvent(null); }}
diff --git a/frontend/src/styles/components/_datagrid.scss b/frontend/src/styles/components/_datagrid.scss
index 250e01e7..76f6a8e4 100644
--- a/frontend/src/styles/components/_datagrid.scss
+++ b/frontend/src/styles/components/_datagrid.scss
@@ -58,6 +58,17 @@
white-space: nowrap;
}
+ // The table's own controls (filter, "⋮") sit on the SAME line as the view
+ // name. They used to go in a ListToolbar underneath, which on a page with
+ // nothing else to put there rendered a 32px-tall empty bar holding two
+ // right-aligned icons — one row of chrome pretending to be two.
+ &__actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-left: auto;
+ }
+
// Amber, not red: unsaved tweaks are a state, not an error.
&__dirty {
display: flex;