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.

feat(services,workspaces,servers): group-by + native selection + row cursor

Juan Denis084638984ca4
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index bbf0f6d3..34835bbe 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -8,7 +8,7 @@ import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import {
- ColumnsMenu, DataTable, DataTableFooter, Drawer, Gauge, ListToolbar, Pill, SearchField, SegControl, SortChipBar, SortMenu, ViewMenu,
+ ColumnsMenu, DataTable, DataTableFooter, Drawer, Gauge, GroupMenu, ListToolbar, Pill, SearchField, SegControl, SortChipBar, SortMenu, ViewMenu,
} from '@/components/ds';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
@@ -114,6 +114,8 @@ const SERVER_COLUMNS = [
header: 'Status',
sortable: true,
sortValue: (server) => server.status || 'pending',
+ groupable: true,
+ groupLabel: (value) => (value ? value.charAt(0).toUpperCase() + value.slice(1) : 'None'),
render: (server) => {
const status = server.status || 'pending';
return <Pill kind={STATUS_KIND[status] || 'gray'}>{status}</Pill>;
@@ -158,8 +160,25 @@ const Servers = () => {
const {
hiddenKeys, setHiddenKeys, toggleColumn, showAllColumns,
} = useColumnVisibility({ storageKey: 'serverkit-table-servers-cols' });
+ const [groupBy, setGroupBy] = useState(() => {
+ try {
+ return window.localStorage.getItem('serverkit-table-servers-group') || null;
+ } catch {
+ return null;
+ }
+ });
const toast = useToast();
+ const changeGroupBy = (next) => {
+ setGroupBy(next);
+ try {
+ if (next) window.localStorage.setItem('serverkit-table-servers-group', next);
+ else window.localStorage.removeItem('serverkit-table-servers-group');
+ } catch {
+ /* private mode / quota — the choice just doesn't persist */
+ }
+ };
+
// Saved views: capture/apply the table chrome state (status filter, group
// filter, search, sort levels, hidden columns). Every key is guarded so a
// partial view state only touches what it sets.
@@ -169,7 +188,8 @@ const Servers = () => {
search: searchTerm,
sorts,
hiddenKeys,
- }), [selectedStatus, selectedGroup, searchTerm, sorts, hiddenKeys]);
+ groupBy,
+ }), [selectedStatus, selectedGroup, searchTerm, sorts, hiddenKeys, groupBy]);
const applyView = useCallback((state) => {
if (state.status !== undefined) setSelectedStatus(state.status);
@@ -177,6 +197,7 @@ const Servers = () => {
if (state.search !== undefined) setSearchTerm(state.search);
if (Array.isArray(state.sorts)) setSorts(state.sorts);
if (Array.isArray(state.hiddenKeys)) setHiddenKeys(state.hiddenKeys);
+ if (state.groupBy !== undefined) changeGroupBy(state.groupBy);
}, [setSorts, setHiddenKeys]);
const tableViews = useTableViews({
@@ -280,6 +301,7 @@ const Servers = () => {
tools={(
<>
<ViewMenu views={tableViews} />
+ <GroupMenu columns={SERVER_COLUMNS} groupBy={groupBy} onChange={changeGroupBy} />
<SortMenu columns={SERVER_COLUMNS} sorts={sorts} onChange={setSorts} />
<ColumnsMenu
columns={SERVER_COLUMNS}
@@ -338,6 +360,9 @@ const Servers = () => {
sorts={sorts}
onSortsChange={setSorts}
hiddenKeys={hiddenKeys}
+ groupBy={groupBy}
+ onGroupByChange={changeGroupBy}
+ keyboardNav
onRowClick={(server) => navigate(`/servers/${server.id}`)}
rowClassName="servers-row"
className="servers-card"
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 2c38c629..c7ee9069 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -10,7 +10,6 @@ import { formatBytes } from '../utils/formatBytes';
import { Pill, ServiceTile, EnvTag, SearchField } from '@/components/ds';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { Button } from '@/components/ui/button';
-import { Checkbox } from '@/components/ui/checkbox';
import { Label } from '@/components/ui/label';
import {
Select,
@@ -137,8 +136,6 @@ const Services = () => {
[searchTerm]
);
- const allSelected = filteredApps.length > 0 && filteredApps.every(a => selectedIds.has(a.id));
-
const toggleOne = (id, checked) => {
setSelectedIds(prev => {
const next = new Set(prev);
@@ -148,34 +145,9 @@ const Services = () => {
});
};
- // DataTable columns. Interactive cells (checkbox, row actions) stop click
+ // DataTable columns. Interactive cells (row actions) stop click
// propagation so they don't trigger the row's navigate.
const columns = [
- {
- key: '__select',
- sortable: false,
- hideable: false,
- className: 'wp-list__ck',
- cellClassName: 'wp-list__ck',
- header: (
- <Checkbox
- checked={allSelected}
- onCheckedChange={(checked) => {
- setSelectedIds(checked ? new Set(filteredApps.map(a => a.id)) : new Set());
- }}
- aria-label="Select all services"
- />
- ),
- render: (app) => (
- <div onClick={(e) => e.stopPropagation()}>
- <Checkbox
- checked={selectedIds.has(app.id)}
- onCheckedChange={(checked) => toggleOne(app.id, checked)}
- aria-label={`Select ${app.name}`}
- />
- </div>
- ),
- },
{
key: 'name',
header: 'Service',
@@ -200,6 +172,9 @@ const Services = () => {
sortable: true,
// Unassigned services (no project) sort last.
sortValue: (app) => app.project_name || null,
+ groupable: true,
+ groupValue: (app) => app.project_name || null,
+ groupLabel: (value) => value ?? 'Unassigned',
render: (app) => (
app.project_name ? (
<span className="services-page__project">
@@ -281,6 +256,9 @@ const Services = () => {
sortable: true,
// Same severity order as the page's default ordering, not alphabet.
sortValue: (app) => STATUS_SORT_ORDER[app.status] ?? 5,
+ groupable: true,
+ groupValue: (app) => app.status,
+ groupLabel: (value) => (value ? value.charAt(0).toUpperCase() + value.slice(1) : 'None'),
render: (app) => <Pill kind={STATUS_PILL[app.status] || 'gray'}>{getStatusConfig(app.status).label}</Pill>,
},
{
@@ -342,7 +320,10 @@ const Services = () => {
columns={columns}
keyField="id"
onRowClick={(app) => navigate(app.app_type === 'wordpress' ? `/wordpress/${app.id}` : `/services/${app.id}`)}
- rowClassName={(app) => (selectedIds.has(app.id) ? 'is-selected' : '')}
+ selectable
+ selectedIds={selectedIds}
+ onToggleSelect={toggleOne}
+ onSelectAll={(checked) => setSelectedIds(checked ? new Set(filteredApps.map(a => a.id)) : new Set())}
filters={[
{ value: 'all', label: 'All', count: apps.length },
{ value: 'running', label: 'Running', count: runningCount },
diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsx
index 577b07b2..964838af 100644
--- a/frontend/src/pages/Workspaces.jsx
+++ b/frontend/src/pages/Workspaces.jsx
@@ -10,7 +10,6 @@ import { useTopbarActions } from '@/hooks/useTopbarActions';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
-import { Checkbox } from '@/components/ui/checkbox';
// Matches WorkspaceSwitcher: the active workspace id lives in localStorage.
const ACTIVE_KEY = 'active_workspace_id';
@@ -87,41 +86,18 @@ const Workspaces = () => {
const activeCount = workspaces.filter(ws => ws.status === 'active').length;
+ const toggleOne = (id, checked) => {
+ setSelectedIds(prev => {
+ const next = new Set(prev);
+ if (checked) next.add(id);
+ else next.delete(id);
+ return next;
+ });
+ };
+
// DataTable columns. Interactive cells stop click propagation so they don't
// trigger the row's navigate.
const columns = [
- {
- key: '__select',
- sortable: false,
- hideable: false,
- className: 'wp-list__ck',
- cellClassName: 'wp-list__ck',
- header: (
- <Checkbox
- checked={shownWorkspaces.length > 0 && shownWorkspaces.every(ws => selectedIds.has(ws.id))}
- onCheckedChange={(checked) => {
- setSelectedIds(checked ? new Set(shownWorkspaces.map(ws => ws.id)) : new Set());
- }}
- aria-label="Select all workspaces"
- />
- ),
- render: (ws) => (
- <div onClick={e => e.stopPropagation()}>
- <Checkbox
- checked={selectedIds.has(ws.id)}
- onCheckedChange={(checked) => {
- setSelectedIds(prev => {
- const next = new Set(prev);
- if (checked) next.add(ws.id);
- else next.delete(ws.id);
- return next;
- });
- }}
- aria-label={`Select ${ws.name || `workspace ${ws.id}`}`}
- />
- </div>
- ),
- },
{
key: 'name',
header: 'Workspace',
@@ -158,6 +134,9 @@ const Workspaces = () => {
sortable: true,
// Matches the pill: the active workspace (and active status) first.
sortValue: (ws) => (activeId === String(ws.id) || ws.status === 'active' ? 0 : 1),
+ groupable: true,
+ groupValue: (ws) => ws.status,
+ groupLabel: (value) => (value ? value.charAt(0).toUpperCase() + value.slice(1) : 'None'),
render: (ws) => (
activeId === String(ws.id)
? <Pill kind="green">active</Pill>
@@ -191,7 +170,10 @@ const Workspaces = () => {
columns={columns}
keyField="id"
onRowClick={(ws) => navigate(`/workspaces/${ws.id}`)}
- rowClassName={(ws) => (selectedIds.has(ws.id) ? 'is-selected' : '')}
+ selectable
+ selectedIds={selectedIds}
+ onToggleSelect={toggleOne}
+ onSelectAll={(checked) => setSelectedIds(checked ? new Set(shownWorkspaces.map(ws => ws.id)) : new Set())}
filters={[
{ value: 'all', label: 'All', count: workspaces.length },
{ value: 'active', label: 'Active', count: activeCount },