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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
refactor(ui): state the filter-control rule, and apply it to DeliveryLog
Juan Denis4b271e3886dc
diff --git a/frontend/src/components/ds/FilterDrawer.jsx b/frontend/src/components/ds/FilterDrawer.jsxindex e19752bb..76856695 100644--- a/frontend/src/components/ds/FilterDrawer.jsx+++ b/frontend/src/components/ds/FilterDrawer.jsx@@ -3,11 +3,20 @@ import { Button } from '@/components/ui/button';import { cn } from '@/lib/utils';import { Drawer } from './Drawer';-// Schema-driven advanced-filter slide-over, shared across tables/lists (the-// marketplace today; domains/services/etc. next). A page passes a `groups`-// schema plus a controlled `value`/`onChange`, and the drawer renders each-// group as a set of toggle chips. Changes apply live so results update behind-// the open drawer.+// Schema-driven advanced-filter slide-over, shared across tables/lists. A page+// passes a `groups` schema plus a controlled `value`/`onChange`, and the drawer+// renders each group as a set of toggle chips. Changes apply live so results+// update behind the open drawer.+//+// WHICH FILTER CONTROL TO USE — pages had drifted into three unrelated+// interactions for the same job, so pick by shape, not by taste:+//+// <= 4 mutually-exclusive options, one dimension -> <SegControl/>, inline+// more options, or more than one dimension -> this drawer+// an unbounded list (servers, groups, versions) -> a plain <select>+//+// A raw <select> is never right for a fixed set of states, and a segmented+// control is never right for two dimensions at once.//// groups = [// { key: 'ownership', label: 'Publisher', type: 'single',diff --git a/frontend/src/pages/DeliveryLog.jsx b/frontend/src/pages/DeliveryLog.jsxindex 66db9bc7..26732ea2 100644--- a/frontend/src/pages/DeliveryLog.jsx+++ b/frontend/src/pages/DeliveryLog.jsx@@ -1,7 +1,7 @@import { useState, useEffect, useCallback, useRef } from 'react';import { Send, RefreshCw, Inbox } from 'lucide-react';import api from '../services/api';-import { PageTopbar, MetricCard, KpiBand } from '@/components/ds';+import { PageTopbar, MetricCard, KpiBand, FilterDrawer, FilterButton } from '@/components/ds';import { Button } from '@/components/ui/button';import { useAuth } from '../contexts/AuthContext';import { useToast } from '../contexts/ToastContext';@@ -19,6 +19,7 @@ export default function DeliveryLog() {const [stats, setStats] = useState(null);const [status, setStatus] = useState('all');const [channel, setChannel] = useState('all');+ const [filtersOpen, setFiltersOpen] = useState(false);const [loading, setLoading] = useState(true);const pollRef = useRef(null);@@ -72,9 +73,15 @@ export default function DeliveryLog() {title="Notification Delivery Log"meta="Outbound deliveries across all channels"actions={(- <Button variant="outline" size="sm" onClick={load}>- <RefreshCw size={14} /> Refresh- </Button>+ <>+ <FilterButton+ count={(status !== 'all' ? 1 : 0) + (channel !== 'all' ? 1 : 0)}+ onClick={() => setFiltersOpen(true)}+ />+ <Button variant="outline" size="sm" onClick={load}>+ <RefreshCw size={14} /> Refresh+ </Button>+ </>)}/>@@ -88,20 +95,6 @@ export default function DeliveryLog() {<MetricCard label="Failed" value={byStatus.failed ?? 0} tone="red" /></KpiBand>- <div className="sk-dlog__filters">- <label>- Status- <select value={status} onChange={(e) => setStatus(e.target.value)}>- {STATUSES.map((s) => <option key={s} value={s}>{s}</option>)}- </select>- </label>- <label>- Channel- <select value={channel} onChange={(e) => setChannel(e.target.value)}>- {CHANNELS.map((c) => <option key={c} value={c}>{c}</option>)}- </select>- </label>- </div>{loading && deliveries.length === 0 ? (<div className="sk-dlog__empty">Loading…</div>@@ -148,6 +141,27 @@ export default function DeliveryLog() {</div>)}</div>++ <FilterDrawer+ open={filtersOpen}+ onOpenChange={setFiltersOpen}+ title="Filter deliveries"+ activeCount={(status !== 'all' ? 1 : 0) + (channel !== 'all' ? 1 : 0)}+ groups={[+ { key: 'status', label: 'Status', type: 'single',+ options: STATUSES.filter((v) => v !== 'all').map((v) => ({ value: v, label: v })) },+ { key: 'channel', label: 'Channel', type: 'single',+ options: CHANNELS.filter((v) => v !== 'all').map((v) => ({ value: v, label: v })) },+ ]}+ value={{+ status: status === 'all' ? '' : status,+ channel: channel === 'all' ? '' : channel,+ }}+ onChange={(next) => {+ setStatus(next.status || 'all');+ setChannel(next.channel || 'all');+ }}+ /></>);}