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 New Service (repo) creation and UI

Juan Denisc18d0d8ae576
diff --git a/backend/app/api/apps.py b/backend/app/api/apps.py
index 56377467..8c204cf9 100644
--- a/backend/app/api/apps.py
+++ b/backend/app/api/apps.py
@@ -1,10 +1,14 @@
import os
import json
+import re
+import shutil
from flask import Blueprint, request, jsonify
from flask_jwt_extended import jwt_required, get_jwt_identity
from app import db
from app.models import Application, User
+from app.services.build_service import BuildService
from app.services.docker_service import DockerService
+from app.services.git_service import GitService
from app.services.remote_docker_service import RemoteDockerService
from app.services.log_service import LogService
from app import paths
@@ -30,6 +34,50 @@ def _agent_result_error(result, fallback):
return result.get('error') or fallback
+def _service_slug(value):
+ return re.sub(r'[^a-z0-9-]+', '-', (value or '').strip().lower()).strip('-')
+
+
+def _derive_repo_app_type(detection):
+ if detection.get('has_dockerfile') or detection.get('has_docker_compose'):
+ return 'docker'
+ framework = detection.get('framework')
+ language = detection.get('language')
+ if framework == 'django':
+ return 'django'
+ if framework in ['flask', 'fastapi'] or language == 'python':
+ return 'flask'
+ if framework == 'laravel' or language == 'php':
+ return 'php'
+ return 'static'
+
+
+def _assert_managed_app_path(app_name):
+ base_dir = os.path.abspath(paths.APPS_DIR)
+ app_path = os.path.abspath(os.path.join(base_dir, app_name))
+ if app_path != base_dir and app_path.startswith(base_dir + os.sep):
+ return app_path
+ raise ValueError('Invalid application path')
+
+
+def _safe_repo_url(repo_url):
+ return re.sub(r'^(https?://)[^@]+@', r'\1', repo_url or '')
+
+
+def _attach_deploy_config(payload, deploy_configs=None):
+ deploy_configs = deploy_configs or GitService.get_config().get('apps', {})
+ deploy_config = deploy_configs.get(str(payload.get('id')))
+
+ payload['last_deploy_at'] = payload.get('last_deployed_at')
+ payload['deploy_configured'] = deploy_config is not None
+ if deploy_config:
+ payload['deploy_repo_url'] = _safe_repo_url(deploy_config.get('repo_url'))
+ payload['deploy_branch'] = deploy_config.get('branch')
+ payload['auto_deploy'] = deploy_config.get('auto_deploy', False)
+ payload['last_deploy_at'] = deploy_config.get('last_deploy')
+ return payload
+
+
# ==================== ENVIRONMENT LINKING ====================
@apps_bp.route('/<int:app_id>/link', methods=['POST'])
@@ -270,9 +318,13 @@ def get_apps():
query = query.filter_by(environment_type=environment_filter)
apps = query.all()
+ deploy_configs = GitService.get_config().get('apps', {})
return jsonify({
- 'apps': [app.to_dict(include_linked=include_linked) for app in apps]
+ 'apps': [
+ _attach_deploy_config(app.to_dict(include_linked=include_linked), deploy_configs)
+ for app in apps
+ ]
}), 200
@@ -290,7 +342,119 @@ def get_app(app_id):
return jsonify({'error': 'Access denied'}), 403
# Single app requests include linked app info by default
- return jsonify({'app': app.to_dict(include_linked=True)}), 200
+ return jsonify({'app': _attach_deploy_config(app.to_dict(include_linked=True))}), 200
+
+
+@apps_bp.route('/from-repository', methods=['POST'])
+@jwt_required()
+def create_app_from_repository():
+ """Create a new application by cloning a Git repository."""
+ current_user_id = get_jwt_identity()
+ user = User.query.get(current_user_id)
+ if not user or user.role != 'admin':
+ return jsonify({'error': 'Admin access required'}), 403
+
+ data = request.get_json() or {}
+ name = _service_slug(data.get('name'))
+ repo_url = (data.get('repo_url') or '').strip()
+ branch = (data.get('branch') or 'main').strip()
+ app_type = (data.get('app_type') or 'auto').strip().lower()
+ build_method = (data.get('build_method') or 'auto').strip().lower()
+ auto_deploy = bool(data.get('auto_deploy', True))
+ port = data.get('port')
+
+ if not name or len(name) < 2:
+ return jsonify({'error': 'Service name must be at least 2 characters'}), 400
+ if not repo_url:
+ return jsonify({'error': 'repo_url is required'}), 400
+
+ valid_app_types = ['auto', 'docker', 'flask', 'django', 'php', 'static']
+ if app_type not in valid_app_types:
+ return jsonify({'error': f'Invalid app_type. Must be one of: {", ".join(valid_app_types)}'}), 400
+
+ valid_build_methods = ['auto', 'dockerfile', 'nixpacks', 'custom']
+ if build_method not in valid_build_methods:
+ return jsonify({'error': f'Invalid build_method. Must be one of: {", ".join(valid_build_methods)}'}), 400
+
+ if port in ['', None]:
+ port = None
+ elif isinstance(port, int) or (isinstance(port, str) and port.isdigit()):
+ port = int(port)
+ else:
+ return jsonify({'error': 'port must be a number'}), 400
+
+ if Application.query.filter_by(name=name, server_id=None).first():
+ return jsonify({'error': f'An application named "{name}" already exists'}), 400
+
+ try:
+ app_path = _assert_managed_app_path(name)
+ except ValueError as exc:
+ return jsonify({'error': str(exc)}), 400
+
+ if os.path.exists(app_path):
+ return jsonify({'error': f'App directory already exists: {app_path}'}), 400
+
+ clone_result = GitService.clone_repository(app_path, repo_url, branch or None)
+ if not clone_result.get('success'):
+ return jsonify(clone_result), 400
+
+ detection = BuildService.detect_build_method(app_path)
+ resolved_app_type = _derive_repo_app_type(detection) if app_type == 'auto' else app_type
+
+ app = Application(
+ name=name,
+ app_type=resolved_app_type,
+ status='stopped',
+ root_path=app_path,
+ user_id=current_user_id,
+ port=port,
+ )
+
+ try:
+ db.session.add(app)
+ db.session.commit()
+
+ deploy_result = GitService.configure_deployment(
+ app_id=app.id,
+ app_path=app.root_path,
+ repo_url=repo_url,
+ branch=branch or 'main',
+ auto_deploy=auto_deploy,
+ )
+ if not deploy_result.get('success'):
+ raise RuntimeError(deploy_result.get('error', 'Failed to configure deployment'))
+
+ build_result = BuildService.configure_build(
+ app_id=app.id,
+ app_path=app.root_path,
+ build_method=build_method,
+ )
+ if not build_result.get('success'):
+ raise RuntimeError(build_result.get('error', 'Failed to configure build'))
+
+ return jsonify({
+ 'message': 'Repository service created',
+ 'app': _attach_deploy_config(app.to_dict(include_linked=True)),
+ 'deploy_config': {
+ 'repo_url': _safe_repo_url(repo_url),
+ 'branch': branch or 'main',
+ 'auto_deploy': auto_deploy,
+ 'webhook_url': deploy_result.get('webhook_url'),
+ },
+ 'build_config': build_result.get('config'),
+ 'detection': detection,
+ }), 201
+ except Exception as exc:
+ db.session.rollback()
+ if app.id:
+ GitService.remove_deployment(app.id)
+ existing_app = Application.query.get(app.id)
+ if existing_app:
+ db.session.delete(existing_app)
+ db.session.commit()
+ if os.path.abspath(app_path).startswith(os.path.abspath(paths.APPS_DIR) + os.sep):
+ shutil.rmtree(app_path, ignore_errors=True)
+ return jsonify({'error': str(exc)}), 400
@apps_bp.route('', methods=['POST'])
diff --git a/backend/app/services/git_service.py b/backend/app/services/git_service.py
index 82653638..49d4680c 100644
--- a/backend/app/services/git_service.py
+++ b/backend/app/services/git_service.py
@@ -109,7 +109,10 @@ class GitService:
if os.path.exists(app_path):
return {'success': False, 'error': 'Directory already exists'}
- cmd = ['git', 'clone', '--branch', branch, '--single-branch', repo_url, app_path]
+ cmd = ['git', 'clone']
+ if branch:
+ cmd.extend(['--branch', branch, '--single-branch'])
+ cmd.extend([repo_url, app_path])
result = subprocess.run(cmd, capture_output=True, text=True, timeout=300)
if result.returncode == 0:
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index f6dcbf08..2c8df34a 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -24,9 +24,10 @@ import FTPServer from './pages/FTPServer';
// Firewall is now part of Security page
import Git from './pages/Git';
import CronJobs from './pages/CronJobs';
-import Security from './pages/Security';
-import Services from './pages/Services';
-import ServiceDetail from './pages/ServiceDetail';
+import Security from './pages/Security';
+import Services from './pages/Services';
+import NewService from './pages/NewService';
+import ServiceDetail from './pages/ServiceDetail';
import Templates from './pages/Templates';
import WorkflowBuilder from './pages/WorkflowBuilder';
import Servers from './pages/Servers';
@@ -60,12 +61,13 @@ const PAGE_TITLES = {
'/login': 'Login',
'/register': 'Register',
'/setup': 'Setup',
- '/services': 'Services',
+ '/services': 'Services',
+ '/services/new': 'New Service',
'/apps': 'Applications',
'/wordpress': 'WordPress Sites',
'/wordpress/projects': 'WordPress Projects',
'/templates': 'Templates',
- '/deployments': 'Deployments',
+ '/deployments': 'Deployment Activity',
'/workflow': 'Workflow Builder',
'/domains': 'Domains',
'/databases': 'Databases',
@@ -208,8 +210,9 @@ function AppRoutes() {
</PrivateRoute>
}>
<Route index element={<Dashboard />} />
- <Route path="services" element={<Services />} />
- <Route path="services/:id" element={<ServiceDetail />} />
+ <Route path="services" element={<Services />} />
+ <Route path="services/new" element={<NewService />} />
+ <Route path="services/:id" element={<ServiceDetail />} />
<Route path="apps" element={<Navigate to="/services" replace />} />
<Route path="apps/:id" element={<ApplicationDetail />} />
<Route path="apps/:id/:tab" element={<ApplicationDetail />} />
diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.js
index 6d5135fa..b047aedf 100644
--- a/frontend/src/components/sidebarItems.js
+++ b/frontend/src/components/sidebarItems.js
@@ -53,8 +53,9 @@ export const SIDEBAR_ITEMS = [
category: 'infrastructure',
icon: '<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>',
subItems: [
+ { id: 'new-service', label: 'New Service', route: '/services/new', icon: '<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>' },
{ id: 'templates', label: 'Templates', route: '/templates', icon: '<rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/>' },
- { id: 'deployments', label: 'Deployments', route: '/deployments', icon: '<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>' }
+ { id: 'deployments', label: 'Deploy Activity', route: '/deployments', icon: '<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>' }
]
},
{
diff --git a/frontend/src/pages/Deployments.jsx b/frontend/src/pages/Deployments.jsx
index 662ee266..27f97006 100644
--- a/frontend/src/pages/Deployments.jsx
+++ b/frontend/src/pages/Deployments.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useRef, useMemo } from 'react';
+import { Link } from 'react-router-dom';
import {
Activity,
CheckCircle2,
@@ -8,6 +9,7 @@ import {
Server,
Loader2,
AlertTriangle,
+ GitBranch,
PlayCircle,
} from 'lucide-react';
import api from '../services/api';
@@ -137,13 +139,19 @@ const Deployments = () => {
<div className="deployments-page__heading">
<h1 className="page-title">
<Activity size={22} />
- Deployments
+ Deployment Activity
</h1>
<p className="deployments-page__description">
- Track deployment jobs across all servers — see real-time status, step-by-step progress, and logs.
+ Track install and deploy jobs across services and servers with status, progress, and logs.
</p>
</div>
<div className="deployments-page__actions">
+ <Button variant="outline" asChild>
+ <Link to="/services/new">
+ <GitBranch size={16} />
+ New Service
+ </Link>
+ </Button>
<Button
variant={autoRefresh ? 'default' : 'outline'}
onClick={() => setAutoRefresh((v) => !v)}
@@ -217,7 +225,7 @@ const Deployments = () => {
<PlayCircle size={34} />
<strong>No deployment jobs yet</strong>
<span>
- Install a template or trigger a deploy to see it here.
+ Create a service from a repository or install a template to see activity here.
</span>
</div>
) : (
diff --git a/frontend/src/pages/NewService.jsx b/frontend/src/pages/NewService.jsx
new file mode 100644
index 00000000..6192c091
--- /dev/null
+++ b/frontend/src/pages/NewService.jsx
@@ -0,0 +1,295 @@
+import { useMemo, useState } from 'react';
+import { Link, useNavigate } from 'react-router-dom';
+import {
+ ArrowRight,
+ Boxes,
+ CheckCircle2,
+ GitBranch,
+ Lock,
+ Package,
+ Rocket,
+ Server,
+ Zap,
+} from 'lucide-react';
+import api from '../services/api';
+import { useToast } from '../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Switch } from '@/components/ui/switch';
+
+const APP_TYPE_OPTIONS = [
+ { value: 'auto', label: 'Auto-detect' },
+ { value: 'docker', label: 'Docker / Compose' },
+ { value: 'flask', label: 'Python' },
+ { value: 'django', label: 'Django' },
+ { value: 'php', label: 'PHP' },
+ { value: 'static', label: 'Static site' },
+];
+
+const BUILD_METHOD_OPTIONS = [
+ { value: 'auto', label: 'Auto build' },
+ { value: 'nixpacks', label: 'Nixpacks' },
+ { value: 'dockerfile', label: 'Dockerfile' },
+ { value: 'custom', label: 'Custom command' },
+];
+
+function slugify(value) {
+ return value.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '');
+}
+
+function repoNameFromUrl(value) {
+ if (!value) return '';
+ const cleaned = value.trim().replace(/\.git$/, '');
+ const parts = cleaned.split(/[/:]/).filter(Boolean);
+ return slugify(parts[parts.length - 1] || '');
+}
+
+const NewService = () => {
+ const navigate = useNavigate();
+ const toast = useToast();
+ const [repoUrl, setRepoUrl] = useState('');
+ const [name, setName] = useState('');
+ const [nameTouched, setNameTouched] = useState(false);
+ const [branch, setBranch] = useState('main');
+ const [appType, setAppType] = useState('auto');
+ const [buildMethod, setBuildMethod] = useState('auto');
+ const [port, setPort] = useState('');
+ const [autoDeploy, setAutoDeploy] = useState(true);
+ const [submitting, setSubmitting] = useState(false);
+
+ const detectedName = useMemo(() => repoNameFromUrl(repoUrl), [repoUrl]);
+ const serviceName = name || detectedName;
+
+ function handleRepoChange(value) {
+ setRepoUrl(value);
+ if (!nameTouched) {
+ setName(repoNameFromUrl(value));
+ }
+ }
+
+ async function handleSubmit(e) {
+ e.preventDefault();
+ if (!repoUrl.trim()) {
+ toast.error('Repository URL is required');
+ return;
+ }
+ if (!serviceName || serviceName.length < 2) {
+ toast.error('Service name must be at least 2 characters');
+ return;
+ }
+
+ setSubmitting(true);
+ try {
+ const result = await api.createAppFromRepository({
+ name: serviceName,
+ repo_url: repoUrl.trim(),
+ branch: branch.trim() || null,
+ app_type: appType,
+ build_method: buildMethod,
+ port: port ? Number(port) : null,
+ auto_deploy: autoDeploy,
+ });
+ toast.success('Repository service created');
+ navigate(`/services/${result.app.id}`);
+ } catch (err) {
+ toast.error(err.message || 'Failed to create repository service');
+ } finally {
+ setSubmitting(false);
+ }
+ }
+
+ return (
+ <div className="page-container new-service-page">
+ <div className="new-service-page__breadcrumb">
+ <Link to="/services">Services</Link>
+ <span>/</span>
+ <span>New</span>
+ </div>
+
+ <div className="new-service-page__header">
+ <div>
+ <h1>New Service</h1>
+ <p>Create a service from an existing repository or start from a managed template.</p>
+ </div>
+ </div>
+
+ <div className="new-service-page__source-grid">
+ <button className="new-service-page__source-card new-service-page__source-card--active" type="button">
+ <span className="new-service-page__source-icon">
+ <GitBranch size={18} />
+ </span>
+ <span>
+ <strong>Repository</strong>
+ <small>GitHub, GitLab, Bitbucket, Gitea, or SSH remote</small>
+ </span>
+ <CheckCircle2 size={18} />
+ </button>
+ <Link to="/templates" className="new-service-page__source-card">
+ <span className="new-service-page__source-icon">
+ <Package size={18} />
+ </span>
+ <span>
+ <strong>Template</strong>
+ <small>One-click apps such as Gitea, Ghost, n8n, and Nextcloud</small>
+ </span>
+ <ArrowRight size={18} />
+ </Link>
+ </div>
+
+ <div className="new-service-page__layout">
+ <form className="new-service-page__panel new-service-page__form" onSubmit={handleSubmit}>
+ <div className="new-service-page__section">
+ <div className="new-service-page__section-heading">
+ <GitBranch size={16} />
+ <h2>Source</h2>
+ </div>
+ <div className="new-service-page__field">
+ <Label htmlFor="repo-url">Repository URL</Label>
+ <Input
+ id="repo-url"
+ value={repoUrl}
+ onChange={(e) => handleRepoChange(e.target.value)}
+ placeholder="[email protected]:owner/repo.git"
+ autoComplete="off"
+ required
+ />
+ <span className="new-service-page__hint">
+ Private repositories work with SSH URLs or HTTPS URLs your server can authenticate.
+ </span>
+ </div>
+ <div className="new-service-page__two-col">
+ <div className="new-service-page__field">
+ <Label htmlFor="branch">Branch</Label>
+ <Input
+ id="branch"
+ value={branch}
+ onChange={(e) => setBranch(e.target.value)}
+ placeholder="main"
+ />
+ </div>
+ <div className="new-service-page__field">
+ <Label htmlFor="service-name">Service name</Label>
+ <Input
+ id="service-name"
+ value={serviceName}
+ onChange={(e) => {
+ setNameTouched(true);
+ setName(slugify(e.target.value));
+ }}
+ placeholder="my-service"
+ minLength={2}
+ required
+ />
+ </div>
+ </div>
+ </div>
+
+ <div className="new-service-page__section">
+ <div className="new-service-page__section-heading">
+ <Boxes size={16} />
+ <h2>Runtime</h2>
+ </div>
+ <div className="new-service-page__two-col">
+ <div className="new-service-page__field">
+ <Label htmlFor="app-type">Service type</Label>
+ <select
+ id="app-type"
+ value={appType}
+ onChange={(e) => setAppType(e.target.value)}
+ >
+ {APP_TYPE_OPTIONS.map(option => (
+ <option key={option.value} value={option.value}>{option.label}</option>
+ ))}
+ </select>
+ </div>
+ <div className="new-service-page__field">
+ <Label htmlFor="build-method">Build method</Label>
+ <select
+ id="build-method"
+ value={buildMethod}
+ onChange={(e) => setBuildMethod(e.target.value)}
+ >
+ {BUILD_METHOD_OPTIONS.map(option => (
+ <option key={option.value} value={option.value}>{option.label}</option>
+ ))}
+ </select>
+ </div>
+ </div>
+ <div className="new-service-page__two-col">
+ <div className="new-service-page__field">
+ <Label htmlFor="port">Runtime port</Label>
+ <Input
+ id="port"
+ type="number"
+ value={port}
+ onChange={(e) => setPort(e.target.value)}
+ placeholder="3000"
+ min="1"
+ max="65535"
+ />
+ </div>
+ <div className="new-service-page__toggle">
+ <div>
+ <Label>Auto-deploy</Label>
+ <span>Keep webhook deployment enabled for this branch.</span>
+ </div>
+ <Switch checked={autoDeploy} onCheckedChange={setAutoDeploy} />
+ </div>
+ </div>
+ </div>
+
+ <div className="new-service-page__actions">
+ <Button type="button" variant="outline" asChild>
+ <Link to="/services">Cancel</Link>
+ </Button>
+ <Button type="submit" disabled={submitting}>
+ <Rocket size={16} />
+ {submitting ? 'Creating...' : 'Create Service'}
+ </Button>
+ </div>
+ </form>
+
+ <aside className="new-service-page__panel new-service-page__aside">
+ <div className="new-service-page__aside-block">
+ <h2>Connection Flow</h2>
+ <div className="new-service-page__flow">
+ <div>
+ <GitBranch size={16} />
+ <span>Repo</span>
+ </div>
+ <ArrowRight size={14} />
+ <div>
+ <Zap size={16} />
+ <span>Build</span>
+ </div>
+ <ArrowRight size={14} />
+ <div>
+ <Server size={16} />
+ <span>Service</span>
+ </div>
+ </div>
+ </div>
+
+ <div className="new-service-page__aside-block">
+ <h2>Private Access</h2>
+ <div className="new-service-page__note">
+ <Lock size={16} />
+ <span>Use an SSH remote when the server already has a deploy key, or an HTTPS URL that includes a provider token.</span>
+ </div>
+ </div>
+
+ <div className="new-service-page__aside-block">
+ <h2>Templates Stay Separate</h2>
+ <div className="new-service-page__note">
+ <Package size={16} />
+ <span>Templates are for packaged apps and infrastructure services. Repository services start here.</span>
+ </div>
+ </div>
+ </aside>
+ </div>
+ </div>
+ );
+};
+
+export default NewService;
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index c6f54635..f71db194 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -1,14 +1,21 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import { Link } from 'react-router-dom';
-import { Server as ServerLucideIcon } from 'lucide-react';
+import {
+ Activity,
+ CheckCircle2,
+ Clock3,
+ Folder,
+ Plus,
+ RefreshCw,
+ Search,
+ Server as ServerLucideIcon,
+ XCircle,
+} from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { ConfirmDialog } from '../components/ConfirmDialog';
-import EmptyState from '../components/EmptyState';
-import { StatCard, StatsGrid } from '../components/StatCard';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
-import { Badge } from '@/components/ui/badge';
const Servers = () => {
const [servers, setServers] = useState([]);
@@ -149,36 +156,65 @@ const Servers = () => {
};
const availability = fleetStats.total > 0 ? Math.round((fleetStats.online / fleetStats.total) * 100) : 0;
const hasActiveFilters = selectedGroup !== 'all' || selectedStatus !== 'all' || Boolean(searchTerm);
- const statCards = [
+ const groupCounts = servers.reduce((acc, server) => {
+ const key = server.group_id ? String(server.group_id) : 'ungrouped';
+ acc[key] = (acc[key] || 0) + 1;
+ return acc;
+ }, {});
+ const statusFilters = [
{
key: 'all',
- label: 'Total',
+ label: 'All servers',
value: fleetStats.total,
detail: `${groups.length} group${groups.length === 1 ? '' : 's'}`,
- icon: <ServerIcon />,
+ icon: ServerLucideIcon,
},
{
key: 'online',
label: 'Online',
value: fleetStats.online,
detail: `${availability}% available`,
- icon: <CheckCircleIcon />,
+ icon: CheckCircle2,
},
{
key: 'offline',
label: 'Offline',
value: fleetStats.offline,
detail: 'Needs attention',
- icon: <XCircleIcon />,
+ icon: XCircle,
},
{
key: 'connecting',
label: 'Connecting',
value: fleetStats.connecting,
- detail: `${fleetStats.pending} pending`,
- icon: <RefreshIcon />,
- }
+ detail: 'Agent handshake',
+ icon: RefreshCw,
+ },
+ {
+ key: 'pending',
+ label: 'Pending',
+ value: fleetStats.pending,
+ detail: 'Awaiting install',
+ icon: Clock3,
+ },
+ ];
+ const groupFilters = [
+ { key: 'all', label: 'All groups', value: fleetStats.total },
+ ...groups.map(group => ({
+ key: String(group.id),
+ label: group.name,
+ value: groupCounts[String(group.id)] || 0,
+ })),
+ { key: 'ungrouped', label: 'Ungrouped', value: groupCounts.ungrouped || 0 },
];
+ const activeStatusLabel = statusFilters.find(filter => filter.key === selectedStatus)?.label || 'All servers';
+ const fleetStateLabel = fleetStats.total === 0
+ ? 'No agents paired'
+ : fleetStats.offline > 0
+ ? 'Needs attention'
+ : (fleetStats.connecting + fleetStats.pending) > 0
+ ? 'Pairing in progress'
+ : 'Healthy';
if (loading) {
return (
@@ -196,161 +232,216 @@ const Servers = () => {
const someVisibleSelected = visibleIds.some(id => selectedIds.has(id));
return (
- <div className="page-container servers-page">
- <header className="servers-header">
- <div className="servers-header__title">
- <h1>Servers</h1>
- <p>{servers.length} {servers.length === 1 ? 'machine' : 'machines'} · {fleetStats.online} online · {availability}% availability</p>
- </div>
- <div className="servers-header__actions">
- <Button variant="outline" onClick={() => setShowGroupModal(true)}>
- <FolderIcon /> Groups
- </Button>
- <Button onClick={() => setShowAddModal(true)}>
- <PlusIcon /> Add Server
- </Button>
- </div>
- </header>
-
- <StatsGrid>
- {statCards.map(stat => (
- <StatCard
- key={stat.key}
- iconNode={stat.icon}
- iconVariant={stat.key}
- label={stat.label}
- value={stat.value}
- detail={stat.detail}
- active={selectedStatus === stat.key}
- onClick={() => setSelectedStatus(stat.key)}
- />
- ))}
- </StatsGrid>
+ <div className="page-container page-container--full-bleed servers-page servers-page--ops">
+ <div className="servers-ops-workspace">
+ <aside className="servers-fleet-rail">
+ <section className="servers-rail-section servers-rail-section--health">
+ <div className="servers-rail-section-header">
+ <Activity size={14} />
+ <span>Fleet health</span>
+ </div>
+ <div className="servers-health-dial" style={{ '--availability': `${availability * 3.6}deg` }}>
+ <strong>{availability}%</strong>
+ <span>available</span>
+ </div>
+ <div className="servers-health-summary">
+ <strong>{fleetStateLabel}</strong>
+ <span>{fleetStats.online} of {fleetStats.total} online</span>
+ </div>
+ </section>
- <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>
+ <section className="servers-rail-section">
+ <div className="servers-rail-section-header">
+ <ServerLucideIcon size={14} />
+ <span>Status</span>
+ </div>
+ <div className="servers-status-nav">
+ {statusFilters.map(filter => {
+ const Icon = filter.icon;
+ return (
+ <button
+ type="button"
+ key={filter.key}
+ className={`servers-status-nav-item servers-status-nav-item--${filter.key} ${selectedStatus === filter.key ? 'active' : ''}`}
+ onClick={() => setSelectedStatus(filter.key)}
+ >
+ <Icon size={15} />
+ <span>
+ <strong>{filter.label}</strong>
+ <small>{filter.detail}</small>
+ </span>
+ <b>{filter.value}</b>
+ </button>
+ );
+ })}
+ </div>
+ </section>
+
+ <section className="servers-rail-section">
+ <div className="servers-rail-section-header servers-rail-section-header--split">
+ <span>
+ <Folder size={14} />
+ Groups
+ </span>
+ <button type="button" onClick={() => setShowGroupModal(true)}>
+ Manage
+ </button>
+ </div>
+ <div className="servers-group-nav">
+ {groupFilters.map(filter => (
+ <button
+ type="button"
+ key={filter.key}
+ className={`servers-group-nav-item ${selectedGroup === filter.key ? 'active' : ''}`}
+ onClick={() => setSelectedGroup(filter.key)}
+ >
+ <Folder size={14} />
+ <span>{filter.label}</span>
+ <b>{filter.value}</b>
+ </button>
))}
- <option value="ungrouped">Ungrouped</option>
- </select>
+ </div>
+ </section>
+ </aside>
+
+ <main className="servers-main">
+ <div className="servers-workbar">
+ <div className="servers-workbar-title">
+ <span>Servers</span>
+ <h1>{activeStatusLabel}</h1>
+ <em>{filteredServers.length} visible of {servers.length}</em>
+ </div>
+ <div className="servers-workbar-actions">
+ <Button variant="outline" onClick={() => setShowGroupModal(true)}>
+ <Folder size={16} /> Groups
+ </Button>
+ <Button onClick={() => setShowAddModal(true)}>
+ <Plus size={16} /> Add Server
+ </Button>
+ </div>
</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-command-bar">
+ <div className="servers-toolbar">
+ <label className="search-box">
+ <Search size={16} />
+ <Input
+ type="text"
+ placeholder="Search by name, host, or IP..."
+ value={searchTerm}
+ onChange={(e) => setSearchTerm(e.target.value)}
+ />
+ </label>
+ </div>
- {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" variant="ghost" size="sm" onClick={() => setSelectedIds(new Set())}>
- Clear selection
- </Button>
- <Button type="button" variant="destructive" size="sm" onClick={() => setBulkDeleteOpen(true)}>
- <TrashIcon /> Delete {selectedIds.size}
- </Button>
+ <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>
- )}
- {filteredServers.length === 0 ? (
- <EmptyState
- size="lg"
- icon={ServerLucideIcon}
- title={servers.length === 0 ? 'No servers yet' : 'No servers match these filters'}
- description={servers.length === 0
- ? '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.'}
- action={servers.length === 0 ? (
- <Button onClick={() => setShowAddModal(true)}>
- <PlusIcon /> Add your first server
- </Button>
+ {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" variant="ghost" size="sm" onClick={() => setSelectedIds(new Set())}>
+ Clear selection
+ </Button>
+ <Button type="button" variant="destructive" size="sm" onClick={() => setBulkDeleteOpen(true)}>
+ <TrashIcon /> Delete {selectedIds.size}
+ </Button>
+ </div>
+ </div>
+ )}
+
+ {filteredServers.length === 0 ? (
+ <div className="servers-empty-workspace">
+ <div className="servers-empty-workspace__icon">
+ <ServerLucideIcon size={28} />
+ </div>
+ <h2>{servers.length === 0 ? 'No servers yet' : 'No servers match these filters'}</h2>
+ <p>
+ {servers.length === 0
+ ? 'Pair an agent to bring a machine into this fleet.'
+ : 'Adjust the rail filters or search query to bring machines back into view.'}
+ </p>
+ <div className="servers-empty-workspace__actions">
+ {servers.length === 0 ? (
+ <Button onClick={() => setShowAddModal(true)}>
+ <Plus size={16} /> Add your first server
+ </Button>
+ ) : (
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => {
+ setSelectedGroup('all');
+ setSelectedStatus('all');
+ setSearchTerm('');
+ }}
+ >
+ Clear filters
+ </Button>
+ )}
+ </div>
+ </div>
) : (
- <Button
- type="button"
- variant="outline"
- onClick={() => {
- setSelectedGroup('all');
- setSelectedStatus('all');
- setSearchTerm('');
- }}
- >
- Clear filters
- </Button>
+ <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>
)}
- />
- ) : (
- <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>
- )}
+ </main>
+ </div>
{showAddModal && (
<AddServerModal
@@ -736,7 +827,7 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
onChange={(e) => setName(e.target.value)}
placeholder={lookupResult?.system_info?.hostname || 'Auto-detected from agent (optional)'}
/>
- <span className="form-hint">Leave blank to use the agent's hostname.</span>
+ <span className="form-hint">Leave blank to use the agent&apos;s hostname.</span>
</div>
<div className="form-group">
<label>Group</label>
@@ -1158,13 +1249,6 @@ const FolderIcon = ({ size = 16 }) => (
</svg>
);
-const SearchIcon = () => (
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <circle cx="11" cy="11" r="8"/>
- <line x1="21" y1="21" x2="16.65" y2="16.65"/>
- </svg>
-);
-
const CheckCircleIcon = () => (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
@@ -1172,14 +1256,6 @@ const CheckCircleIcon = () => (
</svg>
);
-const XCircleIcon = () => (
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <circle cx="12" cy="12" r="10"/>
- <line x1="15" y1="9" x2="9" y2="15"/>
- <line x1="9" y1="9" x2="15" y2="15"/>
- </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/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsx
index e113a688..fdcb1b23 100644
--- a/frontend/src/pages/ServiceDetail.jsx
+++ b/frontend/src/pages/ServiceDetail.jsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect, useRef } from 'react';
import { useParams, useNavigate, Link } from 'react-router-dom';
+import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
@@ -80,6 +81,32 @@ const ServiceDetail = () => {
}
}
+ async function handleDeployLatest() {
+ setActionLoading('deploy-latest');
+ try {
+ let hasBuildConfig = false;
+ try {
+ const buildConfig = await api.getBuildConfig(service.id);
+ hasBuildConfig = Boolean(buildConfig.configured);
+ } catch {
+ hasBuildConfig = false;
+ }
+
+ if (hasBuildConfig) {
+ await api.deployApp(service.id);
+ } else {
+ await api.triggerAppDeploy(service.id, true);
+ }
+ toast.success('Deployment started');
+ await reload();
+ } catch (err) {
+ toast.error(err.message || 'Failed to deploy latest commit');
+ } finally {
+ setActionLoading(null);
+ setShowDeployMenu(false);
+ }
+ }
+
async function handleDelete() {
const firstConfirm = await confirm({ title: 'Delete Service', message: `Delete ${service.name}? This action cannot be undone.` });
if (!firstConfirm) return;
@@ -173,16 +200,13 @@ const ServiceDetail = () => {
Manual Deploy (Restart)
</button>
{deployConfig && (
- <button onClick={() => {
- setShowDeployMenu(false);
- setActiveTab('events');
- }}>
+ <button onClick={handleDeployLatest} disabled={actionLoading === 'deploy-latest'}>
<svg width="14" height="14" 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>
- Deploy Latest Commit
+ {actionLoading === 'deploy-latest' ? 'Deploying...' : 'Deploy Latest Commit'}
</button>
)}
</div>
@@ -333,9 +357,9 @@ const ServiceDetail = () => {
{showGitModal && (
<GitConnectModal
appId={service.id}
- currentConfig={deployConfig}
+ deployConfig={deployConfig}
onClose={() => setShowGitModal(false)}
- onSave={() => {
+ onSaved={() => {
setShowGitModal(false);
reload();
}}
@@ -380,8 +404,8 @@ function ServiceIcon({ type }) {
function extractRepoDisplay(url) {
if (!url) return '';
try {
- const cleaned = url.replace(/\.git$/, '');
- const parts = cleaned.split('/');
+ const cleaned = url.replace(/\.git$/, '').replace(/^https?:\/\/[^@]+@/, 'https://');
+ const parts = cleaned.split(/[/:]/).filter(Boolean);
return parts.slice(-2).join('/');
} catch {
return url;
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index e6184285..9388cfc1 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useMemo } from 'react';
import { useNavigate, Link } from 'react-router-dom';
-import { Layers } from 'lucide-react';
+import { Layers, Plus } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/serviceTypes';
@@ -145,11 +145,8 @@ const Services = () => {
</p>
</div>
<Button asChild>
- <Link to="/templates">
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <line x1="12" y1="5" x2="12" y2="19"/>
- <line x1="5" y1="12" x2="19" y2="12"/>
- </svg>
+ <Link to="/services/new">
+ <Plus size={16} />
New Service
</Link>
</Button>
@@ -289,10 +286,10 @@ const Services = () => {
title="No services found"
description={searchTerm || typeFilter !== 'all' || statusFilter !== 'all'
? 'Try adjusting your filters'
- : 'Deploy your first service to get started'}
+ : 'Connect a repository or install a template to get started'}
action={!searchTerm && typeFilter === 'all' && statusFilter === 'all' && (
<Button asChild>
- <Link to="/templates">Create Service</Link>
+ <Link to="/services/new">Create Service</Link>
</Button>
)}
/>
@@ -484,8 +481,8 @@ function ServiceTypeIcon({ type }) {
function extractRepoName(url) {
if (!url) return '';
try {
- const cleaned = url.replace(/\.git$/, '');
- const parts = cleaned.split('/');
+ const cleaned = url.replace(/\.git$/, '').replace(/^https?:\/\/[^@]+@/, 'https://');
+ const parts = cleaned.split(/[/:]/).filter(Boolean);
return parts.slice(-2).join('/');
} catch {
return url;
diff --git a/frontend/src/services/api/apps.js b/frontend/src/services/api/apps.js
index 86165554..aa2fa4fa 100644
--- a/frontend/src/services/api/apps.js
+++ b/frontend/src/services/api/apps.js
@@ -17,6 +17,13 @@ export async function createApp(appData) {
});
}
+export async function createAppFromRepository(appData) {
+ return this.request('/apps/from-repository', {
+ method: 'POST',
+ body: appData,
+ });
+}
+
export async function updateApp(id, appData) {
return this.request(`/apps/${id}`, {
method: 'PUT',
diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scss
index 485deb09..58190562 100644
--- a/frontend/src/styles/main.scss
+++ b/frontend/src/styles/main.scss
@@ -93,6 +93,7 @@
@import 'pages/_email';
@import 'pages/_setup-wizard';
@import 'pages/_migration-wizard';
+@import 'pages/_new-service';
@import 'pages/_services';
@import 'pages/_service-detail';
@import 'pages/_fleet-monitor';
diff --git a/frontend/src/styles/pages/_new-service.scss b/frontend/src/styles/pages/_new-service.scss
new file mode 100644
index 00000000..e31c7dd2
--- /dev/null
+++ b/frontend/src/styles/pages/_new-service.scss
@@ -0,0 +1,321 @@
+// ============================================
+// NEW SERVICE PAGE
+// ============================================
+
+.new-service-page {
+ max-width: 1200px;
+
+ &__breadcrumb {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ margin-bottom: $space-4;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+
+ a {
+ color: $text-secondary;
+ text-decoration: none;
+
+ &:hover {
+ color: $text-primary;
+ }
+ }
+ }
+
+ &__header {
+ display: flex;
+ justify-content: space-between;
+ gap: $space-4;
+ margin-bottom: $space-5;
+
+ h1 {
+ margin: 0;
+ color: $text-primary;
+ font-size: $font-size-2xl;
+ font-weight: $font-weight-bold;
+ }
+
+ p {
+ margin: $space-1 0 0;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ }
+ }
+
+ &__source-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: $space-3;
+ margin-bottom: $space-4;
+ }
+
+ &__source-card {
+ display: grid;
+ grid-template-columns: auto minmax(0, 1fr) auto;
+ align-items: center;
+ gap: $space-3;
+ min-height: 74px;
+ padding: $space-4;
+ background: $bg-card;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-lg;
+ color: $text-primary;
+ text-align: left;
+ text-decoration: none;
+ transition: border-color $transition-fast, background $transition-fast, transform $transition-fast;
+
+ &:hover {
+ background: $bg-hover;
+ border-color: $border-default;
+ transform: translateY(-1px);
+ }
+
+ &--active {
+ border-color: rgba(45, 212, 191, 0.45);
+ background: linear-gradient(135deg, rgba(45, 212, 191, 0.09), rgba(99, 102, 241, 0.08));
+ }
+
+ strong,
+ small {
+ display: block;
+ }
+
+ strong {
+ font-size: $font-size-sm;
+ font-weight: $font-weight-semibold;
+ }
+
+ small {
+ margin-top: 2px;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ line-height: 1.4;
+ }
+ }
+
+ &__source-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 36px;
+ height: 36px;
+ border-radius: $radius-lg;
+ background: $bg-elevated;
+ color: $accent-primary;
+ }
+
+ &__layout {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
+ gap: $space-4;
+ align-items: start;
+ }
+
+ &__panel {
+ background: $bg-card;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-lg;
+ }
+
+ &__form {
+ display: grid;
+ gap: $space-5;
+ padding: $space-5;
+ }
+
+ &__section {
+ display: grid;
+ gap: $space-4;
+ }
+
+ &__section-heading {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+
+ svg {
+ color: $accent-primary;
+ }
+
+ h2 {
+ margin: 0;
+ color: $text-primary;
+ font-size: $font-size-base;
+ font-weight: $font-weight-semibold;
+ }
+ }
+
+ &__field {
+ display: grid;
+ gap: $space-2;
+
+ label {
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+ }
+
+ input,
+ select {
+ min-height: 40px;
+ width: 100%;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ color: $text-primary;
+ font-size: $font-size-sm;
+
+ &:focus {
+ outline: none;
+ border-color: $accent-primary;
+ box-shadow: 0 0 0 3px $accent-glow;
+ }
+ }
+
+ select {
+ padding: 0 $space-3;
+ cursor: pointer;
+ }
+ }
+
+ &__hint {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ line-height: 1.45;
+ }
+
+ &__two-col {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: $space-4;
+ }
+
+ &__toggle {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-4;
+ min-height: 72px;
+ padding: $space-3;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+
+ label,
+ span {
+ display: block;
+ }
+
+ label {
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+ }
+
+ span {
+ margin-top: 3px;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ line-height: 1.4;
+ }
+ }
+
+ &__actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: $space-2;
+ padding-top: $space-1;
+ }
+
+ &__aside {
+ display: grid;
+ gap: $space-5;
+ padding: $space-5;
+ position: sticky;
+ top: $space-4;
+ }
+
+ &__aside-block {
+ display: grid;
+ gap: $space-3;
+
+ h2 {
+ margin: 0;
+ color: $text-primary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-semibold;
+ }
+ }
+
+ &__flow {
+ display: grid;
+ grid-template-columns: 1fr auto 1fr auto 1fr;
+ align-items: center;
+ gap: $space-2;
+ color: $text-tertiary;
+
+ > div {
+ display: grid;
+ place-items: center;
+ gap: $space-2;
+ min-height: 70px;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ color: $text-secondary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+ }
+ }
+
+ &__note {
+ display: flex;
+ align-items: flex-start;
+ gap: $space-2;
+ padding: $space-3;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ line-height: 1.45;
+
+ svg {
+ margin-top: 2px;
+ color: $text-secondary;
+ flex-shrink: 0;
+ }
+ }
+}
+
+@media (max-width: $breakpoint-lg) {
+ .new-service-page {
+ &__layout {
+ grid-template-columns: 1fr;
+ }
+
+ &__aside {
+ position: static;
+ }
+ }
+}
+
+@media (max-width: $breakpoint-md) {
+ .new-service-page {
+ &__source-grid,
+ &__two-col {
+ grid-template-columns: 1fr;
+ }
+
+ &__actions {
+ flex-direction: column-reverse;
+
+ .btn,
+ button,
+ a {
+ width: 100%;
+ }
+ }
+ }
+}
diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scss
index f3d47464..96d526d3 100644
--- a/frontend/src/styles/pages/_servers.scss
+++ b/frontend/src/styles/pages/_servers.scss
@@ -2849,6 +2849,504 @@
}
}
+// Servers workspace polish: match the Docker route's rail + work surface.
+.servers-page--ops {
+ height: 100%;
+ min-height: 0;
+ max-width: none;
+ margin: 0;
+ padding: $space-3;
+ display: flex;
+ background: transparent;
+
+ .servers-ops-workspace {
+ flex: 1;
+ min-height: 0;
+ display: grid;
+ grid-template-columns: 252px minmax(0, 1fr);
+ gap: $space-3;
+ overflow: hidden;
+ }
+
+ .servers-fleet-rail {
+ display: flex;
+ flex-direction: column;
+ gap: $space-2;
+ min-height: 0;
+ overflow-y: auto;
+ scrollbar-width: thin;
+
+ &::-webkit-scrollbar { width: 4px; }
+ &::-webkit-scrollbar-thumb {
+ background: $border-default;
+ border-radius: $radius-sm;
+ }
+ }
+
+ .servers-rail-section {
+ background: $bg-card;
+ border: 1px solid $border-default;
+ border-radius: $radius-lg;
+ overflow: hidden;
+ flex-shrink: 0;
+ }
+
+ .servers-rail-section-header {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ padding: $space-3;
+ background: $bg-elevated;
+ border-bottom: 1px solid $border-subtle;
+ color: $text-primary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+
+ svg {
+ color: $accent-primary;
+ flex-shrink: 0;
+ }
+
+ &--split {
+ justify-content: space-between;
+
+ > span {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-2;
+ min-width: 0;
+ }
+
+ button {
+ border: 0;
+ background: transparent;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ cursor: pointer;
+
+ &:hover {
+ color: $accent-primary;
+ }
+ }
+ }
+ }
+
+ .servers-rail-section--health {
+ padding-bottom: $space-3;
+ }
+
+ .servers-health-dial {
+ position: relative;
+ width: 92px;
+ height: 92px;
+ margin: $space-4 auto $space-3;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 2px;
+ border-radius: $radius-full;
+ background: conic-gradient($success var(--availability), $bg-tertiary 0);
+
+ &::before {
+ content: '';
+ position: absolute;
+ inset: 8px;
+ border-radius: inherit;
+ background: $bg-card;
+ border: 1px solid $border-subtle;
+ }
+
+ strong,
+ span {
+ position: relative;
+ z-index: 1;
+ }
+
+ strong {
+ color: $text-primary;
+ font-family: $font-mono;
+ font-size: $font-size-xl;
+ line-height: 1;
+ }
+
+ span {
+ color: $text-tertiary;
+ font-size: 10px;
+ }
+ }
+
+ .servers-health-summary {
+ display: grid;
+ gap: 2px;
+ padding: 0 $space-3;
+ text-align: center;
+
+ strong {
+ color: $text-primary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-semibold;
+ }
+
+ span {
+ color: $text-tertiary;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ }
+ }
+
+ .servers-status-nav,
+ .servers-group-nav {
+ display: grid;
+ gap: 2px;
+ padding: $space-2;
+ }
+
+ .servers-status-nav-item,
+ .servers-group-nav-item {
+ width: 100%;
+ min-height: 36px;
+ display: grid;
+ grid-template-columns: 18px minmax(0, 1fr) auto;
+ align-items: center;
+ gap: $space-2;
+ padding: 0 $space-2;
+ border: 1px solid transparent;
+ border-radius: $radius-md;
+ background: transparent;
+ color: $text-secondary;
+ text-align: left;
+ cursor: pointer;
+ @include transition(all);
+
+ svg {
+ color: $text-tertiary;
+ flex-shrink: 0;
+ }
+
+ span {
+ min-width: 0;
+ @include truncate();
+ }
+
+ b {
+ min-width: 26px;
+ padding: 1px 7px;
+ border-radius: $radius-full;
+ background: $bg-tertiary;
+ color: $text-tertiary;
+ font-family: $font-mono;
+ font-size: 10px;
+ font-weight: $font-weight-medium;
+ text-align: center;
+ }
+
+ &:hover {
+ background: $bg-hover;
+ color: $text-primary;
+ }
+
+ &.active {
+ background: $accent-glow;
+ border-color: rgba($accent-primary-raw, 0.28);
+ color: $accent-primary;
+
+ svg { color: $accent-primary; }
+
+ b {
+ background: rgba($accent-primary-raw, 0.18);
+ color: $accent-primary;
+ }
+ }
+ }
+
+ .servers-status-nav-item {
+ min-height: 44px;
+
+ span {
+ display: flex;
+ flex-direction: column;
+ gap: 1px;
+ }
+
+ strong {
+ color: inherit;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+ @include truncate();
+ }
+
+ small {
+ color: $text-tertiary;
+ font-size: 10px;
+ @include truncate();
+ }
+
+ &--online svg { color: $success; }
+ &--offline svg { color: $danger; }
+ &--connecting svg { color: $warning; }
+ &--pending svg { color: $text-tertiary; }
+ }
+
+ .servers-main {
+ min-width: 0;
+ min-height: 0;
+ display: flex;
+ flex-direction: column;
+ gap: $space-2;
+ }
+
+ .servers-workbar {
+ min-height: 46px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-3;
+ padding: $space-2;
+ background: $bg-card;
+ border: 1px solid $border-default;
+ border-radius: $radius-lg;
+ flex-shrink: 0;
+ }
+
+ .servers-workbar-title {
+ min-width: 0;
+ display: flex;
+ align-items: baseline;
+ gap: $space-2;
+
+ span {
+ color: $text-tertiary;
+ font-size: 10px;
+ font-weight: $font-weight-semibold;
+ text-transform: uppercase;
+ }
+
+ h1 {
+ margin: 0;
+ color: $text-primary;
+ font-size: $font-size-base;
+ font-weight: $font-weight-semibold;
+ line-height: 1.2;
+ }
+
+ em {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-style: normal;
+ @include truncate();
+ }
+ }
+
+ .servers-workbar-actions {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ flex-wrap: wrap;
+
+ .btn,
+ button {
+ min-height: 32px;
+ }
+ }
+
+ .servers-command-bar {
+ margin: 0;
+ padding: $space-2;
+ border: 1px solid $border-default;
+ border-radius: $radius-lg;
+ background: $bg-card;
+ box-shadow: none;
+ backdrop-filter: none;
+ flex-shrink: 0;
+ }
+
+ .servers-toolbar {
+ min-width: min(460px, 100%);
+ flex: 1;
+ gap: $space-2;
+ }
+
+ .search-box {
+ width: min(460px, 100%);
+ height: 34px;
+ border-radius: $radius-md;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+
+ svg {
+ color: $text-tertiary;
+ left: $space-3;
+ }
+
+ input {
+ height: 100%;
+ border: 0;
+ background: transparent;
+ color: $text-primary;
+ font-size: $font-size-xs;
+ }
+ }
+
+ .servers-results-summary {
+ padding: 0 $space-2;
+ min-height: 32px;
+ border: 0;
+ background: transparent;
+ color: $text-tertiary;
+ flex-shrink: 0;
+
+ strong {
+ color: $text-primary;
+ font-family: $font-mono;
+ font-size: $font-size-sm;
+ }
+ }
+
+ .servers-clear-filters {
+ border-radius: $radius-md;
+ }
+
+ .servers-bulk-bar {
+ margin: 0;
+ border-radius: $radius-lg;
+ box-shadow: none;
+ flex-shrink: 0;
+ }
+
+ .servers-table-wrap {
+ flex: 1;
+ min-height: 0;
+ overflow: auto;
+ border-color: $border-default;
+ border-radius: $radius-lg;
+ box-shadow: none;
+ }
+
+ .servers-table {
+ min-width: 1040px;
+
+ thead th {
+ background: $bg-elevated;
+ letter-spacing: 0;
+ }
+
+ tbody tr {
+ background: $bg-card;
+ }
+ }
+
+ .servers-empty-workspace {
+ flex: 1;
+ min-height: 360px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: $space-3;
+ padding: $space-6;
+ border: 1px solid $border-default;
+ border-radius: $radius-lg;
+ background:
+ linear-gradient(180deg, rgba($accent-primary-raw, 0.06), transparent 42%),
+ $bg-card;
+ text-align: center;
+
+ h2 {
+ margin: 0;
+ color: $text-primary;
+ font-size: $font-size-xl;
+ font-weight: $font-weight-semibold;
+ }
+
+ p {
+ max-width: 420px;
+ margin: 0;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ line-height: $line-height-relaxed;
+ }
+ }
+
+ .servers-empty-workspace__icon {
+ width: 58px;
+ height: 58px;
+ display: grid;
+ place-items: center;
+ border-radius: $radius-lg;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ color: $accent-primary;
+ }
+
+ .servers-empty-workspace__actions {
+ display: flex;
+ justify-content: center;
+ gap: $space-2;
+ flex-wrap: wrap;
+ }
+
+ @media (max-width: $breakpoint-lg) {
+ height: auto;
+ min-height: 100vh;
+ overflow: auto;
+
+ .servers-ops-workspace {
+ grid-template-columns: 1fr;
+ overflow: visible;
+ }
+
+ .servers-fleet-rail {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ overflow: visible;
+ }
+
+ .servers-rail-section--health {
+ grid-column: 1 / -1;
+ }
+
+ .servers-main {
+ min-height: 620px;
+ }
+ }
+
+ @media (max-width: $breakpoint-sm) {
+ padding: $space-2;
+
+ .servers-fleet-rail {
+ grid-template-columns: 1fr;
+ }
+
+ .servers-workbar,
+ .servers-command-bar {
+ align-items: stretch;
+ flex-direction: column;
+ }
+
+ .servers-workbar-title {
+ flex-wrap: wrap;
+ }
+
+ .servers-workbar-actions {
+ width: 100%;
+
+ > * {
+ flex: 1;
+ }
+ }
+
+ .servers-toolbar,
+ .search-box {
+ width: 100%;
+ }
+
+ .servers-results-summary {
+ justify-content: space-between;
+ }
+ }
+}
+
.btn-ghost {
background: transparent;
border: 1px solid transparent;