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
feat(services,workspaces): opt columns into sorting, persist table state
Juan Denise79538eb3718
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsxindex c0b8c0d6..9439ae53 100644--- a/frontend/src/pages/Services.jsx+++ b/frontend/src/pages/Services.jsx@@ -31,6 +31,9 @@ import RequiresDocker from '../components/RequiresDocker';const STATUS_PILL = { running: 'green', stopped: 'gray', deploying: 'amber', building: 'amber', failed: 'red' };+// Severity order for status sorting — also the page's default row order.+const STATUS_SORT_ORDER = { running: 0, deploying: 1, building: 2, stopped: 3, failed: 4 };+// Sentinels for the move-to-project Select (Radix forbids empty-string values).const UNASSIGN = '__unassign__';const NO_ENV = '__no_env__';@@ -112,8 +115,7 @@ const Services = () => {return true;}).sort((a, b) => {- const order = { running: 0, deploying: 1, building: 2, stopped: 3, failed: 4 };- return (order[a.status] ?? 5) - (order[b.status] ?? 5) || a.name.localeCompare(b.name);+ return (STATUS_SORT_ORDER[a.status] ?? 5) - (STATUS_SORT_ORDER[b.status] ?? 5) || a.name.localeCompare(b.name);});}, [apps, searchTerm, statusFilter]);@@ -158,6 +160,8 @@ const Services = () => {const columns = [{key: '__select',+ sortable: false,+ hideable: false,className: 'wp-list__ck',cellClassName: 'wp-list__ck',header: (@@ -182,6 +186,8 @@ const Services = () => {{key: 'name',header: 'Service',+ sortable: true,+ hideable: false,render: (app) => {const typeInfo = getServiceType(app.app_type);return (@@ -198,6 +204,9 @@ const Services = () => {{key: 'project',header: 'Project',+ sortable: true,+ // Unassigned services (no project) sort last.+ sortValue: (app) => app.project_name || null,render: (app) => (app.project_name ? (<span className="services-page__project">@@ -249,6 +258,8 @@ const Services = () => {{key: 'domain',header: 'Domain',+ sortable: true,+ sortValue: (app) => (app.domains?.find(d => d.is_primary) || app.domains?.[0])?.name || null,cellClassName: 'sk-cell-mono',render: (app) => {const primaryDomain = (app.domains?.find(d => d.is_primary) || app.domains?.[0])?.name || '';@@ -274,11 +285,17 @@ const Services = () => {{key: 'status',header: 'Status',+ sortable: true,+ // Same severity order as the page's default ordering, not alphabet.+ sortValue: (app) => STATUS_SORT_ORDER[app.status] ?? 5,render: (app) => <Pill kind={STATUS_PILL[app.status] || 'gray'}>{getStatusConfig(app.status).label}</Pill>,},{key: 'last_deploy',header: 'Last Deploy',+ sortable: true,+ // Numeric timestamp sort; never-deployed services sort last.+ sortValue: (app) => (app.last_deploy_at ? new Date(app.last_deploy_at).getTime() : null),cellClassName: 'sk-cell-mono',render: (app) => (app.last_deploy_at ? formatRelativeTime(app.last_deploy_at) : <span className="wp-list__dash">—</span>@@ -288,6 +305,8 @@ const Services = () => {key: '__actions',header: '',width: 70,+ sortable: false,+ hideable: false,render: (app) => {const isRunning = app.status === 'running';return (@@ -318,6 +337,7 @@ const Services = () => {className="services-page"loading={loading}loadingTitle="Loading services..."+ storageKey="serverkit-list-services"totalCount={apps.length}items={filteredApps}columns={columns}diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsxindex b96532b2..7ac65793 100644--- a/frontend/src/pages/Workspaces.jsx+++ b/frontend/src/pages/Workspaces.jsx@@ -85,6 +85,8 @@ const Workspaces = () => {const columns = [{key: '__select',+ sortable: false,+ hideable: false,className: 'wp-list__ck',cellClassName: 'wp-list__ck',header: (@@ -116,6 +118,8 @@ const Workspaces = () => {{key: 'name',header: 'Workspace',+ sortable: true,+ hideable: false,render: (ws) => {const since = formatSince(ws.created_at);return (@@ -136,13 +140,17 @@ const Workspaces = () => {);},},- { key: 'slug', header: 'Slug', cellClassName: 'sk-cell-mono', render: (ws) => `/${ws.slug}` },- { key: 'members', header: 'Members', cellClassName: 'sk-cell-mono', render: (ws) => ws.member_count ?? 0 },- { key: 'servers', header: 'Servers', cellClassName: 'sk-cell-mono', render: (ws) => (ws.max_servers > 0 ? ws.max_servers : '—') },- { key: 'users', header: 'Users', cellClassName: 'sk-cell-mono', render: (ws) => (ws.max_users > 0 ? ws.max_users : '—') },+ { key: 'slug', header: 'Slug', sortable: true, cellClassName: 'sk-cell-mono', render: (ws) => `/${ws.slug}` },+ // Numeric sorts: unlimited (0/unset) sorts last.+ { key: 'members', header: 'Members', sortable: true, sortValue: (ws) => ws.member_count ?? null, cellClassName: 'sk-cell-mono', render: (ws) => ws.member_count ?? 0 },+ { key: 'servers', header: 'Servers', sortable: true, sortValue: (ws) => (ws.max_servers > 0 ? ws.max_servers : null), cellClassName: 'sk-cell-mono', render: (ws) => (ws.max_servers > 0 ? ws.max_servers : '—') },+ { key: 'users', header: 'Users', sortable: true, sortValue: (ws) => (ws.max_users > 0 ? ws.max_users : null), cellClassName: 'sk-cell-mono', render: (ws) => (ws.max_users > 0 ? ws.max_users : '—') },{key: 'status',header: 'Status',+ sortable: true,+ // Matches the pill: the active workspace (and active status) first.+ sortValue: (ws) => (activeId === String(ws.id) || ws.status === 'active' ? 0 : 1),render: (ws) => (activeId === String(ws.id)? <Pill kind="green">active</Pill>@@ -152,6 +160,8 @@ const Workspaces = () => {{key: '__chev',header: '',+ sortable: false,+ hideable: false,className: 'wp-list__action',render: () => <ChevronRight size={16} className="wp-list__chev" />,},@@ -162,6 +172,7 @@ const Workspaces = () => {className="workspaces-page"loading={loading}loadingTitle="Loading workspaces"+ storageKey="serverkit-list-workspaces"totalCount={workspaces.length}items={shownWorkspaces}columns={columns}