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(ui): Services list -> dense sk-dtable + SegControl + src badges (S8.2)

Juan Denis6e3d0f515531
diff --git a/docs/REDESIGN_MAP.md b/docs/REDESIGN_MAP.md
index 5a90e8f4..40c5c6bf 100644
--- a/docs/REDESIGN_MAP.md
+++ b/docs/REDESIGN_MAP.md
@@ -262,13 +262,15 @@ toolbar/tree-panel/workspace/statusbar) — this alone makes it "not the demo".
- Small: tree status-dot glow (`box-shadow: 0 0 6px currentColor`), `+` new-tab pill, ctx-menu "Browse rows"
/ "Export as SQL", bold green row count.
-### 8.2 Services list — structure diverged from the demo
-- List is a **flex-row layout, not the dense `.dtable`**; filters are **three native `<select>`s, not
- `SegControl`** (`Services.jsx:196–226, 265–404`). This is the page's main "doesn't match" driver.
-- **`.src-badge` missing** (template/github/gitea/docker/scratch source tile per row).
-- Detail: no back-link ("‹ All services"), title row stacks instead of inline h1+Pill. NewService: demo's 4
- method cards (Template/Git/Docker/Scratch) vs live 3 (Docker-image + scratch = §5 backend gap); 2-col
- review-panel layout is a deliberate improvement — keep.
+### 8.2 Services list — ✅ **list done 2026-06-11**
+List restyled to the demo: flex rows → dense `.sk-dtable` (ck / Service tile+type / **Source badge**
+(GitHub/git icon + owner/name from `deploy_repo_url`) / Domain / Status `Pill` (amber deploying·building, red
+failed) / Last Deploy / Actions with lucide icons); status `<select>` → `SegControl` (Type + Sort selects kept —
+capability superset); bulk-select/row-select kept via `is-selected`. Omitted CPU/Memory/Server columns (no list
+payload — §5). Remaining in this group:
+- Detail: no back-link ("‹ All services"), title row stacks instead of inline h1+Pill (LOW).
+- NewService: demo's 4 method cards vs live 3 (Docker-image + scratch = §5 backend gap); 2-col review-panel
+ layout is a deliberate improvement — keep.
- Backend (§5): metrics-history AreaCharts, real template catalog (live has 1 hardcoded template).
### 8.3 Terminal / Console — biggest IA gap
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 0abd6bc9..0d86b7ae 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -1,18 +1,18 @@
import React, { useState, useEffect, useMemo } from 'react';
import { useNavigate, Link } from 'react-router-dom';
-import { Box, Layers, Plus, Activity, Square, Clock } from 'lucide-react';
+import { Box, Layers, Plus, Activity, Square, Clock, Play, RotateCw, GitBranch, Github } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/serviceTypes';
import EmptyState from '../components/EmptyState';
-import { PageTopbar, MetricCard, Pill } from '@/components/ds';
+import { PageTopbar, MetricCard, Pill, SegControl } from '@/components/ds';
import { SERVICE_TABS } from '../components/services/serviceTabs';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Checkbox } from '@/components/ui/checkbox';
const SERVICE_TYPE_OPTIONS = ['all', 'docker', 'flask', 'django', 'php', 'static', 'wordpress'];
-const STATUS_OPTIONS = ['all', 'running', 'stopped'];
+const STATUS_PILL = { running: 'green', stopped: 'gray', deploying: 'amber', building: 'amber', failed: 'red' };
const SORT_OPTIONS = [
{ value: 'name-asc', label: 'Name A-Z' },
{ value: 'name-desc', label: 'Name Z-A' },
@@ -204,17 +204,15 @@ const Services = () => {
</option>
))}
</select>
- <select
+ <SegControl
value={statusFilter}
- onChange={(e) => setStatusFilter(e.target.value)}
- className="services-page__filter-select"
- >
- {STATUS_OPTIONS.map(opt => (
- <option key={opt} value={opt}>
- {opt === 'all' ? 'All Status' : opt.charAt(0).toUpperCase() + opt.slice(1)}
- </option>
- ))}
- </select>
+ onChange={setStatusFilter}
+ options={[
+ { value: 'all', label: 'All' },
+ { value: 'running', label: 'Running' },
+ { value: 'stopped', label: 'Stopped' },
+ ]}
+ />
<select
value={sortBy}
onChange={(e) => setSortBy(e.target.value)}
@@ -262,144 +260,130 @@ const Services = () => {
)}
/>
) : (
- <div className="services-page__list">
- {/* List Header */}
- <div className="services-page__list-header">
- <div className="services-page__list-header-left">
- <Checkbox
- checked={selectedIds.size === filteredApps.length && filteredApps.length > 0}
- onCheckedChange={toggleSelectAll}
- className="services-page__checkbox"
- />
- <span>Service</span>
- </div>
- <div className="services-page__list-header-right">
- <span>Status</span>
- <span>Last Deploy</span>
- <span>Actions</span>
- </div>
- </div>
-
- {filteredApps.map(app => {
- const typeInfo = getServiceType(app.app_type);
- const statusInfo = getStatusConfig(app.status);
- const isRunning = app.status === 'running';
-
- return (
- <div
- key={app.id}
- className={`services-page__row ${selectedIds.has(app.id) ? 'services-page__row--selected' : ''}`}
- onClick={() => {
- if (app.app_type === 'wordpress') {
- navigate(`/wordpress/${app.id}`);
- } else {
- navigate(`/services/${app.id}`);
- }
- }}
- >
- <div className="services-page__row-main">
+ <div className="services-page__tablecard">
+ <table className="sk-dtable services-page__table">
+ <thead>
+ <tr>
+ <th className="services-page__ck">
<Checkbox
- checked={selectedIds.has(app.id)}
- onCheckedChange={(checked) => {
- setSelectedIds(prev => {
- const next = new Set(prev);
- if (checked) next.add(app.id);
- else next.delete(app.id);
- return next;
- });
- }}
- onClick={(e) => e.stopPropagation()}
+ checked={selectedIds.size === filteredApps.length && filteredApps.length > 0}
+ onCheckedChange={toggleSelectAll}
className="services-page__checkbox"
+ aria-label="Select all services"
/>
- <div
- className="services-page__type-icon"
- style={{ backgroundColor: typeInfo.bgColor, color: typeInfo.color }}
- >
- <ServiceTypeIcon type={app.app_type} />
- </div>
- <div className="services-page__row-info">
- <div className="services-page__row-name">
- {app.name}
- </div>
- <div className="services-page__row-meta">
- <span
- className="services-page__type-badge"
- style={{ backgroundColor: typeInfo.bgColor, color: typeInfo.color, borderColor: typeInfo.borderColor }}
- >
- {typeInfo.label}
- </span>
- {app.domain && (
- <span className="services-page__domain">{app.domain}</span>
- )}
- </div>
- </div>
- </div>
-
- <div className="services-page__row-right">
- <Pill kind={app.status === 'running' ? 'green' : 'gray'}>{statusInfo.label}</Pill>
-
- {app.deploy_repo_url && (
- <div className="services-page__repo-pill">
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <circle cx="18" cy="18" r="3"/>
- <circle cx="6" cy="6" r="3"/>
- <path d="M6 21V9a9 9 0 0 0 9 9"/>
- </svg>
- {extractRepoName(app.deploy_repo_url)}
- </div>
- )}
+ </th>
+ <th>Service</th>
+ <th>Source</th>
+ <th>Domain</th>
+ <th>Status</th>
+ <th>Last Deploy</th>
+ <th className="services-page__th-actions">Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ {filteredApps.map(app => {
+ const typeInfo = getServiceType(app.app_type);
+ const statusInfo = getStatusConfig(app.status);
+ const isRunning = app.status === 'running';
+ const isGithub = (app.deploy_repo_url || '').includes('github.com');
- {app.last_deploy_at && (
- <span className="services-page__last-deploy">
- {formatRelativeTime(app.last_deploy_at)}
- </span>
- )}
-
- <div className="services-page__actions" onClick={e => e.stopPropagation()}>
- {isRunning ? (
- <>
- <Button
- variant="ghost"
- size="sm"
- onClick={(e) => handleAction(e, app.id, 'restart')}
- disabled={actionLoading === `${app.id}-restart`}
- title="Restart"
- >
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <polyline points="23 4 23 10 17 10"/>
- <path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
- </svg>
- </Button>
- <Button
- variant="ghost"
- size="sm"
- onClick={(e) => handleAction(e, app.id, 'stop')}
- disabled={actionLoading === `${app.id}-stop`}
- title="Stop"
+ return (
+ <tr
+ key={app.id}
+ className={`is-clickable ${selectedIds.has(app.id) ? 'is-selected' : ''}`}
+ onClick={() => {
+ if (app.app_type === 'wordpress') {
+ navigate(`/wordpress/${app.id}`);
+ } else {
+ navigate(`/services/${app.id}`);
+ }
+ }}
+ >
+ <td className="services-page__ck" onClick={(e) => e.stopPropagation()}>
+ <Checkbox
+ checked={selectedIds.has(app.id)}
+ onCheckedChange={(checked) => {
+ setSelectedIds(prev => {
+ const next = new Set(prev);
+ if (checked) next.add(app.id);
+ else next.delete(app.id);
+ return next;
+ });
+ }}
+ className="services-page__checkbox"
+ aria-label={`Select ${app.name}`}
+ />
+ </td>
+ <td>
+ <div className="sk-cell-name">
+ <div
+ className="services-page__type-icon"
+ style={{ backgroundColor: typeInfo.bgColor, color: typeInfo.color }}
>
- <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
- <rect x="6" y="6" width="12" height="12" rx="1"/>
- </svg>
- </Button>
- </>
- ) : (
- <Button
- variant="ghost"
- size="sm"
- onClick={(e) => handleAction(e, app.id, 'start')}
- disabled={actionLoading === `${app.id}-start`}
- title="Start"
- >
- <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
- <polygon points="5 3 19 12 5 21 5 3"/>
- </svg>
- </Button>
- )}
- </div>
- </div>
- </div>
- );
- })}
+ <ServiceTypeIcon type={app.app_type} />
+ </div>
+ <div>
+ <div>{app.name}</div>
+ <div className="sk-cell-sub">{typeInfo.label}</div>
+ </div>
+ </div>
+ </td>
+ <td>
+ {app.deploy_repo_url ? (
+ <span className="services-page__src-badge" title={app.deploy_repo_url}>
+ {isGithub ? <Github size={12} /> : <GitBranch size={12} />}
+ {extractRepoName(app.deploy_repo_url)}
+ </span>
+ ) : (
+ <span className="services-page__nil">—</span>
+ )}
+ </td>
+ <td className="sk-cell-mono">{app.domain || <span className="services-page__nil">—</span>}</td>
+ <td><Pill kind={STATUS_PILL[app.status] || 'gray'}>{statusInfo.label}</Pill></td>
+ <td className="sk-cell-mono">
+ {app.last_deploy_at ? formatRelativeTime(app.last_deploy_at) : <span className="services-page__nil">—</span>}
+ </td>
+ <td onClick={(e) => e.stopPropagation()}>
+ <div className="services-page__actions">
+ {isRunning ? (
+ <>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={(e) => handleAction(e, app.id, 'restart')}
+ disabled={actionLoading === `${app.id}-restart`}
+ title="Restart"
+ >
+ <RotateCw size={14} />
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={(e) => handleAction(e, app.id, 'stop')}
+ disabled={actionLoading === `${app.id}-stop`}
+ title="Stop"
+ >
+ <Square size={14} />
+ </Button>
+ </>
+ ) : (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={(e) => handleAction(e, app.id, 'start')}
+ disabled={actionLoading === `${app.id}-start`}
+ title="Start"
+ >
+ <Play size={14} />
+ </Button>
+ )}
+ </div>
+ </td>
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
</div>
)}
</div>
diff --git a/frontend/src/styles/pages/_services.scss b/frontend/src/styles/pages/_services.scss
index 98240c22..5d8b4b49 100644
--- a/frontend/src/styles/pages/_services.scss
+++ b/frontend/src/styles/pages/_services.scss
@@ -91,164 +91,69 @@
@media (max-width: $breakpoint-sm) { grid-template-columns: 1fr; }
}
- &__list {
- display: flex;
- flex-direction: column;
+ // dense list (demo .dtable) — surface card around an .sk-dtable
+ &__tablecard {
+ background: var(--surface);
border: 1px solid var(--border-soft);
border-radius: var(--radius);
overflow: hidden;
}
- &__row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: $space-4 $space-5;
- background: $bg-card;
- cursor: pointer;
- transition: background $transition-fast;
+ &__table {
+ td { white-space: nowrap; }
- &:hover {
- background: $bg-hover;
+ // checkbox gutter
+ .services-page__ck {
+ width: 36px;
+ padding-right: 0;
}
- & + & {
- border-top: 1px solid $border-subtle;
- }
- }
+ .services-page__th-actions { text-align: right; }
- &__row-main {
- display: flex;
- align-items: center;
- gap: $space-3;
- min-width: 0;
- flex: 1;
+ @media (max-width: $breakpoint-md) {
+ // drop Source + Domain + Last Deploy on narrow screens
+ th:nth-child(3), td:nth-child(3),
+ th:nth-child(4), td:nth-child(4),
+ th:nth-child(6), td:nth-child(6) { display: none; }
+ }
}
&__type-icon {
- width: 36px;
- height: 36px;
- border-radius: $radius-lg;
+ width: 30px;
+ height: 30px;
+ border-radius: 9px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
- &__row-info {
- min-width: 0;
- }
-
- &__row-name {
- font-weight: $font-weight-medium;
- color: $text-primary;
- font-size: $font-size-base;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- &__row-meta {
- display: flex;
- align-items: center;
- gap: $space-2;
- margin-top: 2px;
- }
-
- &__type-badge {
- font-size: $font-size-xs;
- font-weight: $font-weight-medium;
- padding: 1px $space-2;
- border-radius: $radius-full;
- border: 1px solid;
- line-height: 1.4;
- }
-
- &__domain {
- font-size: $font-size-xs;
- color: $text-tertiary;
- font-family: $font-mono;
- }
-
- &__row-right {
- display: flex;
- align-items: center;
- gap: $space-4;
- flex-shrink: 0;
- }
-
- &__status {
- display: flex;
- align-items: center;
- gap: $space-2;
- font-size: $font-size-sm;
- font-weight: $font-weight-medium;
- white-space: nowrap;
-
- &--live {
- color: $success;
- }
-
- &--stopped {
- color: $text-tertiary;
- }
-
- &--deploying,
- &--building {
- color: $warning;
- }
-
- &--failed {
- color: $danger;
- }
- }
-
- &__status-dot {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background: currentColor;
- flex-shrink: 0;
-
- .services-page__status--live & {
- animation: pulse-dot 2s ease-in-out infinite;
- }
-
- .services-page__status--deploying &,
- .services-page__status--building & {
- animation: pulse-dot 1s ease-in-out infinite;
- }
- }
-
- &__repo-pill {
- display: flex;
+ // source badge (demo .src-badge): repo provider icon + owner/name
+ &__src-badge {
+ display: inline-flex;
align-items: center;
- gap: $space-1;
- font-size: $font-size-xs;
- color: $text-tertiary;
- background: $bg-secondary;
- padding: 2px $space-2;
- border-radius: $radius-full;
- font-family: $font-mono;
- max-width: 180px;
+ gap: 6px;
+ padding: 3px 9px;
+ background: var(--surface-2);
+ border: 1px solid var(--border-soft);
+ border-radius: 6px;
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-dim);
+ max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
- svg {
- flex-shrink: 0;
- }
+ svg { flex-shrink: 0; color: var(--text-faint); }
}
- &__last-deploy {
- font-size: $font-size-xs;
- color: $text-tertiary;
- white-space: nowrap;
- }
+ &__nil { color: var(--text-ghost); }
&__actions {
display: flex;
gap: $space-1;
+ justify-content: flex-end;
}
&__empty {
@@ -271,34 +176,6 @@
opacity: 0.5;
}
- // List Header
- &__list-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 11px $space-5;
- font-family: var(--mono);
- font-size: 10.5px;
- color: var(--text-faint);
- font-weight: $font-weight-semibold;
- text-transform: uppercase;
- letter-spacing: 0.06em;
- border-bottom: 1px solid var(--border);
- background: var(--surface-2);
- }
-
- &__list-header-left {
- display: flex;
- align-items: center;
- gap: $space-3;
- }
-
- &__list-header-right {
- display: flex;
- align-items: center;
- gap: $space-8;
- }
-
// Checkbox
&__checkbox {
width: 16px;
@@ -308,11 +185,6 @@
flex-shrink: 0;
}
- // Row selected state
- &__row--selected {
- background: var(--accent-glow, fade($accent-primary-raw, 8%)) !important;
- }
-
// Bulk Actions Bar
&__bulk-bar {
display: flex;