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.

Add tunnel mode and enhance servers UI

Juan Denise25cf6f83e67
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..ebbf0f13
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,13 @@
+* text=auto eol=lf
+
+*.sh text eol=lf
+*.ps1 text eol=crlf
+*.bat text eol=crlf
+*.cmd text eol=crlf
+
+*.png binary
+*.jpg binary
+*.jpeg binary
+*.gif binary
+*.ico binary
+*.pdf binary
diff --git a/dev.ps1 b/dev.ps1
index 62b8a9dd..c9ff27d5 100644
--- a/dev.ps1
+++ b/dev.ps1
@@ -3,19 +3,25 @@
.SYNOPSIS
ServerKit development launcher and validation tool.
.DESCRIPTION
- Start backend, frontend, or both. Run validation checks.
+ Start backend, frontend, both, or expose backend via an ngrok tunnel.
+ Run validation checks.
.PARAMETER Mode
- Operation mode: start (default), backend, frontend, validate
+ Operation mode: start (default), backend, frontend, tunnel, validate
.EXAMPLE
.\dev.ps1 # Start backend + frontend
.\dev.ps1 backend # Backend only
.\dev.ps1 frontend # Frontend only
+ .\dev.ps1 tunnel # Backend + frontend + ngrok tunnel for the backend
.\dev.ps1 validate # Run all linters/checks
+.NOTES
+ Optional environment variables for tunnel mode:
+ NGROK_DOMAIN - reserved ngrok domain (e.g. my-app.ngrok-free.app)
+ NGROK_AUTHTOKEN - ngrok authtoken (alternatively run `ngrok config add-authtoken`)
#>
param(
[Parameter(Position = 0)]
- [ValidateSet('start', 'backend', 'frontend', 'validate')]
+ [ValidateSet('start', 'backend', 'frontend', 'tunnel', 'validate')]
[string]$Mode = 'start'
)
@@ -120,6 +126,120 @@ function Start-Both {
}
}
+function Start-Tunnel {
+ if (-not (Get-Command ngrok -ErrorAction SilentlyContinue)) {
+ Write-Host "Error: ngrok is not installed or not in PATH." -ForegroundColor Red
+ Write-Host ""
+ Write-Host "Install ngrok:"
+ Write-Host " - https://ngrok.com/download"
+ Write-Host " - Windows: choco install ngrok (or scoop install ngrok)"
+ Write-Host " - WSL: snap install ngrok (or download the .tgz)"
+ Write-Host ""
+ Write-Host "Then authenticate once: ngrok config add-authtoken <YOUR_TOKEN>"
+ exit 1
+ }
+
+ Write-Host ""
+ Write-Host "ServerKit Dev Server (with ngrok tunnel)" -ForegroundColor Cyan
+ Write-Host " Backend: http://localhost:5000"
+ Write-Host " Frontend: http://localhost:5173"
+ Write-Host " Tunnel: exposing backend (port 5000) via ngrok"
+ Write-Host ""
+ Write-Host "NOTE: " -ForegroundColor Yellow -NoNewline
+ Write-Host "Agents and remote callers should use the public ngrok URL"
+ Write-Host " printed below as their --server / control plane URL."
+ Write-Host ""
+
+ if (-not $env:CORS_ORIGINS) {
+ $env:CORS_ORIGINS = 'http://localhost:5173,http://localhost:5000,https://*.ngrok-free.app,https://*.ngrok.app,https://*.ngrok.io'
+ }
+
+ $envSnapshot = @{
+ CORS_ORIGINS = $env:CORS_ORIGINS
+ }
+
+ $backendJob = Start-Job -ScriptBlock {
+ param($dir, $envVars)
+ foreach ($k in $envVars.Keys) { Set-Item -Path "Env:$k" -Value $envVars[$k] }
+ Set-Location $dir
+ if (Test-Path 'venv\Scripts\Activate.ps1') {
+ & 'venv\Scripts\Activate.ps1'
+ }
+ python run.py
+ } -ArgumentList $BackendDir, $envSnapshot
+
+ Start-Sleep -Seconds 2
+
+ $frontendJob = Start-Job -ScriptBlock {
+ param($dir)
+ Set-Location $dir
+ npm run dev
+ } -ArgumentList $FrontendDir
+
+ Start-Sleep -Seconds 1
+
+ $ngrokArgs = @('http', '5000', '--log=stdout')
+ if ($env:NGROK_DOMAIN) { $ngrokArgs += "--domain=$($env:NGROK_DOMAIN)" }
+ if ($env:NGROK_AUTHTOKEN) { $ngrokArgs += "--authtoken=$($env:NGROK_AUTHTOKEN)" }
+
+ $ngrokProc = Start-Process -FilePath 'ngrok' -ArgumentList $ngrokArgs -PassThru -WindowStyle Hidden
+
+ $urlPrinted = $false
+ try {
+ Write-Host "Press Ctrl+C to stop..." -ForegroundColor DarkGray
+ $polls = 0
+ while ($true) {
+ Receive-Job $backendJob -ErrorAction SilentlyContinue
+ Receive-Job $frontendJob -ErrorAction SilentlyContinue
+
+ if (-not $urlPrinted -and $polls -lt 30) {
+ try {
+ $resp = Invoke-RestMethod -Uri 'http://127.0.0.1:4040/api/tunnels' -TimeoutSec 1 -ErrorAction Stop
+ $publicUrl = ($resp.tunnels | Where-Object { $_.public_url -like 'https://*' } | Select-Object -First 1).public_url
+ if ($publicUrl) {
+ Write-Host ""
+ Write-Host "=========================================================" -ForegroundColor Green
+ Write-Host " Public tunnel URL: " -ForegroundColor Green -NoNewline
+ Write-Host $publicUrl -ForegroundColor Cyan
+ Write-Host " Use this as your agent --server / control plane URL." -ForegroundColor Green
+ Write-Host "=========================================================" -ForegroundColor Green
+ Write-Host ""
+ $urlPrinted = $true
+ }
+ }
+ catch { }
+ $polls++
+ }
+
+ if ($backendJob.State -eq 'Failed') {
+ Write-Host "Backend crashed!" -ForegroundColor Red
+ Receive-Job $backendJob
+ break
+ }
+ if ($frontendJob.State -eq 'Failed') {
+ Write-Host "Frontend crashed!" -ForegroundColor Red
+ Receive-Job $frontendJob
+ break
+ }
+ if ($ngrokProc.HasExited) {
+ Write-Host "ngrok exited." -ForegroundColor Red
+ break
+ }
+ Start-Sleep -Seconds 1
+ }
+ }
+ finally {
+ Stop-Job $backendJob -ErrorAction SilentlyContinue
+ Stop-Job $frontendJob -ErrorAction SilentlyContinue
+ Remove-Job $backendJob -Force -ErrorAction SilentlyContinue
+ Remove-Job $frontendJob -Force -ErrorAction SilentlyContinue
+ if ($ngrokProc -and -not $ngrokProc.HasExited) {
+ Stop-Process -Id $ngrokProc.Id -ErrorAction SilentlyContinue
+ }
+ Write-Host "`nStopped." -ForegroundColor Yellow
+ }
+}
+
function Invoke-Check {
param(
[string]$Name,
@@ -234,6 +354,7 @@ function Run-ValidateWatch {
switch ($Mode) {
'backend' { Start-Backend }
'frontend' { Start-Frontend }
+ 'tunnel' { Start-Tunnel }
'validate' { Run-ValidateWatch }
default { Start-Both }
}
diff --git a/dev.sh b/dev.sh
index 8028c0cf..cdee06d2 100644
--- a/dev.sh
+++ b/dev.sh
@@ -5,7 +5,12 @@
# ./dev.sh Start backend + frontend (default)
# ./dev.sh backend Backend only
# ./dev.sh frontend Frontend only
+# ./dev.sh tunnel Start backend + frontend + expose backend via ngrok
# ./dev.sh validate Run all linters/checks
+#
+# Environment variables:
+# NGROK_DOMAIN Optional reserved ngrok domain (e.g. my-app.ngrok-free.app)
+# NGROK_AUTHTOKEN Optional ngrok authtoken (alternatively run `ngrok config add-authtoken`)
set -euo pipefail
@@ -83,6 +88,94 @@ start_both() {
wait
}
+start_tunnel() {
+ if ! command -v ngrok &>/dev/null; then
+ echo -e "${RED}Error:${NC} ngrok is not installed or not in PATH."
+ echo ""
+ echo "Install ngrok:"
+ echo " - https://ngrok.com/download"
+ echo " - macOS: brew install ngrok/ngrok/ngrok"
+ echo " - Linux: snap install ngrok (or download the .tgz)"
+ echo " - Windows: choco install ngrok (or scoop install ngrok)"
+ echo ""
+ echo "Then authenticate once: ngrok config add-authtoken <YOUR_TOKEN>"
+ exit 1
+ fi
+
+ echo ""
+ echo -e "${CYAN}ServerKit Dev Server (with ngrok tunnel)${NC}"
+ echo " Backend: http://localhost:5000"
+ echo " Frontend: http://localhost:5173"
+ echo " Tunnel: exposing backend (port 5000) via ngrok"
+ echo ""
+ echo -e "${YELLOW}NOTE:${NC} Agents and remote callers should use the public ngrok URL"
+ echo " printed below as their --server / control plane URL."
+ echo ""
+
+ # Allow CORS from any ngrok domain by default unless caller already set it.
+ export CORS_ORIGINS="${CORS_ORIGINS:-http://localhost:5173,http://localhost:5000,https://*.ngrok-free.app,https://*.ngrok.app,https://*.ngrok.io}"
+
+ cd "$BACKEND_DIR"
+ if [ -f venv/bin/activate ]; then
+ source venv/bin/activate
+ fi
+ python run.py &
+ BACKEND_PID=$!
+
+ sleep 2
+
+ cd "$FRONTEND_DIR"
+ npm run dev &
+ FRONTEND_PID=$!
+
+ sleep 1
+
+ NGROK_ARGS=(http 5000 --log=stdout)
+ if [ -n "${NGROK_DOMAIN:-}" ]; then
+ NGROK_ARGS+=("--domain=$NGROK_DOMAIN")
+ fi
+ if [ -n "${NGROK_AUTHTOKEN:-}" ]; then
+ NGROK_ARGS+=("--authtoken=$NGROK_AUTHTOKEN")
+ fi
+
+ ngrok "${NGROK_ARGS[@]}" &
+ NGROK_PID=$!
+
+ # Poll the local ngrok API for the public URL and print it prominently.
+ (
+ for _ in $(seq 1 20); do
+ sleep 1
+ if command -v curl &>/dev/null; then
+ URL=$(curl -fsS http://127.0.0.1:4040/api/tunnels 2>/dev/null \
+ | grep -oE '"public_url":"https://[^"]+' \
+ | head -n1 \
+ | sed 's/"public_url":"//')
+ if [ -n "$URL" ]; then
+ echo ""
+ echo -e "${GREEN}=========================================================${NC}"
+ echo -e "${GREEN} Public tunnel URL: ${NC}${CYAN}$URL${NC}"
+ echo -e "${GREEN} Use this as your agent --server / control plane URL.${NC}"
+ echo -e "${GREEN}=========================================================${NC}"
+ echo ""
+ break
+ fi
+ fi
+ done
+ ) &
+
+ cleanup_tunnel() {
+ echo ""
+ echo -e "${YELLOW}Stopping...${NC}"
+ kill "$BACKEND_PID" "$FRONTEND_PID" "$NGROK_PID" 2>/dev/null || true
+ wait "$BACKEND_PID" "$FRONTEND_PID" "$NGROK_PID" 2>/dev/null || true
+ echo "Stopped."
+ }
+ trap cleanup_tunnel INT TERM
+
+ echo -e "${DIM}Press Ctrl+C to stop...${NC}"
+ wait
+}
+
run_validate() {
header "ServerKit Validation Suite"
local failed=0
@@ -173,6 +266,7 @@ MODE="${1:-start}"
case "$MODE" in
backend) start_backend ;;
frontend) start_frontend ;;
+ tunnel) start_tunnel ;;
validate) run_validate_watch ;;
start|*) start_both ;;
esac
diff --git a/docs/LOCAL_DEVELOPMENT.md b/docs/LOCAL_DEVELOPMENT.md
index a0175936..76056b6d 100644
--- a/docs/LOCAL_DEVELOPMENT.md
+++ b/docs/LOCAL_DEVELOPMENT.md
@@ -252,3 +252,90 @@ sudo usermod -aG docker $USER
# Remove the lock file
rm backend/instance/serverkit.db-journal
```
+
+---
+
+## Exposing Your Local Control Plane (ngrok)
+
+When developing locally on Windows/WSL you may want a remote ServerKit agent (or
+a Docker host on another machine) to connect back to your machine. The `dev.sh`
+and `dev.ps1` scripts include a `tunnel` mode that starts the backend, frontend,
+and an ngrok tunnel pointed at the backend (port 5000).
+
+### Prerequisites
+
+1. Install ngrok and authenticate once:
+
+ ```bash
+ # macOS / Linux / WSL
+ brew install ngrok/ngrok/ngrok # or: snap install ngrok
+ ngrok config add-authtoken <YOUR_TOKEN>
+ ```
+
+ ```powershell
+ # Windows
+ choco install ngrok # or: scoop install ngrok
+ ngrok config add-authtoken <YOUR_TOKEN>
+ ```
+
+2. (Optional) Reserve a domain in the ngrok dashboard so the URL stays stable
+ across restarts.
+
+### Start with a tunnel
+
+```bash
+# Linux / macOS / WSL
+./dev.sh tunnel
+```
+
+```powershell
+# Windows
+.\dev.ps1 tunnel
+```
+
+The public ngrok URL is printed in green once the tunnel is up. Use it as the
+`--server` argument when registering an agent:
+
+```bash
+serverkit-agent register \
+ --token "sk_reg_xxx" \
+ --server "https://<your-tunnel>.ngrok-free.app"
+```
+
+### Optional environment variables
+
+| Variable | Purpose |
+|----------|---------|
+| `NGROK_DOMAIN` | Use a reserved ngrok domain (e.g. `my-app.ngrok-free.app`). |
+| `NGROK_AUTHTOKEN` | Override the authtoken (otherwise the one stored by `ngrok config` is used). |
+| `CORS_ORIGINS` | Override CORS allow-list. The script defaults include `https://*.ngrok-free.app`, `https://*.ngrok.app`, `https://*.ngrok.io`. |
+
+---
+
+## Quick Start with WSL2 (Helper Script)
+
+If you're on Windows and using WSL2 Ubuntu/Debian, you can skip the manual
+steps above and use the bundled setup helper:
+
+```bash
+# from inside WSL, in the cloned repo
+bash scripts/setup-wsl.sh # full setup
+bash scripts/setup-wsl.sh --check # dry-run / diagnostics only
+```
+
+The script will:
+
+- Detect WSL and warn if the repo lives under `/mnt/c` (slow file I/O for hot-reload).
+- Verify Ubuntu/Debian and install missing apt packages
+ (`python3`, `python3-venv`, `python3-pip`, `nodejs`, `npm`, `git`, `curl`).
+- Create `backend/venv` and install Python requirements.
+- Run `npm install` in `frontend/`.
+- Copy `backend/.env.example` to `backend/.env` if missing.
+- Print WSL-specific tips (localhost forwarding, polling reloader, ngrok).
+
+Once it finishes:
+
+```bash
+./dev.sh # start backend + frontend
+./dev.sh tunnel # also expose backend via ngrok (see section above)
+```
diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsx
index 673d9595..bbb875e0 100644
--- a/frontend/src/pages/ServerDetail.jsx
+++ b/frontend/src/pages/ServerDetail.jsx
@@ -152,13 +152,6 @@ const ServerDetail = () => {
);
}
- const statusColors = {
- online: '#10B981',
- offline: '#EF4444',
- connecting: '#F59E0B',
- pending: '#6B7280'
- };
-
const tabs = [
{ id: 'overview', label: 'Overview' },
{ id: 'docker', label: 'Docker' },
@@ -168,35 +161,55 @@ const ServerDetail = () => {
return (
<div className="server-detail-page">
- <div className="page-header">
- <div className="page-breadcrumb">
- <Link to="/servers">Servers</Link>
- <span className="breadcrumb-separator">/</span>
- <span>{server.name}</span>
- </div>
- <div className="page-header-content">
- <div className="server-title">
- <div
- className="status-dot large"
- style={{ backgroundColor: statusColors[server.status] }}
- title={server.status}
- />
- <h1>{server.name}</h1>
+ <div className="page-breadcrumb">
+ <Link to="/servers">Servers</Link>
+ <span className="breadcrumb-separator">/</span>
+ <span>{server.name}</span>
+ </div>
+
+ <header className="server-detail-header">
+ <div className="server-detail-header__main">
+ <div className={`server-detail-header__avatar server-detail-header__avatar--${server.status || 'pending'}`}>
+ {(server.name || '?').charAt(0).toUpperCase()}
+ </div>
+ <div className="server-detail-header__identity">
+ <div className="server-detail-header__title-row">
+ <h1>{server.name}</h1>
+ <span className={`status-pill status-pill--${server.status || 'pending'}`}>
+ <span className="status-pill__dot" />
+ {server.status || 'pending'}
+ </span>
+ </div>
+ <div className="server-detail-header__meta">
+ <span className="mono">{server.hostname || server.ip_address || 'No endpoint configured'}</span>
+ {server.group_name && (
+ <span className="server-detail-header__chip"><FolderTinyIcon /> {server.group_name}</span>
+ )}
+ {server.os_type && <span className="server-detail-header__chip">{server.os_type}</span>}
+ {server.agent_version && <span className="server-detail-header__chip">agent {server.agent_version}</span>}
+ {server.last_seen && (
+ <span className="server-detail-header__chip">
+ last seen {new Date(server.last_seen).toLocaleString()}
+ </span>
+ )}
+ </div>
+ {server.description && (
+ <p className="server-detail-header__description">{server.description}</p>
+ )}
</div>
- <p className="page-description">
- {server.hostname || server.ip_address}
- {server.description && ` - ${server.description}`}
- </p>
</div>
- <div className="page-header-actions">
+ <div className="server-detail-header__actions">
<button className="btn btn-secondary" onClick={handlePingServer}>
<RefreshIcon /> Ping
</button>
+ <Link className="btn btn-secondary" to={`/servers/${id}/docker`}>
+ Docker
+ </Link>
<button className="btn btn-primary" onClick={handleGenerateToken}>
<KeyIcon /> Generate Token
</button>
</div>
- </div>
+ </header>
<div className="server-detail-tabs">
{tabs.map(t => (
@@ -1181,6 +1194,12 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
};
// Icons
+const FolderTinyIcon = () => (
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
+ </svg>
+);
+
const RefreshIcon = () => (
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<polyline points="23 4 23 10 17 10"/>
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 2602a559..5ff585fb 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -1,7 +1,8 @@
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect, useCallback, useRef } from 'react';
import { Link } from 'react-router-dom';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { ConfirmDialog } from '../components/ConfirmDialog';
const Servers = () => {
const [servers, setServers] = useState([]);
@@ -10,14 +11,14 @@ const Servers = () => {
const [showAddModal, setShowAddModal] = useState(false);
const [showGroupModal, setShowGroupModal] = useState(false);
const [selectedGroup, setSelectedGroup] = useState('all');
+ const [selectedStatus, setSelectedStatus] = useState('all');
const [searchTerm, setSearchTerm] = useState('');
+ const [selectedIds, setSelectedIds] = useState(() => new Set());
+ const [deleteTarget, setDeleteTarget] = useState(null);
+ const [bulkDeleteOpen, setBulkDeleteOpen] = useState(false);
const toast = useToast();
- useEffect(() => {
- loadData();
- }, []);
-
- async function loadData() {
+ const loadData = useCallback(async () => {
setLoading(true);
try {
const [serversData, groupsData] = await Promise.all([
@@ -32,7 +33,11 @@ const Servers = () => {
} finally {
setLoading(false);
}
- }
+ }, [toast]);
+
+ useEffect(() => {
+ loadData();
+ }, [loadData]);
async function handlePingServer(serverId) {
try {
@@ -43,134 +48,309 @@ const Servers = () => {
toast.error('Server did not respond');
}
loadData();
- } catch (err) {
+ } catch {
toast.error('Failed to ping server');
}
}
+ async function handleDeleteServer() {
+ if (!deleteTarget) return;
+ try {
+ await api.deleteServer(deleteTarget.id);
+ toast.success(`${deleteTarget.name} removed from fleet`);
+ setSelectedIds(prev => {
+ const next = new Set(prev);
+ next.delete(deleteTarget.id);
+ return next;
+ });
+ setDeleteTarget(null);
+ loadData();
+ } catch (err) {
+ toast.error(err.message || 'Failed to delete server');
+ }
+ }
+
+ async function handleBulkDelete() {
+ const ids = Array.from(selectedIds);
+ if (ids.length === 0) return;
+ const results = await Promise.allSettled(ids.map(id => api.deleteServer(id)));
+ const failed = results.filter(r => r.status === 'rejected').length;
+ if (failed === 0) {
+ toast.success(`${ids.length} server${ids.length === 1 ? '' : 's'} deleted`);
+ } else {
+ toast.error(`${failed} of ${ids.length} could not be deleted`);
+ }
+ setSelectedIds(new Set());
+ setBulkDeleteOpen(false);
+ loadData();
+ }
+
+ async function handleCopyInstall(server) {
+ try {
+ const result = await api.generateRegistrationToken(server.id);
+ const token = result?.registration_token || result?.token;
+ if (!token) {
+ toast.error('Could not generate install command');
+ return;
+ }
+ const script = `curl -fsSL ${window.location.origin}/api/v1/servers/install.sh | sudo bash -s -- \\\n --server "${window.location.origin}" \\\n --token "${token}"`;
+ await navigator.clipboard.writeText(script);
+ toast.success('Install command copied to clipboard');
+ } catch (err) {
+ toast.error(err.message || 'Failed to generate install command');
+ }
+ }
+
+ function toggleSelect(id) {
+ setSelectedIds(prev => {
+ const next = new Set(prev);
+ if (next.has(id)) next.delete(id); else next.add(id);
+ return next;
+ });
+ }
+
+ function toggleSelectAll(visibleIds) {
+ setSelectedIds(prev => {
+ const allSelected = visibleIds.length > 0 && visibleIds.every(id => prev.has(id));
+ if (allSelected) {
+ const next = new Set(prev);
+ visibleIds.forEach(id => next.delete(id));
+ return next;
+ }
+ const next = new Set(prev);
+ visibleIds.forEach(id => next.add(id));
+ return next;
+ });
+ }
+
const filteredServers = servers.filter(server => {
- const matchesGroup = selectedGroup === 'all' || server.group_id === selectedGroup;
+ const matchesGroup = selectedGroup === 'all' ||
+ (selectedGroup === 'ungrouped' && !server.group_id) ||
+ String(server.group_id) === String(selectedGroup);
+ const matchesStatus = selectedStatus === 'all' || server.status === selectedStatus;
const matchesSearch = !searchTerm ||
server.name?.toLowerCase().includes(searchTerm.toLowerCase()) ||
server.hostname?.toLowerCase().includes(searchTerm.toLowerCase()) ||
server.ip_address?.toLowerCase().includes(searchTerm.toLowerCase());
- return matchesGroup && matchesSearch;
+ return matchesGroup && matchesStatus && matchesSearch;
});
- const stats = {
+ const fleetStats = {
total: servers.length,
online: servers.filter(s => s.status === 'online').length,
offline: servers.filter(s => s.status === 'offline').length,
- connecting: servers.filter(s => s.status === 'connecting').length
+ connecting: servers.filter(s => s.status === 'connecting').length,
+ pending: servers.filter(s => s.status === 'pending').length
};
+ const availability = fleetStats.total > 0 ? Math.round((fleetStats.online / fleetStats.total) * 100) : 0;
+ const hasActiveFilters = selectedGroup !== 'all' || selectedStatus !== 'all' || Boolean(searchTerm);
+ const statCards = [
+ {
+ key: 'all',
+ label: 'Total',
+ value: fleetStats.total,
+ detail: `${groups.length} group${groups.length === 1 ? '' : 's'}`,
+ icon: <ServerIcon />,
+ },
+ {
+ key: 'online',
+ label: 'Online',
+ value: fleetStats.online,
+ detail: `${availability}% available`,
+ icon: <CheckCircleIcon />,
+ },
+ {
+ key: 'offline',
+ label: 'Offline',
+ value: fleetStats.offline,
+ detail: 'Needs attention',
+ icon: <XCircleIcon />,
+ },
+ {
+ key: 'connecting',
+ label: 'Connecting',
+ value: fleetStats.connecting,
+ detail: `${fleetStats.pending} pending`,
+ icon: <RefreshIcon />,
+ }
+ ];
if (loading) {
- return <div className="loading">Loading servers...</div>;
+ return (
+ <div className="servers-page servers-page--loading">
+ <div className="servers-loading-card">
+ <ServerIcon />
+ <span>Scanning fleet...</span>
+ </div>
+ </div>
+ );
}
+ const visibleIds = filteredServers.map(s => s.id);
+ const allVisibleSelected = visibleIds.length > 0 && visibleIds.every(id => selectedIds.has(id));
+ const someVisibleSelected = visibleIds.some(id => selectedIds.has(id));
+
return (
<div className="servers-page">
- <div className="page-header">
- <div className="page-header-content">
+ <header className="servers-header">
+ <div className="servers-header__title">
<h1>Servers</h1>
- <p className="page-description">Manage your connected servers and agents</p>
+ <p>{servers.length} {servers.length === 1 ? 'machine' : 'machines'} · {fleetStats.online} online · {availability}% availability</p>
</div>
- <div className="page-header-actions">
+ <div className="servers-header__actions">
<button className="btn btn-secondary" onClick={() => setShowGroupModal(true)}>
- <FolderIcon />
- Manage Groups
+ <FolderIcon /> Groups
</button>
<button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
- <PlusIcon />
- Add Server
+ <PlusIcon /> Add Server
</button>
</div>
- </div>
+ </header>
<div className="servers-stats">
- <div className="stat-card">
- <div className="stat-icon total">
- <ServerIcon />
- </div>
- <div className="stat-content">
- <div className="stat-value">{stats.total}</div>
- <div className="stat-label">Total Servers</div>
- </div>
- </div>
- <div className="stat-card">
- <div className="stat-icon online">
- <CheckCircleIcon />
- </div>
- <div className="stat-content">
- <div className="stat-value">{stats.online}</div>
- <div className="stat-label">Online</div>
- </div>
- </div>
- <div className="stat-card">
- <div className="stat-icon offline">
- <XCircleIcon />
- </div>
- <div className="stat-content">
- <div className="stat-value">{stats.offline}</div>
- <div className="stat-label">Offline</div>
+ {statCards.map(stat => (
+ <button
+ key={stat.key}
+ type="button"
+ className={`stat-card stat-card--${stat.key} ${selectedStatus === stat.key ? 'active' : ''}`}
+ onClick={() => setSelectedStatus(stat.key)}
+ aria-pressed={selectedStatus === stat.key}
+ >
+ <span className={`stat-icon ${stat.key}`}>{stat.icon}</span>
+ <span className="stat-content">
+ <span className="stat-label">{stat.label}</span>
+ <span className="stat-value">{stat.value}</span>
+ <span className="stat-detail">{stat.detail}</span>
+ </span>
+ </button>
+ ))}
+ </div>
+
+ <div className="servers-command-bar">
+ <div className="servers-toolbar">
+ <label className="search-box">
+ <SearchIcon />
+ <input
+ type="text"
+ placeholder="Search by name, host, or IP..."
+ value={searchTerm}
+ onChange={(e) => setSearchTerm(e.target.value)}
+ />
+ </label>
+ <div className="group-filter">
+ <span>Group</span>
+ <select value={selectedGroup} onChange={(e) => setSelectedGroup(e.target.value)}>
+ <option value="all">All Groups</option>
+ {groups.map(group => (
+ <option key={group.id} value={group.id}>{group.name}</option>
+ ))}
+ <option value="ungrouped">Ungrouped</option>
+ </select>
</div>
</div>
- <div className="stat-card">
- <div className="stat-icon connecting">
- <RefreshIcon />
- </div>
- <div className="stat-content">
- <div className="stat-value">{stats.connecting}</div>
- <div className="stat-label">Connecting</div>
- </div>
+
+ <div className="servers-results-summary">
+ <strong>{filteredServers.length}</strong>
+ <span>{filteredServers.length === 1 ? 'server' : 'servers'}</span>
+ {hasActiveFilters && (
+ <button
+ type="button"
+ className="servers-clear-filters"
+ onClick={() => {
+ setSelectedGroup('all');
+ setSelectedStatus('all');
+ setSearchTerm('');
+ }}
+ >
+ Clear filters
+ </button>
+ )}
</div>
</div>
- <div className="servers-toolbar">
- <div className="search-box">
- <SearchIcon />
- <input
- type="text"
- placeholder="Search servers..."
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- />
- </div>
- <div className="group-filter">
- <select value={selectedGroup} onChange={(e) => setSelectedGroup(e.target.value)}>
- <option value="all">All Groups</option>
- {groups.map(group => (
- <option key={group.id} value={group.id}>{group.name}</option>
- ))}
- <option value="ungrouped">Ungrouped</option>
- </select>
+ {selectedIds.size > 0 && (
+ <div className="servers-bulk-bar" role="region" aria-label="Bulk actions">
+ <div className="servers-bulk-bar__info">
+ <span className="servers-bulk-bar__count">{selectedIds.size}</span>
+ <span>selected</span>
+ </div>
+ <div className="servers-bulk-bar__actions">
+ <button type="button" className="btn btn-sm btn-ghost" onClick={() => setSelectedIds(new Set())}>
+ Clear selection
+ </button>
+ <button type="button" className="btn btn-sm btn-danger" onClick={() => setBulkDeleteOpen(true)}>
+ <TrashIcon /> Delete {selectedIds.size}
+ </button>
+ </div>
</div>
- </div>
+ )}
{filteredServers.length === 0 ? (
- <div className="empty-state">
- <ServerIcon className="empty-icon" />
- <h3>No servers found</h3>
+ <div className="empty-state servers-empty-state">
+ <div className="servers-empty-state__icon">
+ <ServerIcon className="empty-icon" />
+ </div>
+ <h3>{servers.length === 0 ? 'No servers yet' : 'No servers match these filters'}</h3>
<p>
{servers.length === 0
- ? 'Add your first server to connect an agent for monitoring and supported remote Docker actions.'
- : 'No servers match your current filters.'}
+ ? 'Install a ServerKit agent on a machine to start monitoring health and managing Docker remotely.'
+ : 'Try a different status, group, or search term to bring machines back into view.'}
</p>
- {servers.length === 0 && (
+ {servers.length === 0 ? (
<button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
- <PlusIcon /> Add Server
+ <PlusIcon /> Add your first server
+ </button>
+ ) : (
+ <button
+ type="button"
+ className="btn btn-secondary"
+ onClick={() => {
+ setSelectedGroup('all');
+ setSelectedStatus('all');
+ setSearchTerm('');
+ }}
+ >
+ Clear filters
</button>
)}
</div>
) : (
- <div className="servers-grid">
- {filteredServers.map(server => (
- <ServerCard
- key={server.id}
- server={server}
- onPing={() => handlePingServer(server.id)}
- />
- ))}
+ <div className="servers-table-wrap">
+ <table className="servers-table">
+ <thead>
+ <tr>
+ <th className="col-check">
+ <input
+ type="checkbox"
+ aria-label="Select all visible servers"
+ checked={allVisibleSelected}
+ ref={el => { if (el) el.indeterminate = someVisibleSelected && !allVisibleSelected; }}
+ onChange={() => toggleSelectAll(visibleIds)}
+ />
+ </th>
+ <th>Server</th>
+ <th>Status</th>
+ <th>Group</th>
+ <th>OS · Agent</th>
+ <th>Telemetry</th>
+ <th>Last seen</th>
+ <th className="col-actions" aria-label="Actions" />
+ </tr>
+ </thead>
+ <tbody>
+ {filteredServers.map(server => (
+ <ServerRow
+ key={server.id}
+ server={server}
+ selected={selectedIds.has(server.id)}
+ onToggle={() => toggleSelect(server.id)}
+ onPing={() => handlePingServer(server.id)}
+ onDelete={() => setDeleteTarget(server)}
+ onCopyInstall={() => handleCopyInstall(server)}
+ />
+ ))}
+ </tbody>
+ </table>
</div>
)}
@@ -192,115 +372,211 @@ const Servers = () => {
onUpdated={loadData}
/>
)}
+
+ <ConfirmDialog
+ isOpen={Boolean(deleteTarget)}
+ title={`Delete ${deleteTarget?.name || 'server'}?`}
+ message="This removes the server from your fleet and revokes its agent token. The agent on the host will stop reporting."
+ requireConfirmation={deleteTarget?.name}
+ confirmText="Delete server"
+ variant="danger"
+ onConfirm={handleDeleteServer}
+ onCancel={() => setDeleteTarget(null)}
+ />
+
+ <ConfirmDialog
+ isOpen={bulkDeleteOpen}
+ title={`Delete ${selectedIds.size} server${selectedIds.size === 1 ? '' : 's'}?`}
+ message="All selected servers will be removed from the fleet and their agent tokens revoked. This cannot be undone."
+ requireConfirmation="DELETE"
+ confirmText={`Delete ${selectedIds.size} server${selectedIds.size === 1 ? '' : 's'}`}
+ variant="danger"
+ onConfirm={handleBulkDelete}
+ onCancel={() => setBulkDeleteOpen(false)}
+ />
</div>
);
};
-const ServerCard = ({ server, onPing }) => {
- const statusColors = {
- online: '#10B981',
- offline: '#EF4444',
- connecting: '#F59E0B',
- pending: '#6B7280'
- };
+const formatLastSeen = (timestamp) => {
+ if (!timestamp) return 'Never';
+ const date = new Date(timestamp);
+ const now = new Date();
+ const diff = (now - date) / 1000;
+ if (diff < 60) return 'Just now';
+ if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
+ if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
+ return date.toLocaleDateString();
+};
- const formatLastSeen = (timestamp) => {
- if (!timestamp) return 'Never';
- const date = new Date(timestamp);
- const now = new Date();
- const diff = (now - date) / 1000;
+const clamp = (v) => Math.min(100, Math.max(0, Number(v) || 0));
+
+const ServerRow = ({ server, selected, onToggle, onPing, onDelete, onCopyInstall }) => {
+ const [menuPos, setMenuPos] = useState(null);
+ const triggerRef = useRef(null);
+ const menuRef = useRef(null);
+
+ const closeMenu = useCallback(() => setMenuPos(null), []);
+
+ const openMenu = () => {
+ const r = triggerRef.current?.getBoundingClientRect();
+ if (!r) return;
+ const menuHeight = 240;
+ const menuWidth = 220;
+ const flipUp = r.bottom + menuHeight + 8 > window.innerHeight;
+ setMenuPos({
+ top: flipUp ? r.top - menuHeight - 4 : r.bottom + 4,
+ left: Math.max(8, r.right - menuWidth),
+ });
+ };
- if (diff < 60) return 'Just now';
- if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
- if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
- return date.toLocaleDateString();
+ useEffect(() => {
+ if (!menuPos) return undefined;
+ const onDocDown = (e) => {
+ if (
+ menuRef.current && !menuRef.current.contains(e.target) &&
+ triggerRef.current && !triggerRef.current.contains(e.target)
+ ) {
+ closeMenu();
+ }
+ };
+ const onScroll = () => closeMenu();
+ document.addEventListener('mousedown', onDocDown);
+ window.addEventListener('scroll', onScroll, true);
+ window.addEventListener('resize', onScroll);
+ return () => {
+ document.removeEventListener('mousedown', onDocDown);
+ window.removeEventListener('scroll', onScroll, true);
+ window.removeEventListener('resize', onScroll);
+ };
+ }, [menuPos, closeMenu]);
+
+ const status = server.status || 'pending';
+ const displayHost = server.hostname || server.ip_address || 'Unassigned endpoint';
+ const initial = (server.name || displayHost || '?').charAt(0).toUpperCase();
+ const metrics = {
+ cpu: clamp(server.metrics?.cpu_percent),
+ memory: clamp(server.metrics?.memory_percent),
+ disk: clamp(server.metrics?.disk_percent),
};
+ const hasMetrics = server.metrics && status === 'online';
return (
- <div className={`server-card ${server.status}`}>
- <div className="server-card-header">
- <div className="server-status-indicator" style={{ backgroundColor: statusColors[server.status] || '#6B7280' }} />
- <div className="server-info">
- <h3 className="server-name">{server.name}</h3>
- <span className="server-hostname">{server.hostname || server.ip_address}</span>
- </div>
- </div>
-
- <div className="server-card-body">
- <div className="server-meta">
- <div className="meta-item">
- <span className="meta-label">OS</span>
- <span className="meta-value">{server.os_type || 'Unknown'}</span>
- </div>
- <div className="meta-item">
- <span className="meta-label">Agent</span>
- <span className="meta-value">{server.agent_version || 'Not installed'}</span>
- </div>
- <div className="meta-item">
- <span className="meta-label">Docker</span>
- <span className="meta-value">{server.docker_version || 'N/A'}</span>
- </div>
- <div className="meta-item">
- <span className="meta-label">Last Seen</span>
- <span className="meta-value">{formatLastSeen(server.last_seen)}</span>
- </div>
- </div>
-
- {server.metrics && server.status === 'online' && (
- <div className="server-metrics-mini">
- <div className="metric-bar">
- <span className="metric-label">CPU</span>
- <div className="bar-track">
- <div
- className="bar-fill cpu"
- style={{ width: `${server.metrics.cpu_percent || 0}%` }}
- />
- </div>
- <span className="metric-value">{(server.metrics.cpu_percent || 0).toFixed(0)}%</span>
- </div>
- <div className="metric-bar">
- <span className="metric-label">RAM</span>
- <div className="bar-track">
- <div
- className="bar-fill memory"
- style={{ width: `${server.metrics.memory_percent || 0}%` }}
- />
- </div>
- <span className="metric-value">{(server.metrics.memory_percent || 0).toFixed(0)}%</span>
- </div>
- <div className="metric-bar">
- <span className="metric-label">Disk</span>
- <div className="bar-track">
- <div
- className="bar-fill disk"
- style={{ width: `${server.metrics.disk_percent || 0}%` }}
- />
- </div>
- <span className="metric-value">{(server.metrics.disk_percent || 0).toFixed(0)}%</span>
- </div>
- </div>
- )}
-
- {server.group_name && (
- <div className="server-group-badge">
+ <tr className={`server-row server-row--${status} ${selected ? 'is-selected' : ''}`}>
+ <td className="col-check">
+ <input
+ type="checkbox"
+ checked={selected}
+ onChange={onToggle}
+ aria-label={`Select ${server.name}`}
+ />
+ </td>
+ <td>
+ <Link to={`/servers/${server.id}`} className="server-row__name">
+ <span className={`server-row__avatar server-row__avatar--${status}`} aria-hidden="true">{initial}</span>
+ <span className="server-row__identity">
+ <span className="server-row__title">{server.name}</span>
+ <span className="server-row__sub">{displayHost}</span>
+ </span>
+ </Link>
+ </td>
+ <td>
+ <span className={`status-pill status-pill--${status}`}>
+ <span className="status-pill__dot" />
+ {status}
+ </span>
+ </td>
+ <td>
+ {server.group_name ? (
+ <span className="server-row__group">
<FolderIcon size={12} />
{server.group_name}
+ </span>
+ ) : (
+ <span className="muted">—</span>
+ )}
+ </td>
+ <td>
+ <div className="server-row__stack">
+ <span>{server.os_type || 'Unknown'}</span>
+ <span className="muted">{server.agent_version ? `agent ${server.agent_version}` : 'agent not installed'}</span>
+ </div>
+ </td>
+ <td>
+ {hasMetrics ? (
+ <div className="server-row__telemetry">
+ <span title={`CPU ${metrics.cpu.toFixed(0)}%`}>
+ <em>CPU</em>
+ <span className="bar"><span className="bar-fill cpu" style={{ width: `${metrics.cpu}%` }} /></span>
+ <b>{metrics.cpu.toFixed(0)}%</b>
+ </span>
+ <span title={`RAM ${metrics.memory.toFixed(0)}%`}>
+ <em>RAM</em>
+ <span className="bar"><span className="bar-fill memory" style={{ width: `${metrics.memory}%` }} /></span>
+ <b>{metrics.memory.toFixed(0)}%</b>
+ </span>
+ <span title={`Disk ${metrics.disk.toFixed(0)}%`}>
+ <em>DSK</em>
+ <span className="bar"><span className="bar-fill disk" style={{ width: `${metrics.disk}%` }} /></span>
+ <b>{metrics.disk.toFixed(0)}%</b>
+ </span>
</div>
+ ) : (
+ <span className="muted">{status === 'pending' ? 'Awaiting agent' : status === 'offline' ? 'Offline' : 'No data'}</span>
)}
- </div>
-
- <div className="server-card-footer">
- <Link to={`/servers/${server.id}`} className="btn btn-sm btn-secondary">
- <EyeIcon /> Details
- </Link>
- <button className="btn btn-sm btn-secondary" onClick={onPing} title="Ping Server">
- <RefreshIcon />
- </button>
- <Link to={`/servers/${server.id}/docker`} className="btn btn-sm btn-primary">
- <DockerIcon /> Docker
- </Link>
- </div>
- </div>
+ </td>
+ <td>
+ <span className="server-row__lastseen">{formatLastSeen(server.last_seen)}</span>
+ </td>
+ <td className="col-actions">
+ <div className="row-actions">
+ <button type="button" className="row-actions__icon" onClick={onPing} title="Ping server" aria-label={`Ping ${server.name}`}>
+ <RefreshIcon />
+ </button>
+ <Link to={`/servers/${server.id}/docker`} className="row-actions__icon" title="Open Docker" aria-label={`Open Docker for ${server.name}`}>
+ <DockerIcon />
+ </Link>
+ <button
+ ref={triggerRef}
+ type="button"
+ className="row-actions__icon"
+ onClick={() => (menuPos ? closeMenu() : openMenu())}
+ aria-haspopup="menu"
+ aria-expanded={Boolean(menuPos)}
+ title="More actions"
+ >
+ <MoreIcon />
+ </button>
+ {menuPos && (
+ <div
+ ref={menuRef}
+ className="row-menu"
+ role="menu"
+ style={{ position: 'fixed', top: menuPos.top, left: menuPos.left }}
+ >
+ <Link to={`/servers/${server.id}`} className="row-menu__item" role="menuitem" onClick={closeMenu}>
+ <EyeIcon /> View details
+ </Link>
+ <button type="button" className="row-menu__item" role="menuitem" onClick={() => { closeMenu(); onPing(); }}>
+ <RefreshIcon /> Ping now
+ </button>
+ {status === 'pending' && (
+ <button type="button" className="row-menu__item" role="menuitem" onClick={() => { closeMenu(); onCopyInstall(); }}>
+ <CopyIcon /> Copy install command
+ </button>
+ )}
+ <Link to={`/servers/${server.id}/docker`} className="row-menu__item" role="menuitem" onClick={closeMenu}>
+ <DockerIcon /> Manage Docker
+ </Link>
+ <div className="row-menu__divider" />
+ <button type="button" className="row-menu__item row-menu__item--danger" role="menuitem" onClick={() => { closeMenu(); onDelete(); }}>
+ <TrashIcon /> Delete server
+ </button>
+ </div>
+ )}
+ </div>
+ </td>
+ </tr>
);
};
@@ -315,6 +591,7 @@ const AddServerModal = ({ groups, onClose, onCreated }) => {
permission_profile: 'deployment_runner',
permissions: []
});
+ const [showOptional, setShowOptional] = useState(false);
const [registrationData, setRegistrationData] = useState(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
@@ -355,80 +632,103 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
return (
<div className="modal-overlay" onClick={onClose}>
- <div className="modal modal-lg" onClick={e => e.stopPropagation()}>
+ <div className="modal server-setup-modal" onClick={e => e.stopPropagation()}>
<div className="modal-header">
- <h2>{step === 1 ? 'Add Server' : 'Install Agent'}</h2>
+ <div>
+ <span className="servers-eyebrow">{step === 1 ? 'New agent' : 'Registration ready'}</span>
+ <h2>{step === 1 ? 'Add Server' : 'Install Agent'}</h2>
+ <p>{step === 1 ? 'Give it a name, then run the install command on the target machine.' : 'Run one command on the target machine to bring it online.'}</p>
+ </div>
<button className="modal-close" onClick={onClose}>&times;</button>
</div>
{step === 1 ? (
- <form onSubmit={handleCreateServer}>
- {error && <div className="error-message">{error}</div>}
-
- <div className="form-group">
- <label>Server Name *</label>
- <input
- type="text"
- name="name"
- value={formData.name}
- onChange={handleChange}
- placeholder="My Production Server"
- required
- />
- </div>
+ <form className="server-setup-form" onSubmit={handleCreateServer}>
+ <div className="server-setup-form__body">
+ {error && <div className="error-message">{error}</div>}
- <div className="form-group">
- <label>Description</label>
- <textarea
- name="description"
- value={formData.description}
- onChange={handleChange}
- placeholder="Optional description..."
- rows={2}
- />
- </div>
-
- <div className="form-row">
<div className="form-group">
- <label>Hostname</label>
+ <label>Server Name *</label>
<input
type="text"
- name="hostname"
- value={formData.hostname}
+ name="name"
+ value={formData.name}
onChange={handleChange}
- placeholder="server.example.com"
+ placeholder="prod-web-01"
+ autoFocus
+ required
/>
+ <span className="form-hint">A friendly label. The agent itself reports the real hostname when it connects.</span>
</div>
- <div className="form-group">
- <label>IP Address</label>
- <input
- type="text"
- name="ip_address"
- value={formData.ip_address}
- onChange={handleChange}
- placeholder="192.168.1.100"
- />
+
+ <div className="form-row">
+ <div className="form-group">
+ <label>Group</label>
+ <select name="group_id" value={formData.group_id} onChange={handleChange}>
+ <option value="">No Group</option>
+ {groups.map(group => (
+ <option key={group.id} value={group.id}>{group.name}</option>
+ ))}
+ </select>
+ </div>
+ <div className="form-group">
+ <label>Access Profile</label>
+ <select name="permission_profile" value={formData.permission_profile} onChange={handleChange}>
+ <option value="deployment_runner">Deployment Runner</option>
+ <option value="docker_manager">Docker Manager</option>
+ <option value="docker_readonly">Docker Read-Only</option>
+ <option value="full_access">Full Access</option>
+ </select>
+ </div>
</div>
- </div>
- <div className="form-group">
- <label>Group</label>
- <select name="group_id" value={formData.group_id} onChange={handleChange}>
- <option value="">No Group</option>
- {groups.map(group => (
- <option key={group.id} value={group.id}>{group.name}</option>
- ))}
- </select>
- </div>
+ <button
+ type="button"
+ className="form-disclosure"
+ onClick={() => setShowOptional(v => !v)}
+ aria-expanded={showOptional}
+ >
+ <span className={`form-disclosure__chevron${showOptional ? ' is-open' : ''}`}>›</span>
+ Optional details
+ <span className="form-disclosure__hint">description, hostname, IP</span>
+ </button>
- <div className="form-group">
- <label>Access Profile</label>
- <select name="permission_profile" value={formData.permission_profile} onChange={handleChange}>
- <option value="deployment_runner">Deployment Runner</option>
- <option value="docker_manager">Docker Manager</option>
- <option value="docker_readonly">Docker Read-Only</option>
- <option value="full_access">Full Access</option>
- </select>
+ {showOptional && (
+ <div className="form-disclosure__panel">
+ <div className="form-group">
+ <label>Description</label>
+ <textarea
+ name="description"
+ value={formData.description}
+ onChange={handleChange}
+ placeholder="What this server is used for…"
+ rows={2}
+ />
+ </div>
+ <div className="form-row">
+ <div className="form-group">
+ <label>Hostname</label>
+ <input
+ type="text"
+ name="hostname"
+ value={formData.hostname}
+ onChange={handleChange}
+ placeholder="server.example.com"
+ />
+ </div>
+ <div className="form-group">
+ <label>IP Address</label>
+ <input
+ type="text"
+ name="ip_address"
+ value={formData.ip_address}
+ onChange={handleChange}
+ placeholder="192.168.1.100"
+ />
+ </div>
+ </div>
+ </div>
+ )}
</div>
<div className="modal-actions">
@@ -436,47 +736,49 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
Cancel
</button>
<button type="submit" className="btn btn-primary" disabled={loading}>
- {loading ? 'Creating...' : 'Create & Get Install Script'}
+ {loading ? 'Creating…' : 'Create & Get Install Script'}
</button>
</div>
</form>
) : (
<div className="install-instructions">
- <div className="success-banner">
- <CheckCircleIcon />
- <div>
- <strong>Agent token created</strong>
- <p className="success-subtitle">Run the install script on your target machine to connect the agent.</p>
+ <div className="install-instructions__scroll">
+ <div className="success-banner">
+ <CheckCircleIcon />
+ <div>
+ <strong>Agent token created</strong>
+ <p className="success-subtitle">Run the install script on your target machine to connect the agent.</p>
+ </div>
</div>
- </div>
- <div className="install-tabs">
- <InstallTab
- title="Linux"
- description="Linux server with curl, tar, sudo, and systemd"
- icon={<TerminalIcon />}
- script={linuxInstallScript}
- onCopy={() => copyToClipboard(linuxInstallScript)}
- />
- <InstallTab
- title="Windows (PowerShell)"
- description="Run as Administrator"
- icon={<WindowsIcon />}
- script={windowsInstallScript}
- onCopy={() => copyToClipboard(windowsInstallScript)}
- />
- </div>
+ <div className="install-tabs">
+ <InstallTab
+ title="Linux"
+ description="Linux server with curl, tar, sudo, and systemd"
+ icon={<TerminalIcon />}
+ script={linuxInstallScript}
+ onCopy={() => copyToClipboard(linuxInstallScript)}
+ />
+ <InstallTab
+ title="Windows (PowerShell)"
+ description="Run as Administrator"
+ icon={<WindowsIcon />}
+ script={windowsInstallScript}
+ onCopy={() => copyToClipboard(windowsInstallScript)}
+ />
+ </div>
- <div className="install-info">
- <h4>What happens next?</h4>
- <ol>
- <li>Copy and run the install script on your server</li>
- <li>The agent downloads, installs, and registers automatically</li>
- <li>Your server will appear as <strong>Pending</strong> until the agent connects, then switch to <strong>Online</strong></li>
- </ol>
- <p className="text-muted">
- The registration token expires in 24 hours. You can regenerate it from the server details page.
- </p>
+ <div className="install-info">
+ <h4>What happens next?</h4>
+ <ol>
+ <li>Copy and run the install script on your server</li>
+ <li>The agent downloads, installs, and registers automatically</li>
+ <li>Your server will appear as <strong>Pending</strong> until the agent connects, then switch to <strong>Online</strong></li>
+ </ol>
+ <p className="text-muted">
+ The registration token expires in 24 hours. You can regenerate it from the server details page.
+ </p>
+ </div>
</div>
<div className="modal-actions">
@@ -741,4 +1043,12 @@ const TrashIcon = () => (
</svg>
);
+const MoreIcon = () => (
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
+ <circle cx="5" cy="12" r="1.6"/>
+ <circle cx="12" cy="12" r="1.6"/>
+ <circle cx="19" cy="12" r="1.6"/>
+ </svg>
+);
+
export default Servers;
diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scss
index e4e16d4e..e9ceca07 100644
--- a/frontend/src/styles/pages/_servers.scss
+++ b/frontend/src/styles/pages/_servers.scss
@@ -2,16 +2,222 @@
// SERVERS PAGE
// ============================================
-// Page Layout
.servers-page {
padding: 0;
}
-// Stats Row
+.servers-page--loading {
+ min-height: 58vh;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.servers-loading-card {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-3;
+ padding: $space-5 $space-6;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-2xl;
+ background:
+ linear-gradient(135deg, $accent-glow, transparent 55%),
+ $bg-card;
+ color: $text-secondary;
+ box-shadow: $shadow-lg;
+
+ svg {
+ color: $accent-primary;
+ animation: servers-pulse 1.5s ease-in-out infinite;
+ }
+}
+
+.servers-hero {
+ position: relative;
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
+ gap: $space-6;
+ align-items: stretch;
+ margin-bottom: $space-6;
+ padding: $space-8;
+ overflow: hidden;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-2xl;
+ background:
+ linear-gradient(135deg, $accent-glow, transparent 38%),
+ linear-gradient(180deg, $bg-card, $bg-elevated);
+ box-shadow: $shadow-lg;
+
+ &::after {
+ content: '';
+ position: absolute;
+ inset: auto -8% -48% 32%;
+ height: 170px;
+ background: linear-gradient(90deg, transparent, $accent-glow, transparent);
+ transform: rotate(-7deg);
+ pointer-events: none;
+ }
+
+ h1 {
+ margin: $space-1 0 $space-2;
+ color: $text-primary;
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 0.95;
+ letter-spacing: -0.07em;
+ }
+
+ .page-description {
+ max-width: 620px;
+ margin: 0;
+ color: $text-secondary;
+ font-size: $font-size-md;
+ line-height: $line-height-relaxed;
+ }
+
+ @media (max-width: $breakpoint-lg) {
+ grid-template-columns: 1fr;
+ }
+
+ @media (max-width: $breakpoint-sm) {
+ padding: $space-5;
+ }
+}
+
+.servers-hero__copy,
+.servers-hero__status {
+ position: relative;
+ z-index: 1;
+}
+
+.servers-hero__copy {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ min-height: 190px;
+}
+
+.servers-eyebrow {
+ display: inline-flex;
+ align-items: center;
+ width: fit-content;
+ gap: $space-2;
+ color: $accent-primary;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-bold;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+
+ &::before {
+ content: '';
+ width: 8px;
+ height: 8px;
+ border-radius: $radius-full;
+ background: currentColor;
+ box-shadow: 0 0 18px currentColor;
+ }
+}
+
+.servers-hero__status {
+ display: flex;
+ flex-direction: column;
+ gap: $space-4;
+ justify-content: space-between;
+}
+
+.servers-hero__actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: $space-2;
+ flex-wrap: wrap;
+
+ @media (max-width: $breakpoint-sm) {
+ justify-content: stretch;
+
+ .btn {
+ flex: 1;
+ justify-content: center;
+ }
+ }
+}
+
+.servers-health-panel {
+ padding: $space-5;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-2xl;
+ background:
+ linear-gradient(180deg, $accent-glow, transparent),
+ $bg-card;
+ backdrop-filter: blur(16px);
+ box-shadow: $shadow-sm;
+}
+
+.servers-health-panel__top,
+.servers-health-panel__meta {
+ display: flex;
+ justify-content: space-between;
+ gap: $space-3;
+}
+
+.servers-health-panel__top {
+ align-items: flex-start;
+ margin-bottom: $space-4;
+
+ span {
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ }
+
+ strong {
+ color: $text-primary;
+ font-family: $font-mono;
+ font-size: $font-size-3xl;
+ line-height: 1;
+ }
+}
+
+.servers-health-panel__meta {
+ margin-top: $space-3;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ text-transform: uppercase;
+ letter-spacing: 0.08em;
+ flex-wrap: wrap;
+}
+
+.servers-health-bar {
+ display: flex;
+ width: 100%;
+ height: 12px;
+ overflow: hidden;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-full;
+ background: $bg-secondary;
+}
+
+.servers-health-bar__segment {
+ min-width: 0;
+ height: 100%;
+ transition: width $transition-slow;
+
+ &--online {
+ background: linear-gradient(90deg, $success, #84cc16);
+ box-shadow: 0 0 22px rgba(16, 185, 129, 0.35);
+ }
+
+ &--connecting {
+ background: linear-gradient(90deg, $warning, #f97316);
+ }
+}
+
+.servers-health-bar__track {
+ flex: 1;
+}
+
.servers-stats {
display: grid;
grid-template-columns: repeat(4, 1fr);
- gap: $space-4;
+ gap: $space-3;
margin-bottom: $space-6;
@media (max-width: $breakpoint-lg) {
@@ -24,19 +230,62 @@
}
.stat-card {
- background: $bg-card;
+ position: relative;
+ isolation: isolate;
+ appearance: none;
+ width: 100%;
+ text-align: left;
+ cursor: pointer;
+ background:
+ linear-gradient(135deg, $accent-glow, transparent 46%),
+ $bg-card;
border: 1px solid $border-subtle;
- border-radius: $radius-md;
- padding: $space-5;
+ border-radius: $radius-xl;
+ padding: $space-4;
display: flex;
align-items: center;
- gap: $space-4;
+ gap: $space-3;
+ color: inherit;
+ transition: transform $transition-base, border-color $transition-base, box-shadow $transition-base, background $transition-base;
+
+ &::after {
+ content: '';
+ position: absolute;
+ inset: auto $space-4 0 $space-4;
+ height: 3px;
+ border-radius: $radius-full $radius-full 0 0;
+ background: transparent;
+ transition: background $transition-base;
+ }
+
+ &:hover,
+ &.active {
+ transform: translateY(-2px);
+ border-color: $border-active;
+ box-shadow: $shadow-md;
+ }
+
+ &.active::after {
+ background: $accent-primary;
+ }
+
+ &--online.active::after {
+ background: $success;
+ }
+
+ &--offline.active::after {
+ background: $danger;
+ }
+
+ &--connecting.active::after {
+ background: $warning;
+ }
}
.stat-icon {
- width: 48px;
- height: 48px;
- border-radius: $radius-md;
+ width: 44px;
+ height: 44px;
+ border-radius: $radius-xl;
display: flex;
align-items: center;
justify-content: center;
@@ -46,7 +295,7 @@
height: 24px;
}
- &.total {
+ &.all {
background: $accent-glow;
color: $accent-primary;
}
@@ -68,24 +317,58 @@
}
.stat-content {
+ display: grid;
+ gap: 2px;
+
.stat-value {
+ grid-column: 2;
+ grid-row: 1 / span 2;
+ justify-self: end;
font-family: $font-mono;
font-size: $font-size-2xl;
font-weight: $font-weight-bold;
color: $text-primary;
+ line-height: 1;
}
.stat-label {
+ grid-column: 1;
+ grid-row: 1;
font-size: $font-size-sm;
+ color: $text-primary;
+ font-weight: $font-weight-semibold;
+ }
+
+ .stat-detail {
+ grid-column: 1 / -1;
+ font-size: $font-size-xs;
color: $text-tertiary;
}
}
-// Toolbar
-.servers-toolbar {
+.servers-command-bar {
display: flex;
- gap: $space-4;
+ justify-content: space-between;
+ align-items: center;
+ gap: $space-3;
margin-bottom: $space-6;
+ padding: $space-3;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-2xl;
+ background: $bg-card;
+ backdrop-filter: blur(12px);
+ box-shadow: $shadow-sm;
+
+ @media (max-width: $breakpoint-lg) {
+ flex-direction: column;
+ align-items: stretch;
+ }
+}
+
+.servers-toolbar {
+ display: flex;
+ gap: $space-3;
+ flex: 1;
@media (max-width: $breakpoint-sm) {
flex-direction: column;
@@ -106,9 +389,10 @@
input {
width: 100%;
- background: $bg-card;
+ height: 44px;
+ background: $bg-body;
border: 1px solid $border-subtle;
- border-radius: $radius-md;
+ border-radius: $radius-xl;
padding: $space-3 $space-3 $space-3 $space-10;
color: $text-primary;
font-size: $font-size-sm;
@@ -125,10 +409,25 @@
}
.group-filter {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ padding-left: $space-3;
+ border-left: 1px solid $border-subtle;
+
+ span {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-bold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ }
+
select {
- background: $bg-card;
+ height: 44px;
+ background: $bg-body;
border: 1px solid $border-subtle;
- border-radius: $radius-md;
+ border-radius: $radius-xl;
padding: $space-3 $space-4;
color: $text-primary;
font-size: $font-size-sm;
@@ -139,28 +438,85 @@
border-color: $accent-primary;
}
}
+
+ @media (max-width: $breakpoint-sm) {
+ padding-left: 0;
+ border-left: 0;
+ }
+}
+
+.servers-results-summary {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: $space-2;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ white-space: nowrap;
+
+ strong {
+ color: $text-primary;
+ font-family: $font-mono;
+ font-size: $font-size-lg;
+ }
+}
+
+.servers-clear-filters {
+ margin-left: $space-2;
+ padding: $space-2 $space-3;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-full;
+ background: transparent;
+ color: $accent-primary;
+ cursor: pointer;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-semibold;
+
+ &:hover {
+ border-color: $accent-primary;
+ background: $accent-glow;
+ }
}
-// Servers Grid
.servers-grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
- gap: $space-5;
+ grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
+ gap: $space-4;
}
-// Server Card
.server-card {
- background: $bg-card;
+ position: relative;
+ display: flex;
+ min-height: 100%;
+ flex-direction: column;
+ background:
+ linear-gradient(180deg, $accent-glow, transparent 34%),
+ $bg-card;
border: 1px solid $border-subtle;
- border-radius: $radius-lg;
+ border-radius: $radius-2xl;
overflow: hidden;
- transition: border-color $transition-base, box-shadow $transition-base;
+ transition: transform $transition-base, border-color $transition-base, box-shadow $transition-base;
+
+ &::before {
+ content: '';
+ position: absolute;
+ inset: 0 0 auto;
+ height: 4px;
+ background: $text-tertiary;
+ opacity: 0.65;
+ }
&:hover {
+ transform: translateY(-3px);
border-color: $border-active;
+ box-shadow: $shadow-lg;
}
&.online {
+ &::before {
+ background: linear-gradient(90deg, $success, #84cc16);
+ }
+
&:hover {
border-color: $success;
box-shadow: 0 0 0 1px $success-border;
@@ -168,7 +524,13 @@
}
&.offline {
- opacity: 0.8;
+ &::before {
+ background: linear-gradient(90deg, $danger, #f97316);
+ }
+ }
+
+ &.connecting::before {
+ background: linear-gradient(90deg, $warning, #f97316);
}
}
@@ -176,15 +538,34 @@
display: flex;
align-items: center;
gap: $space-3;
- padding: $space-4;
+ padding: $space-5 $space-4 $space-4;
border-bottom: 1px solid $border-subtle;
}
+.server-avatar {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 40px;
+ height: 40px;
+ border: 1px solid $border-subtle;
+ border-radius: 14px;
+ background:
+ linear-gradient(135deg, $accent-glow, transparent),
+ $bg-body;
+ color: $text-primary;
+ font-family: $font-mono;
+ font-size: $font-size-base;
+ font-weight: $font-weight-bold;
+}
+
.server-status-indicator {
- width: 10px;
- height: 10px;
+ width: 7px;
+ height: 7px;
border-radius: 50%;
flex-shrink: 0;
+ background: currentColor;
+ box-shadow: 0 0 12px currentColor;
}
.server-info {
@@ -208,15 +589,50 @@
}
}
-.server-card-body {
- padding: $space-4;
-}
-
-.server-meta {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: $space-3;
- margin-bottom: $space-4;
+.server-status-pill {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-2;
+ padding: $space-1 $space-2;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-full;
+ background: $bg-body;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-bold;
+ text-transform: capitalize;
+
+ &.online {
+ color: $success;
+ background: $success-bg;
+ border-color: $success-border;
+ }
+
+ &.offline {
+ color: $danger;
+ background: $danger-bg;
+ border-color: $danger-border;
+ }
+
+ &.connecting {
+ color: $warning;
+ background: $warning-bg;
+ border-color: $warning-border;
+ }
+}
+
+.server-card-body {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ padding: $space-4;
+}
+
+.server-meta {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: $space-3;
+ margin-bottom: $space-4;
}
.meta-item {
@@ -234,15 +650,22 @@
.meta-value {
font-size: $font-size-sm;
color: $text-secondary;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
}
-// Mini metrics bars
.server-metrics-mini {
display: flex;
flex-direction: column;
gap: $space-2;
- margin-bottom: $space-4;
+ margin: auto 0 $space-4;
+ padding: $space-3;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-xl;
+ background: $bg-body;
}
.metric-bar {
@@ -258,7 +681,7 @@
.bar-track {
flex: 1;
- height: 4px;
+ height: 7px;
background: $bg-secondary;
border-radius: $radius-full;
overflow: hidden;
@@ -291,6 +714,26 @@
}
}
+.server-telemetry-placeholder {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: $space-2;
+ margin: auto 0 $space-4;
+ padding: $space-3;
+ border: 1px dashed $border-active;
+ border-radius: $radius-xl;
+ background: $bg-body;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-semibold;
+
+ svg {
+ width: 14px;
+ height: 14px;
+ }
+}
+
.server-group-badge {
display: inline-flex;
align-items: center;
@@ -300,6 +743,7 @@
font-size: $font-size-xs;
padding: $space-1 $space-2;
border-radius: $radius-sm;
+ width: fit-content;
}
.server-card-footer {
@@ -318,9 +762,143 @@
padding: $space-2 $space-3;
font-size: $font-size-xs;
}
+
+ .server-ping-button {
+ flex: 0 0 48px;
+ }
+}
+
+.server-setup-modal {
+ overflow: hidden;
+ border-radius: 20px;
+ width: 100%;
+ max-width: 540px;
+ max-height: min(720px, 90vh);
+ display: flex;
+ flex-direction: column;
+
+ .modal-header {
+ flex-shrink: 0;
+ align-items: flex-start;
+ padding: $space-5 $space-6 $space-4;
+ background:
+ linear-gradient(135deg, $accent-glow, transparent 42%),
+ linear-gradient(135deg, $bg-card, $bg-elevated);
+
+ h2 {
+ margin: $space-1 0 4px;
+ font-size: $font-size-xl;
+ letter-spacing: -0.03em;
+ }
+
+ p {
+ max-width: 460px;
+ margin: 0;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ line-height: 1.45;
+ }
+ }
+
+ .servers-eyebrow {
+ font-size: 9px;
+ }
+}
+
+.server-setup-form {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ padding: 0;
+
+ &__body {
+ display: grid;
+ gap: $space-4;
+ padding: $space-5 $space-6;
+ overflow-y: auto;
+ flex: 1;
+ min-height: 0;
+ @include custom-scrollbar();
+ }
+
+ .modal-actions {
+ flex-shrink: 0;
+ margin: 0;
+ padding: $space-3 $space-6;
+ border-top: 1px solid $border-subtle;
+ background: $bg-card;
+ }
+
+ .form-group {
+ margin: 0;
+ }
+
+ .form-hint {
+ display: block;
+ margin-top: 6px;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ line-height: 1.4;
+ }
+}
+
+.form-disclosure {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ padding: $space-2 $space-3;
+ background: transparent;
+ border: 1px dashed $border-subtle;
+ border-radius: $radius-md;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+ cursor: pointer;
+ transition: all 0.15s ease;
+ text-align: left;
+
+ &:hover {
+ border-color: $accent-primary;
+ color: $text-primary;
+ background: $bg-hover;
+ }
+
+ &__chevron {
+ display: inline-block;
+ font-size: 16px;
+ line-height: 1;
+ color: $accent-primary;
+ transition: transform 0.15s ease;
+
+ &.is-open {
+ transform: rotate(90deg);
+ }
+ }
+
+ &__hint {
+ margin-left: auto;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-normal;
+ }
+
+ &__panel {
+ display: grid;
+ gap: $space-4;
+ padding: $space-4;
+ background: $bg-body;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ animation: form-disclosure-in 0.18s ease;
+ }
+}
+
+@keyframes form-disclosure-in {
+ from { opacity: 0; transform: translateY(-4px); }
+ to { opacity: 1; transform: translateY(0); }
}
-// Empty state
.empty-state {
text-align: center;
padding: $space-16 $space-6;
@@ -348,6 +926,50 @@
}
}
+.servers-empty-state {
+ position: relative;
+ overflow: hidden;
+ max-width: 760px;
+ margin: 0 auto;
+ background:
+ radial-gradient(circle at 50% -20%, $accent-glow, transparent 38%),
+ $bg-card;
+
+ .servers-eyebrow {
+ margin: 0 auto $space-3;
+ }
+}
+
+.servers-empty-state__icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 92px;
+ height: 92px;
+ margin-bottom: $space-4;
+ border: 1px solid $border-subtle;
+ border-radius: 28px;
+ background: $bg-body;
+
+ .empty-icon {
+ margin: 0;
+ color: $accent-primary;
+ }
+}
+
+@keyframes servers-pulse {
+ 0%,
+ 100% {
+ opacity: 0.55;
+ transform: scale(0.96);
+ }
+
+ 50% {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+
// ============================================
// SERVER DETAIL PAGE
// ============================================
@@ -1353,7 +1975,31 @@
}
.install-instructions {
- padding: $space-6;
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ padding: 0;
+
+ .modal-actions {
+ flex-shrink: 0;
+ margin: 0;
+ padding: $space-3 $space-6;
+ border-top: 1px solid $border-subtle;
+ background: $bg-card;
+ }
+}
+
+.install-instructions__scroll {
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ padding: $space-5 $space-6;
+ @include custom-scrollbar();
+
+ > .success-banner {
+ margin-bottom: $space-4;
+ }
}
.success-banner {
@@ -1571,3 +2217,631 @@
color: $text-tertiary;
font-size: $font-size-sm;
}
+
+
+// ============================================
+// SERVERS — REDESIGNED OPS CONSOLE
+// ============================================
+
+.servers-header {
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: $space-4;
+ margin-bottom: $space-5;
+ padding-bottom: $space-4;
+ border-bottom: 1px solid $border-subtle;
+
+ h1 {
+ margin: 0;
+ font-size: $font-size-3xl;
+ line-height: 1.1;
+ letter-spacing: -0.02em;
+ color: $text-primary;
+ font-weight: $font-weight-semibold;
+ }
+
+ p {
+ margin: $space-1 0 0;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ font-family: $font-mono;
+ }
+
+ &__actions {
+ display: flex;
+ gap: $space-2;
+ flex-wrap: wrap;
+ }
+
+ @media (max-width: $breakpoint-sm) {
+ flex-direction: column;
+ align-items: stretch;
+
+ &__actions .btn {
+ flex: 1;
+ justify-content: center;
+ }
+ }
+}
+
+.servers-bulk-bar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-3;
+ padding: $space-3 $space-4;
+ margin-bottom: $space-4;
+ border: 1px solid $accent-primary;
+ border-radius: $radius-xl;
+ background:
+ linear-gradient(180deg, $accent-glow, transparent),
+ $bg-card;
+ box-shadow: $shadow-sm;
+
+ &__info {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ }
+
+ &__count {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ min-width: 28px;
+ height: 28px;
+ padding: 0 $space-2;
+ border-radius: $radius-full;
+ background: $accent-primary;
+ color: #fff;
+ font-family: $font-mono;
+ font-weight: $font-weight-bold;
+ font-size: $font-size-sm;
+ }
+
+ &__actions {
+ display: flex;
+ gap: $space-2;
+ }
+}
+
+.servers-table-wrap {
+ overflow-x: auto;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-xl;
+ background: $bg-card;
+ box-shadow: $shadow-sm;
+}
+
+.servers-table {
+ width: 100%;
+ border-collapse: separate;
+ border-spacing: 0;
+ font-size: $font-size-sm;
+
+ thead th {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ text-align: left;
+ padding: $space-3 $space-4;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-semibold;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: $text-tertiary;
+ background: $bg-elevated;
+ border-bottom: 1px solid $border-subtle;
+ white-space: nowrap;
+ }
+
+ tbody td {
+ padding: $space-3 $space-4;
+ border-bottom: 1px solid $border-subtle;
+ vertical-align: middle;
+ color: $text-secondary;
+ }
+
+ tbody tr:last-child td {
+ border-bottom: 0;
+ }
+
+ .col-check {
+ width: 44px;
+ padding-right: 0;
+
+ input[type="checkbox"] {
+ width: 16px;
+ height: 16px;
+ accent-color: $accent-primary;
+ cursor: pointer;
+ }
+ }
+
+ .col-actions {
+ width: 1%;
+ white-space: nowrap;
+ text-align: right;
+ }
+
+ .muted {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ }
+}
+
+.server-row {
+ transition: background $transition-fast;
+
+ &:hover {
+ background: $bg-hover;
+ }
+
+ &.is-selected {
+ background: $accent-glow;
+ }
+
+ &--offline .status-pill__dot { background: $danger; }
+ &--online .status-pill__dot { background: $success; box-shadow: 0 0 8px $success; }
+ &--connecting .status-pill__dot { background: $warning; }
+ &--pending .status-pill__dot { background: $text-tertiary; }
+}
+
+.server-row__name {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-3;
+ color: $text-primary;
+ text-decoration: none;
+ min-width: 0;
+
+ &:hover .server-row__title {
+ color: $accent-primary;
+ }
+}
+
+.server-row__avatar {
+ flex-shrink: 0;
+ width: 32px;
+ height: 32px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: $radius-md;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ color: $text-secondary;
+ font-family: $font-mono;
+ font-weight: $font-weight-bold;
+ font-size: $font-size-sm;
+
+ &--online {
+ background: $success-bg;
+ border-color: $success-border;
+ color: $success;
+ }
+
+ &--offline {
+ background: $danger-bg;
+ border-color: $danger-border;
+ color: $danger;
+ }
+
+ &--connecting {
+ background: $warning-bg;
+ border-color: $warning-border;
+ color: $warning;
+ }
+}
+
+.server-row__identity {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+}
+
+.server-row__title {
+ color: $text-primary;
+ font-weight: $font-weight-semibold;
+ line-height: 1.2;
+ transition: color $transition-fast;
+}
+
+.server-row__sub {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-family: $font-mono;
+ line-height: 1.3;
+ margin-top: 2px;
+}
+
+.server-row__group {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 2px $space-2;
+ border-radius: $radius-full;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ font-size: $font-size-xs;
+ color: $text-secondary;
+ white-space: nowrap;
+}
+
+.server-row__stack {
+ display: flex;
+ flex-direction: column;
+ line-height: 1.3;
+
+ span:first-child {
+ color: $text-secondary;
+ }
+}
+
+.server-row__lastseen {
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ color: $text-secondary;
+ white-space: nowrap;
+}
+
+.server-row__telemetry {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 180px;
+
+ > span {
+ display: grid;
+ grid-template-columns: 30px 1fr 36px;
+ align-items: center;
+ gap: $space-2;
+ font-size: 11px;
+ }
+
+ em {
+ color: $text-tertiary;
+ font-family: $font-mono;
+ font-style: normal;
+ letter-spacing: 0.04em;
+ }
+
+ b {
+ color: $text-secondary;
+ font-family: $font-mono;
+ font-weight: $font-weight-semibold;
+ text-align: right;
+ }
+
+ .bar {
+ position: relative;
+ height: 6px;
+ background: $bg-elevated;
+ border-radius: $radius-full;
+ overflow: hidden;
+ }
+
+ .bar-fill {
+ position: absolute;
+ inset: 0 auto 0 0;
+ border-radius: $radius-full;
+
+ &.cpu { background: $accent-primary; }
+ &.memory { background: $success; }
+ &.disk { background: $warning; }
+ }
+}
+
+.status-pill {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 3px 10px 3px 8px;
+ border-radius: $radius-full;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-semibold;
+ text-transform: capitalize;
+ border: 1px solid transparent;
+ line-height: 1;
+
+ &__dot {
+ width: 6px;
+ height: 6px;
+ border-radius: $radius-full;
+ background: $text-tertiary;
+ }
+
+ &--online {
+ color: $success;
+ background: $success-bg;
+ border-color: $success-border;
+ }
+ &--offline {
+ color: $danger;
+ background: $danger-bg;
+ border-color: $danger-border;
+ }
+ &--connecting {
+ color: $warning;
+ background: $warning-bg;
+ border-color: $warning-border;
+ }
+ &--pending {
+ color: $text-tertiary;
+ background: $bg-elevated;
+ border-color: $border-subtle;
+ }
+}
+
+.row-actions {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+
+ &__icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 30px;
+ height: 30px;
+ border: 1px solid transparent;
+ border-radius: $radius-md;
+ background: transparent;
+ color: $text-secondary;
+ cursor: pointer;
+ transition: all $transition-fast;
+ text-decoration: none;
+
+ &:hover {
+ background: $bg-elevated;
+ border-color: $border-subtle;
+ color: $text-primary;
+ }
+ }
+}
+
+.row-menu {
+ z-index: 9999;
+ min-width: 200px;
+ padding: 6px;
+ background: $bg-card;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-lg;
+ box-shadow: $shadow-lg;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+
+ &__item {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ padding: $space-2 $space-3;
+ border: 0;
+ border-radius: $radius-md;
+ background: transparent;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ text-align: left;
+ text-decoration: none;
+ cursor: pointer;
+ white-space: nowrap;
+
+ svg {
+ color: $text-tertiary;
+ flex-shrink: 0;
+ }
+
+ &:hover {
+ background: $bg-hover;
+ color: $text-primary;
+
+ svg { color: $text-primary; }
+ }
+
+ &--danger {
+ color: $danger;
+ svg { color: $danger; }
+
+ &:hover {
+ background: $danger-bg;
+ color: $danger;
+ }
+ }
+ }
+
+ &__divider {
+ height: 1px;
+ background: $border-subtle;
+ margin: 4px 0;
+ }
+}
+
+.btn-ghost {
+ background: transparent;
+ border: 1px solid transparent;
+ color: $text-secondary;
+
+ &:hover {
+ background: $bg-elevated;
+ color: $text-primary;
+ }
+}
+
+
+// ============================================
+// SERVER DETAIL — REDESIGNED HEADER
+// ============================================
+
+.server-detail-header {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: $space-5;
+ padding: $space-5 0 $space-5;
+ margin-bottom: $space-5;
+ border-bottom: 1px solid $border-subtle;
+
+ &__main {
+ display: flex;
+ align-items: flex-start;
+ gap: $space-4;
+ min-width: 0;
+ flex: 1;
+ }
+
+ &__avatar {
+ flex-shrink: 0;
+ width: 56px;
+ height: 56px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: $radius-lg;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ color: $text-secondary;
+ font-family: $font-mono;
+ font-weight: $font-weight-bold;
+ font-size: $font-size-2xl;
+
+ &--online {
+ background: $success-bg;
+ border-color: $success-border;
+ color: $success;
+ box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.08);
+ }
+ &--offline {
+ background: $danger-bg;
+ border-color: $danger-border;
+ color: $danger;
+ }
+ &--connecting {
+ background: $warning-bg;
+ border-color: $warning-border;
+ color: $warning;
+ }
+ }
+
+ &__identity {
+ min-width: 0;
+ flex: 1;
+ }
+
+ &__title-row {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ flex-wrap: wrap;
+
+ h1 {
+ margin: 0;
+ font-size: $font-size-3xl;
+ line-height: 1.1;
+ letter-spacing: -0.02em;
+ color: $text-primary;
+ font-weight: $font-weight-semibold;
+ }
+ }
+
+ &__meta {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ flex-wrap: wrap;
+ margin-top: $space-2;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+
+ .mono {
+ font-family: $font-mono;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ }
+ }
+
+ &__chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 3px 8px;
+ border-radius: $radius-full;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ color: $text-secondary;
+ font-size: 11px;
+ white-space: nowrap;
+
+ svg { color: $text-tertiary; }
+ }
+
+ &__description {
+ margin: $space-3 0 0;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ line-height: $line-height-relaxed;
+ max-width: 720px;
+ }
+
+ &__actions {
+ display: flex;
+ gap: $space-2;
+ flex-shrink: 0;
+ flex-wrap: wrap;
+ }
+
+ @media (max-width: $breakpoint-md) {
+ flex-direction: column;
+ &__actions {
+ width: 100%;
+ .btn { flex: 1; justify-content: center; }
+ }
+ }
+}
+
+// Tighten existing tabs
+.server-detail-tabs {
+ margin-top: -$space-3;
+}
+
+// Refine overview info cards (less marketing, more dashboard)
+.overview-tab .info-card {
+ padding: $space-4 $space-5;
+ border-radius: $radius-xl;
+ background: $bg-card;
+ border: 1px solid $border-subtle;
+ box-shadow: $shadow-sm;
+ transition: border-color $transition-fast;
+
+ &:hover {
+ border-color: $border-active;
+ }
+
+ h3 {
+ margin: 0 0 $space-3;
+ padding-bottom: $space-2;
+ border-bottom: 1px solid $border-subtle;
+ font-size: 11px;
+ font-weight: $font-weight-bold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: $text-tertiary;
+ }
+}
+
+.overview-tab .info-item {
+ padding: $space-2 0;
+ border-bottom: 1px dashed $border-subtle;
+
+ &:last-child { border-bottom: 0; }
+
+ .info-value {
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ color: $text-primary;
+ }
+}
diff --git a/scripts/setup-wsl.sh b/scripts/setup-wsl.sh
new file mode 100644
index 00000000..2018313a
--- /dev/null
+++ b/scripts/setup-wsl.sh
@@ -0,0 +1,241 @@
+#!/usr/bin/env bash
+# ServerKit WSL setup helper.
+#
+# One-shot installer for Windows users running ServerKit dev inside
+# WSL2 (Ubuntu/Debian). Installs system packages, creates the Python
+# venv, installs npm dependencies, prepares .env files, and verifies
+# common WSL pitfalls (filesystem location, localhost binding,
+# polling-based reloader).
+#
+# Usage:
+# bash scripts/setup-wsl.sh # full setup
+# bash scripts/setup-wsl.sh --check # diagnostics only, no install
+#
+# After this finishes:
+# ./dev.sh # start backend + frontend
+# ./dev.sh tunnel # also expose backend through ngrok
+
+set -euo pipefail
+
+CYAN='\033[0;36m'
+GREEN='\033[0;32m'
+RED='\033[0;31m'
+YELLOW='\033[1;33m'
+DIM='\033[2m'
+NC='\033[0m'
+
+PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+BACKEND_DIR="$PROJECT_ROOT/backend"
+FRONTEND_DIR="$PROJECT_ROOT/frontend"
+CHECK_ONLY=0
+
+for arg in "$@"; do
+ case "$arg" in
+ --check|-c) CHECK_ONLY=1 ;;
+ --help|-h)
+ sed -n '2,16p' "$0" | sed 's/^# \{0,1\}//'
+ exit 0
+ ;;
+ *) echo -e "${RED}Unknown argument:${NC} $arg"; exit 2 ;;
+ esac
+done
+
+header() { echo ""; echo -e "${CYAN}=== $1 ===${NC}"; }
+ok() { echo -e " ${GREEN}OK${NC} $1"; }
+warn() { echo -e " ${YELLOW}WARN${NC} $1"; }
+fail() { echo -e " ${RED}FAIL${NC} $1"; }
+info() { echo -e " ${DIM}$1${NC}"; }
+
+# -----------------------------------------------------------------------------
+# Diagnostics
+# -----------------------------------------------------------------------------
+header "Environment diagnostics"
+
+IN_WSL=0
+if grep -qiE 'microsoft|wsl' /proc/version 2>/dev/null; then
+ IN_WSL=1
+ ok "Running inside WSL ($(uname -r))"
+else
+ warn "Not detected as WSL. This script is intended for WSL2 but will still try to run."
+fi
+
+if [ "$IN_WSL" -eq 1 ]; then
+ case "$PROJECT_ROOT" in
+ /mnt/*)
+ warn "Repo is on the Windows filesystem ($PROJECT_ROOT)."
+ info "File I/O and Vite/Flask reloaders are noticeably slower here."
+ info "For best performance clone the repo into the Linux home, e.g.:"
+ info " cd ~ && git clone https://github.com/jhd3197/ServerKit.git"
+ ;;
+ *)
+ ok "Repo is on the Linux filesystem ($PROJECT_ROOT)."
+ ;;
+ esac
+fi
+
+# Distro detection
+DISTRO_ID="unknown"
+if [ -r /etc/os-release ]; then
+ # shellcheck disable=SC1091
+ . /etc/os-release
+ DISTRO_ID="$ID"
+ ok "Distro: $PRETTY_NAME"
+fi
+
+if [ "$DISTRO_ID" != "ubuntu" ] && [ "$DISTRO_ID" != "debian" ]; then
+ warn "This script targets Ubuntu/Debian. Other distros may need manual adjustments."
+fi
+
+# -----------------------------------------------------------------------------
+# Required tools
+# -----------------------------------------------------------------------------
+header "Required tooling"
+
+NEED_APT=()
+need() {
+ local cmd="$1" pkg="$2"
+ if command -v "$cmd" &>/dev/null; then
+ ok "$cmd ($(command -v "$cmd"))"
+ else
+ warn "$cmd not found (needs apt package: $pkg)"
+ NEED_APT+=("$pkg")
+ fi
+}
+
+need python3 python3
+need pip3 python3-pip
+need node nodejs
+need npm npm
+need git git
+need curl curl
+
+# venv module
+if python3 -c 'import venv' 2>/dev/null; then
+ ok "python3-venv module available"
+else
+ warn "python3-venv module missing"
+ NEED_APT+=("python3-venv")
+fi
+
+# Node version sanity
+if command -v node &>/dev/null; then
+ NODE_MAJOR="$(node -v 2>/dev/null | sed -E 's/^v([0-9]+).*/\1/')"
+ if [ -n "$NODE_MAJOR" ] && [ "$NODE_MAJOR" -lt 18 ]; then
+ warn "Node.js version is $(node -v); ServerKit expects 18+ (20+ recommended)."
+ info "Upgrade with NodeSource: https://github.com/nodesource/distributions"
+ fi
+fi
+
+# -----------------------------------------------------------------------------
+# Install missing apt packages
+# -----------------------------------------------------------------------------
+if [ "${#NEED_APT[@]}" -gt 0 ]; then
+ if [ "$CHECK_ONLY" -eq 1 ]; then
+ warn "Missing packages (would install): ${NEED_APT[*]}"
+ else
+ header "Installing missing apt packages"
+ info "Running: sudo apt update && sudo apt install -y ${NEED_APT[*]}"
+ sudo apt update
+ sudo apt install -y "${NEED_APT[@]}"
+ fi
+fi
+
+# -----------------------------------------------------------------------------
+# Backend venv + requirements
+# -----------------------------------------------------------------------------
+header "Backend (Python venv)"
+
+if [ ! -d "$BACKEND_DIR" ]; then
+ fail "backend directory not found at $BACKEND_DIR"
+ exit 1
+fi
+
+if [ "$CHECK_ONLY" -eq 1 ]; then
+ if [ -d "$BACKEND_DIR/venv" ]; then
+ ok "venv exists at backend/venv"
+ else
+ warn "venv not yet created (run without --check to create it)"
+ fi
+else
+ if [ ! -d "$BACKEND_DIR/venv" ]; then
+ info "Creating venv in backend/venv"
+ python3 -m venv "$BACKEND_DIR/venv"
+ fi
+ # shellcheck disable=SC1091
+ source "$BACKEND_DIR/venv/bin/activate"
+ info "Upgrading pip"
+ pip install --quiet --upgrade pip
+ info "Installing backend requirements"
+ pip install --quiet -r "$BACKEND_DIR/requirements.txt"
+ deactivate
+ ok "Backend dependencies installed"
+fi
+
+# .env
+if [ ! -f "$BACKEND_DIR/.env" ] && [ -f "$BACKEND_DIR/.env.example" ]; then
+ if [ "$CHECK_ONLY" -eq 1 ]; then
+ warn "backend/.env missing (would copy from .env.example)"
+ else
+ cp "$BACKEND_DIR/.env.example" "$BACKEND_DIR/.env"
+ ok "Created backend/.env from .env.example"
+ info "Edit backend/.env to set SECRET_KEY / JWT_SECRET_KEY before any production-like use."
+ fi
+else
+ [ -f "$BACKEND_DIR/.env" ] && ok "backend/.env present"
+fi
+
+# -----------------------------------------------------------------------------
+# Frontend npm install
+# -----------------------------------------------------------------------------
+header "Frontend (npm)"
+
+if [ ! -d "$FRONTEND_DIR" ]; then
+ fail "frontend directory not found at $FRONTEND_DIR"
+ exit 1
+fi
+
+if [ "$CHECK_ONLY" -eq 1 ]; then
+ if [ -d "$FRONTEND_DIR/node_modules" ]; then
+ ok "node_modules present"
+ else
+ warn "node_modules missing (would run npm install)"
+ fi
+else
+ if [ ! -d "$FRONTEND_DIR/node_modules" ]; then
+ info "Running npm install in frontend/"
+ (cd "$FRONTEND_DIR" && npm install)
+ else
+ info "node_modules already present (skipping npm install)"
+ fi
+ ok "Frontend dependencies ready"
+fi
+
+# -----------------------------------------------------------------------------
+# WSL-specific advice
+# -----------------------------------------------------------------------------
+if [ "$IN_WSL" -eq 1 ]; then
+ header "WSL tips"
+ info "Backend already binds to 0.0.0.0 and uses a stat-based reloader (good for WSL)."
+ info "Vite dev server is reachable from Windows at http://localhost:5173 thanks to WSL2 localhost forwarding."
+ info "If hot-reload feels stuck, ensure the repo lives under your Linux home (~) rather than /mnt/c."
+ if command -v ngrok &>/dev/null; then
+ ok "ngrok is installed (use ./dev.sh tunnel to expose the backend)"
+ else
+ info "Install ngrok and then ./dev.sh tunnel will expose the backend so remote agents can connect."
+ fi
+fi
+
+# -----------------------------------------------------------------------------
+# Done
+# -----------------------------------------------------------------------------
+header "Done"
+if [ "$CHECK_ONLY" -eq 1 ]; then
+ echo "Diagnostics complete. Re-run without --check to install anything missing."
+else
+ echo -e " ${GREEN}Setup complete.${NC}"
+ echo ""
+ echo "Next steps:"
+ echo " 1. (Optional) edit backend/.env to set unique SECRET_KEY / JWT_SECRET_KEY"
+ echo " 2. ./dev.sh # start backend + frontend"
+ echo " 3. ./dev.sh tunnel # also expose backend via ngrok"
+fi