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.

Agent key migration, DB fix, UI tabs/page cleanup

Juan Denis8ea0586d8842
diff --git a/.gitignore b/.gitignore
index 612f17d3..51782179 100644
--- a/.gitignore
+++ b/.gitignore
@@ -107,3 +107,4 @@ APP_IMPROVEMENTS.md
# in so CI builds don't have to install cairo/Pillow.
!agent/internal/setupui/serverkit.ico
!agent/internal/setupui/serverkit_header.png
+docs/PLAN_AGENT_FLEET.md
diff --git a/agent/cmd/agent/main.go b/agent/cmd/agent/main.go
index 32e36b30..f37075c4 100644
--- a/agent/cmd/agent/main.go
+++ b/agent/cmd/agent/main.go
@@ -297,6 +297,18 @@ func agentMainLoop(parentCtx context.Context) error {
"mode", map[bool]string{true: "service", false: "cli"}[isWindowsService()],
)
+ // Loud warning if credentials failed to decrypt. Without surfacing
+ // this, the agent would proceed with empty APIKey/APISecret and
+ // every panel /connect would 400 "Missing required fields" — which
+ // is exactly the silent failure mode that hid this bug for years.
+ if cfg.Auth.LoadError != "" && cfg.Agent.ID != "" {
+ log.Error("Failed to load credentials — agent cannot authenticate. "+
+ "Re-pair the agent (Actions → Open wizard) to regenerate the key file.",
+ "error", cfg.Auth.LoadError,
+ "key_file", cfg.Auth.KeyFile,
+ )
+ }
+
// Single-instance enforcement for the service. Multiple "start"
// invocations would fight for IPC port 19780 and the SCM-launched
// service would lose to a manually-started one (or vice versa) with
diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go
index 019b63c3..a943b14c 100644
--- a/agent/internal/config/config.go
+++ b/agent/internal/config/config.go
@@ -50,6 +50,11 @@ type AuthConfig struct {
KeyFile string `yaml:"key_file"`
APIKey string `yaml:"api_key,omitempty"` // Not saved to config file
APISecret string `yaml:"api_secret,omitempty"` // Not saved to config file
+ // LoadError is populated by Load() when LoadCredentials() failed.
+ // Surfaced in agent startup logs so "service runs but every /connect
+ // returns 400 missing fields" reports become trivial to diagnose
+ // (means the key file couldn't be decrypted under any known key).
+ LoadError string `yaml:"-"`
}
// FeaturesConfig controls enabled features
@@ -180,10 +185,14 @@ func Load(path string) (*Config, error) {
return nil, fmt.Errorf("failed to parse config: %w", err)
}
- // Load credentials from secure storage
+ // Load credentials from secure storage. We don't fail loading the
+ // config if creds are missing — that's normal pre-pairing — but we
+ // stash the error on the config so callers running with cfg.Agent.ID
+ // set (i.e. should-be-paired) can detect "creds went missing"
+ // scenarios that would otherwise silently produce empty auth fields
+ // and 400s on every connect attempt.
if err := cfg.LoadCredentials(); err != nil {
- // Credentials may not exist yet (before registration)
- // This is not an error
+ cfg.Auth.LoadError = err.Error()
}
return cfg, nil
@@ -263,7 +272,12 @@ func (c *Config) SaveCredentials() error {
return nil
}
-// LoadCredentials loads API credentials from secure storage
+// LoadCredentials loads API credentials from secure storage. Tries the
+// current key derivation first, then falls back to the legacy (pre-1.6.14)
+// key that included USERNAME. If the legacy key is what worked, we
+// transparently re-encrypt under the current scheme so the next load
+// uses the host-stable key — required for the SCM-launched service
+// (running as SYSTEM) to read credentials paired by a user-context wizard.
func (c *Config) LoadCredentials() error {
keyPath := c.Auth.KeyFile
if keyPath == "" {
@@ -275,8 +289,7 @@ func (c *Config) LoadCredentials() error {
return fmt.Errorf("failed to read key file: %w", err)
}
- // Decrypt credentials
- decrypted, err := decryptCredentials(data)
+ decrypted, usedLegacy, err := decryptCredentialsWithMigration(data)
if err != nil {
return fmt.Errorf("failed to decrypt credentials: %w", err)
}
@@ -296,6 +309,13 @@ func (c *Config) LoadCredentials() error {
c.Auth.APIKey = apiKey
c.Auth.APISecret = apiSecret
+ // Migrate creds onto the host-only key so the next service start
+ // (which may run as a different user / SYSTEM) can decrypt them.
+ // Best-effort: failure here doesn't block this run.
+ if usedLegacy {
+ _ = c.SaveCredentials()
+ }
+
return nil
}
@@ -335,10 +355,17 @@ func defaultAllowedPaths() []string {
return []string{"/var/lib/serverkit", "/var/serverkit"}
}
-// getMachineKey generates a machine-specific encryption key
+// getMachineKey generates a machine-specific encryption key.
+//
+// Stable across user contexts on the same host. The previous derivation
+// included USERNAME, which meant credentials encrypted by a user-context
+// pairing wizard (juanh) were undecryptable by the SYSTEM-context service
+// — agent service started up with empty credentials, every /connect
+// returned 400 "Missing required fields". This was masked for years
+// because the agent was never actually running as a real Windows service
+// (the SCM dispatcher only landed in 1.6.13). Now that it is, the key
+// must be host-stable, not user-stable.
func getMachineKey() []byte {
- // Use machine-specific data to derive key
- // This makes the credentials only decryptable on this machine
hostname, _ := os.Hostname()
var machineID string
@@ -348,7 +375,28 @@ func getMachineKey() []byte {
machineID = string(data)
}
} else if runtime.GOOS == "windows" {
- // On Windows, use a combination of hostname and username
+ machineID = os.Getenv("COMPUTERNAME")
+ }
+
+ combined := fmt.Sprintf("serverkit-agent:%s:%s", hostname, machineID)
+ hash := sha256.Sum256([]byte(combined))
+ return hash[:]
+}
+
+// getMachineKeyLegacyV1 is the pre-1.6.14 derivation (Windows: included
+// USERNAME). Kept solely so already-paired agents can decrypt their old
+// key file once, re-encrypt under the stable v2 key, and never need it
+// again. Drop after a few releases.
+func getMachineKeyLegacyV1() []byte {
+ hostname, _ := os.Hostname()
+
+ var machineID string
+ if runtime.GOOS == "linux" {
+ data, err := os.ReadFile("/etc/machine-id")
+ if err == nil {
+ machineID = string(data)
+ }
+ } else if runtime.GOOS == "windows" {
machineID = os.Getenv("COMPUTERNAME") + os.Getenv("USERNAME")
}
@@ -379,31 +427,46 @@ func encryptCredentials(plaintext []byte) ([]byte, error) {
return []byte(base64.StdEncoding.EncodeToString(ciphertext)), nil
}
+// decryptCredentials tries the current (host-only) machine key first,
+// then falls back to the legacy v1 key (host + username) so credentials
+// paired before 1.6.14 still load. The bool return indicates whether the
+// legacy fallback was used — callers re-encrypt under the stable v2 key
+// so the migration only happens once.
func decryptCredentials(data []byte) ([]byte, error) {
- key := getMachineKey()
+ plaintext, _, err := decryptCredentialsWithMigration(data)
+ return plaintext, err
+}
+func decryptCredentialsWithMigration(data []byte) (plaintext []byte, usedLegacy bool, err error) {
ciphertext, err := base64.StdEncoding.DecodeString(string(data))
if err != nil {
- return nil, err
+ return nil, false, err
}
+ if pt, err2 := tryDecrypt(ciphertext, getMachineKey()); err2 == nil {
+ return pt, false, nil
+ }
+ if pt, err2 := tryDecrypt(ciphertext, getMachineKeyLegacyV1()); err2 == nil {
+ return pt, true, nil
+ }
+ return nil, false, fmt.Errorf("decryption failed with both current and legacy machine keys")
+}
+
+func tryDecrypt(ciphertext, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
-
gcm, err := cipher.NewGCM(block)
if err != nil {
return nil, err
}
-
nonceSize := gcm.NonceSize()
if len(ciphertext) < nonceSize {
return nil, fmt.Errorf("ciphertext too short")
}
-
- nonce, ciphertext := ciphertext[:nonceSize], ciphertext[nonceSize:]
- return gcm.Open(nil, nonce, ciphertext, nil)
+ nonce, body := ciphertext[:nonceSize], ciphertext[nonceSize:]
+ return gcm.Open(nil, nonce, body, nil)
}
func splitFirst(s string, sep byte) []string {
diff --git a/backend/app/models/server.py b/backend/app/models/server.py
index 81c3830d..38945b2f 100644
--- a/backend/app/models/server.py
+++ b/backend/app/models/server.py
@@ -361,7 +361,13 @@ class ServerMetrics(db.Model):
"""Historical metrics from servers"""
__tablename__ = 'server_metrics'
- id = db.Column(db.BigInteger, primary_key=True, autoincrement=True)
+ # SQLite only autoincrements when the column type is exactly INTEGER
+ # PRIMARY KEY (rowid alias). With BigInteger every insert failed with
+ # "NOT NULL constraint failed: server_metrics.id" and no metrics ever
+ # got stored — exactly the silent dashboard-zeroes symptom we just
+ # tracked down. Integer caps at ~2.1B rows which at 1 sample/sec is
+ # ~68 years per server, plenty.
+ id = db.Column(db.Integer, primary_key=True, autoincrement=True)
server_id = db.Column(db.String(36), db.ForeignKey('servers.id'), nullable=False, index=True)
timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
diff --git a/backend/app/services/agent_registry.py b/backend/app/services/agent_registry.py
index af6efa9f..4248a3a2 100644
--- a/backend/app/services/agent_registry.py
+++ b/backend/app/services/agent_registry.py
@@ -94,6 +94,13 @@ class AgentRegistry:
self._lock = threading.Lock()
# SocketIO instance (set by init_socketio)
self._socketio = None
+ # Flask app, captured so background threads can re-enter the
+ # app context. Without this, _handle_agent_timeout (and any
+ # other DB-touching code in _check_heartbeats) raises
+ # "Working outside of application context" the moment it tries
+ # to query — which is why timed-out agents stayed stuck at
+ # status=connecting in the DB instead of flipping to offline.
+ self._app = None
# Heartbeat check thread
self._heartbeat_thread = None
self._stop_heartbeat = threading.Event()
@@ -101,6 +108,17 @@ class AgentRegistry:
def init_socketio(self, socketio):
"""Initialize with SocketIO instance"""
self._socketio = socketio
+ # Capture the current Flask app reference for the background
+ # heartbeat thread. current_app is a context-local proxy and
+ # only works inside a request/app context, but flask.current_app._get_current_object()
+ # gives us the underlying object we can stash.
+ from flask import current_app
+ try:
+ self._app = current_app._get_current_object()
+ except RuntimeError:
+ # Called outside an app context (e.g. during testing) —
+ # heartbeat checker will skip DB operations gracefully.
+ self._app = None
# Start heartbeat checker
self._start_heartbeat_checker()
@@ -129,8 +147,21 @@ class AgentRegistry:
if now - agent.last_heartbeat > timeout:
dead_agents.append(server_id)
- for server_id in dead_agents:
- self._handle_agent_timeout(server_id)
+ # Wrap DB access in an app context — the timeout
+ # handler queries Server / AgentSession and commits.
+ # In a thread there's no implicit context.
+ if dead_agents and self._app is not None:
+ with self._app.app_context():
+ for server_id in dead_agents:
+ self._handle_agent_timeout(server_id)
+ elif dead_agents:
+ # No app captured (test environment); just remove
+ # from in-memory registry without touching DB.
+ for server_id in dead_agents:
+ with self._lock:
+ agent = self._agents.pop(server_id, None)
+ if agent:
+ self._socket_to_server.pop(agent.socket_id, None)
except Exception as e:
logger.error("Error in heartbeat checker: %s", e)
diff --git a/frontend/src/components/ui/tabs.jsx b/frontend/src/components/ui/tabs.jsx
index 8f42eb11..28383826 100644
--- a/frontend/src/components/ui/tabs.jsx
+++ b/frontend/src/components/ui/tabs.jsx
@@ -7,12 +7,7 @@ const Tabs = TabsPrimitive.Root;
const TabsList = React.forwardRef(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
- className={cn(
- // Underline-style tab bar — scrollable, no pill background
- 'flex items-center gap-1 border-b border-border mb-6',
- 'overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
- className
- )}
+ className={cn('tabs', className)}
{...props}
/>
));
@@ -21,22 +16,7 @@ TabsList.displayName = TabsPrimitive.List.displayName;
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
- className={cn(
- // Base styles
- 'inline-flex items-center gap-2 bg-transparent border-none',
- 'px-4 py-2.5 text-sm font-medium text-muted-foreground whitespace-nowrap',
- 'border-b-2 border-transparent -mb-px',
- 'transition-colors cursor-pointer',
- // Hover
- 'hover:text-foreground',
- // Active — accent underline, matches original .tab.active
- 'data-[state=active]:text-primary data-[state=active]:border-primary',
- // Focus
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:rounded-sm',
- // Disabled
- 'disabled:pointer-events-none disabled:opacity-50',
- className
- )}
+ className={cn('tab', className)}
{...props}
/>
));
@@ -45,10 +25,7 @@ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
const TabsContent = React.forwardRef(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
- className={cn(
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:rounded-sm',
- className
- )}
+ className={cn('tab-content-pane', className)}
{...props}
/>
));
diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsx
index 261c256e..a583ed74 100644
--- a/frontend/src/pages/AgentFleet.jsx
+++ b/frontend/src/pages/AgentFleet.jsx
@@ -31,6 +31,7 @@ import { StatCard, StatsGrid } from '../components/StatCard';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
const AgentFleet = () => {
const [activeTab, setActiveTab] = useState('dashboard');
@@ -209,8 +210,8 @@ const AgentFleet = () => {
</div>
</div>
- <div className="tabs-container">
- <div className="tabs">
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
{[
{ key: 'dashboard', icon: Activity, label: 'Dashboard' },
{ key: 'versions', icon: Package, label: 'Versions' },
@@ -219,11 +220,7 @@ const AgentFleet = () => {
{ key: 'discovery', icon: Search, label: 'Discovery' },
{ key: 'approvals', icon: Shield, label: 'Approvals' },
].map(tab => (
- <button
- key={tab.key}
- className={`tab ${activeTab === tab.key ? 'active' : ''}`}
- onClick={() => setActiveTab(tab.key)}
- >
+ <TabsTrigger key={tab.key} value={tab.key}>
<tab.icon size={18} />
{tab.label}
{tab.key === 'approvals' && pendingServers.length > 0 && (
@@ -232,10 +229,10 @@ const AgentFleet = () => {
{tab.key === 'queue' && queuedCommands.length > 0 && (
<Badge variant="warning" className="ml-2">{queuedCommands.length}</Badge>
)}
- </button>
+ </TabsTrigger>
))}
- </div>
- </div>
+ </TabsList>
+ </Tabs>
<div className="tab-content mt-6">
{/* ==================== Dashboard ==================== */}
diff --git a/frontend/src/pages/AgentPlugins.jsx b/frontend/src/pages/AgentPlugins.jsx
index add23394..fc608e86 100644
--- a/frontend/src/pages/AgentPlugins.jsx
+++ b/frontend/src/pages/AgentPlugins.jsx
@@ -120,7 +120,7 @@ const AgentPlugins = () => {
if (loading) return <Spinner />;
return (
- <div className="agent-plugins-page">
+ <div className="page-container agent-plugins-page">
<div className="page-header">
<div className="page-header-content">
<h1>Agent Plugins</h1>
diff --git a/frontend/src/pages/ApplicationDetail.jsx b/frontend/src/pages/ApplicationDetail.jsx
index 1cab4ed9..962b7963 100644
--- a/frontend/src/pages/ApplicationDetail.jsx
+++ b/frontend/src/pages/ApplicationDetail.jsx
@@ -116,7 +116,7 @@ const ApplicationDetail = () => {
const isRunning = app.status === 'running';
return (
- <div className="app-detail-page">
+ <div className="page-container app-detail-page">
{/* Top Bar with Breadcrumbs and Actions */}
<div className="app-detail-topbar">
<div className="app-detail-breadcrumbs">
@@ -201,7 +201,7 @@ const ApplicationDetail = () => {
{/* Tabs */}
<Tabs value={activeTab} onValueChange={setActiveTab}>
- <TabsList className="app-detail-tabs">
+ <TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="environment">Environment</TabsTrigger>
{isPythonApp && (
diff --git a/frontend/src/pages/Applications.jsx b/frontend/src/pages/Applications.jsx
index de559f4b..5af3a19f 100644
--- a/frontend/src/pages/Applications.jsx
+++ b/frontend/src/pages/Applications.jsx
@@ -141,7 +141,7 @@ const Applications = () => {
}
return (
- <div className="docker-page-new">
+ <div className="page-container docker-page-new">
<div className="docker-page-header">
<div className="docker-page-title">
<h2>Applications</h2>
diff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsx
index dd84b1e8..3056aa12 100644
--- a/frontend/src/pages/Backups.jsx
+++ b/frontend/src/pages/Backups.jsx
@@ -365,7 +365,7 @@ const Backups = () => {
}
return (
- <div className="page backups-page">
+ <div className="page-container backups-page">
<div className="page-header">
<div>
<h1>Backups</h1>
diff --git a/frontend/src/pages/CloudProvision.jsx b/frontend/src/pages/CloudProvision.jsx
index ef917702..c3d6b46c 100644
--- a/frontend/src/pages/CloudProvision.jsx
+++ b/frontend/src/pages/CloudProvision.jsx
@@ -90,7 +90,7 @@ const CloudProvision = () => {
if (loading) return <Spinner />;
return (
- <div className="cloud-provision-page">
+ <div className="page-container cloud-provision-page">
<div className="page-header">
<div className="page-header-content">
<h1>Cloud Provisioning</h1>
diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsx
index b3daefbd..72b0501e 100644
--- a/frontend/src/pages/CronJobs.jsx
+++ b/frontend/src/pages/CronJobs.jsx
@@ -192,7 +192,7 @@ const CronJobs = () => {
}
return (
- <div className="page cron-page">
+ <div className="page-container cron-page">
<div className="page-header">
<div>
<h1>Cron Jobs</h1>
diff --git a/frontend/src/pages/DNSZones.jsx b/frontend/src/pages/DNSZones.jsx
index 2343899e..f059bac8 100644
--- a/frontend/src/pages/DNSZones.jsx
+++ b/frontend/src/pages/DNSZones.jsx
@@ -173,7 +173,7 @@ const DNSZones = () => {
if (loading) return <Spinner />;
return (
- <div className="dns-zones-page">
+ <div className="page-container dns-zones-page">
<div className="page-header">
<div className="page-header-content">
<h1>DNS Zones</h1>
diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx
index 46d59db2..1ef159de 100644
--- a/frontend/src/pages/Dashboard.jsx
+++ b/frontend/src/pages/Dashboard.jsx
@@ -232,7 +232,7 @@ const Dashboard = () => {
}
return (
- <div className="dashboard-page">
+ <div className="page-container dashboard-page">
{/* Top Bar */}
<div className="top-bar">
<div className="server-identity">
diff --git a/frontend/src/pages/Databases.jsx b/frontend/src/pages/Databases.jsx
index 27659dbe..8efc707c 100644
--- a/frontend/src/pages/Databases.jsx
+++ b/frontend/src/pages/Databases.jsx
@@ -43,7 +43,7 @@ const Databases = () => {
}
return (
- <div>
+ <div className="page-container">
<header className="top-bar">
<div>
<h1>Databases</h1>
diff --git a/frontend/src/pages/Docker.jsx b/frontend/src/pages/Docker.jsx
index 3db66891..6420690d 100644
--- a/frontend/src/pages/Docker.jsx
+++ b/frontend/src/pages/Docker.jsx
@@ -166,7 +166,7 @@ const Docker = () => {
if (!dockerStatus?.installed) {
return (
- <div className="page docker-page">
+ <div className="page-container docker-page">
<div className="page-header">
<div className="page-header-content">
<h1>Docker</h1>
@@ -233,7 +233,7 @@ const Docker = () => {
return (
<ServerContext.Provider value={serverContextValue}>
- <div className="docker-page-new">
+ <div className="page-container docker-page-new">
<div className="docker-page-header">
<div className="docker-page-title">
<h2>Docker Management</h2>
diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsx
index b8b57d17..5134cc4f 100644
--- a/frontend/src/pages/Domains.jsx
+++ b/frontend/src/pages/Domains.jsx
@@ -160,7 +160,7 @@ const Domains = () => {
}
return (
- <div>
+ <div className="page-container">
<header className="top-bar">
<div>
<h1>Domains & SSL</h1>
diff --git a/frontend/src/pages/Downloads.jsx b/frontend/src/pages/Downloads.jsx
index 36614241..d9444682 100644
--- a/frontend/src/pages/Downloads.jsx
+++ b/frontend/src/pages/Downloads.jsx
@@ -139,7 +139,7 @@ function Downloads() {
if (loading) {
return (
- <div className="page downloads-page">
+ <div className="page-container downloads-page">
<div className="page-header">
<h1>Downloads</h1>
</div>
@@ -152,7 +152,7 @@ function Downloads() {
}
return (
- <div className="page downloads-page">
+ <div className="page-container downloads-page">
<div className="page-header">
<div className="page-header-content">
<h1>ServerKit Agent Downloads</h1>
diff --git a/frontend/src/pages/Email.jsx b/frontend/src/pages/Email.jsx
index d862c2a9..20c17fa2 100644
--- a/frontend/src/pages/Email.jsx
+++ b/frontend/src/pages/Email.jsx
@@ -453,7 +453,7 @@ function Email() {
// ── Render ──
- if (loading) return <div className="email-page"><div className="page-loading"><Spinner /></div></div>;
+ if (loading) return <div className="page-container email-page"><div className="page-loading"><Spinner /></div></div>;
const isInstalled = status?.installed;
@@ -481,7 +481,7 @@ function Email() {
);
return (
- <div className="email-page">
+ <div className="page-container email-page">
<div className="page-header">
<div className="page-header-content">
<h1>Email Server</h1>
diff --git a/frontend/src/pages/FTPServer.jsx b/frontend/src/pages/FTPServer.jsx
index e3178dcb..14f8985c 100644
--- a/frontend/src/pages/FTPServer.jsx
+++ b/frontend/src/pages/FTPServer.jsx
@@ -237,7 +237,7 @@ function FTPServer() {
const activeServer = status?.active_server;
return (
- <div className="ftp-server">
+ <div className="page-container ftp-server">
<div className="page-header">
<div className="page-header-content">
<h1>FTP Server</h1>
diff --git a/frontend/src/pages/Firewall.jsx b/frontend/src/pages/Firewall.jsx
index a607881d..2f63cbce 100644
--- a/frontend/src/pages/Firewall.jsx
+++ b/frontend/src/pages/Firewall.jsx
@@ -238,7 +238,7 @@ function Firewall() {
}
return (
- <div className="firewall-page">
+ <div className="page-container firewall-page">
<div className="page-header">
<div className="page-header-content">
<h1>Firewall</h1>
diff --git a/frontend/src/pages/FleetMonitor.jsx b/frontend/src/pages/FleetMonitor.jsx
index ee70a5d0..10a70623 100644
--- a/frontend/src/pages/FleetMonitor.jsx
+++ b/frontend/src/pages/FleetMonitor.jsx
@@ -23,6 +23,7 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
+import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Badge } from '@/components/ui/badge';
const CHART_COLORS = [
@@ -246,8 +247,8 @@ const FleetMonitor = () => {
</div>
</div>
- <div className="tabs-container">
- <div className="tabs">
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
{[
{ key: 'overview', icon: Layers, label: 'Overview' },
{ key: 'comparison', icon: BarChart3, label: 'Comparison' },
@@ -255,17 +256,13 @@ const FleetMonitor = () => {
{ key: 'anomalies', icon: TrendingUp, label: 'Anomalies & Forecast' },
{ key: 'search', icon: Search, label: 'Fleet Search' },
].map(tab => (
- <button
- key={tab.key}
- className={`tab ${activeTab === tab.key ? 'active' : ''}`}
- onClick={() => setActiveTab(tab.key)}
- >
+ <TabsTrigger key={tab.key} value={tab.key}>
<tab.icon size={18} />
{tab.label}
- </button>
+ </TabsTrigger>
))}
- </div>
- </div>
+ </TabsList>
+ </Tabs>
<div className="tab-content mt-6">
{/* ==================== Overview Heatmap ==================== */}
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index cc42b8a5..05f8403d 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -566,7 +566,7 @@ function Git() {
}
return (
- <div className="git-page">
+ <div className="page-container git-page">
<div className="page-header">
<div className="page-header-content">
<h1>Git Server</h1>
diff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsx
index 3cc54f31..4b1fa1c1 100644
--- a/frontend/src/pages/Marketplace.jsx
+++ b/frontend/src/pages/Marketplace.jsx
@@ -121,7 +121,7 @@ const Marketplace = () => {
const installedIds = new Set(myExtensions.map(e => e.extension_id));
return (
- <div className="marketplace-page">
+ <div className="page-container marketplace-page">
<div className="page-header">
<div className="page-header-content">
<h1>Marketplace</h1>
diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsx
index f0083a56..e9462215 100644
--- a/frontend/src/pages/Monitoring.jsx
+++ b/frontend/src/pages/Monitoring.jsx
@@ -149,7 +149,7 @@ const Monitoring = () => {
}
return (
- <div className="page monitoring-page">
+ <div className="page-container monitoring-page">
<div className="page-header">
<div>
<h1>Monitoring & Alerts</h1>
diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsx
index cd94bdd2..93c873c5 100644
--- a/frontend/src/pages/SSLCertificates.jsx
+++ b/frontend/src/pages/SSLCertificates.jsx
@@ -166,7 +166,7 @@ const SSLCertificates = () => {
if (loading) {
return (
- <div className="ssl-page">
+ <div className="page-container ssl-page">
<header className="top-bar">
<div>
<h1>SSL Certificates</h1>
@@ -204,7 +204,7 @@ const SSLCertificates = () => {
const certbotInstalled = status?.certbot_installed ?? false;
return (
- <div className="ssl-page">
+ <div className="page-container ssl-page">
<header className="top-bar">
<div>
<h1>SSL Certificates</h1>
diff --git a/frontend/src/pages/Security.jsx b/frontend/src/pages/Security.jsx
index 9bc9aa86..b486579d 100644
--- a/frontend/src/pages/Security.jsx
+++ b/frontend/src/pages/Security.jsx
@@ -47,7 +47,7 @@ const Security = () => {
}
return (
- <div className="page security-page">
+ <div className="page-container security-page">
<div className="page-header">
<div>
<h1>Security</h1>
@@ -56,7 +56,7 @@ const Security = () => {
</div>
<Tabs value={activeTab} onValueChange={setActiveTab}>
- <TabsList className="tabs-nav tabs-nav-scrollable">
+ <TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="firewall">Firewall</TabsTrigger>
<TabsTrigger value="fail2ban">Fail2ban</TabsTrigger>
diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsx
index 10a38104..43234801 100644
--- a/frontend/src/pages/ServerDetail.jsx
+++ b/frontend/src/pages/ServerDetail.jsx
@@ -166,7 +166,7 @@ const ServerDetail = () => {
];
return (
- <div className="server-detail-page">
+ <div className="page-container server-detail-page">
<div className="page-breadcrumb">
<Link to="/servers">Servers</Link>
<span className="breadcrumb-separator">/</span>
diff --git a/frontend/src/pages/ServerTemplates.jsx b/frontend/src/pages/ServerTemplates.jsx
index a2594de7..063311a8 100644
--- a/frontend/src/pages/ServerTemplates.jsx
+++ b/frontend/src/pages/ServerTemplates.jsx
@@ -126,7 +126,7 @@ const ServerTemplates = () => {
if (loading) return <Spinner />;
return (
- <div className="server-templates-page">
+ <div className="page-container server-templates-page">
<div className="page-header">
<div className="page-header-content">
<h1>Server Templates</h1>
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 809c2b24..68e9b0d7 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -180,7 +180,7 @@ const Servers = () => {
if (loading) {
return (
- <div className="servers-page servers-page--loading">
+ <div className="page-container servers-page servers-page--loading">
<div className="servers-loading-card">
<ServerIcon />
<span>Scanning fleet...</span>
@@ -194,7 +194,7 @@ const Servers = () => {
const someVisibleSelected = visibleIds.some(id => selectedIds.has(id));
return (
- <div className="servers-page">
+ <div className="page-container servers-page">
<header className="servers-header">
<div className="servers-header__title">
<h1>Servers</h1>
diff --git a/frontend/src/pages/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsx
index 13b617c6..e113a688 100644
--- a/frontend/src/pages/ServiceDetail.jsx
+++ b/frontend/src/pages/ServiceDetail.jsx
@@ -115,7 +115,7 @@ const ServiceDetail = () => {
const availableTabs = getTabsForType(service.app_type);
return (
- <div className="svc-detail">
+ <div className="page-container svc-detail">
{/* Breadcrumb */}
<div className="svc-detail__breadcrumb">
<Link to="/services">Services</Link>
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 46dd7945..16667083 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -134,7 +134,7 @@ const Services = () => {
}
return (
- <div className="services-page">
+ <div className="page-container services-page">
<div className="services-page__header">
<div>
<h1>Services</h1>
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index 35556f16..29f97ec4 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -38,7 +38,7 @@ const Settings = () => {
}, [isAdmin]);
return (
- <div className="page settings-page">
+ <div className="page-container settings-page">
<div className="page-header">
<div>
<h1>Settings</h1>
diff --git a/frontend/src/pages/StatusPages.jsx b/frontend/src/pages/StatusPages.jsx
index c9157803..3c2c1a10 100644
--- a/frontend/src/pages/StatusPages.jsx
+++ b/frontend/src/pages/StatusPages.jsx
@@ -118,7 +118,7 @@ const StatusPages = () => {
if (loading) return <Spinner />;
return (
- <div className="status-pages-page">
+ <div className="page-container status-pages-page">
<div className="page-header">
<div className="page-header-content">
<h1>Status Pages</h1>
diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsx
index 3293593d..a507b4b0 100644
--- a/frontend/src/pages/Templates.jsx
+++ b/frontend/src/pages/Templates.jsx
@@ -294,14 +294,14 @@ const Templates = () => {
if (loading) {
return (
- <div className="page">
+ <div className="page-container">
<div className="loading">Loading templates...</div>
</div>
);
}
return (
- <div className="page templates-page">
+ <div className="page-container templates-page">
<div className="page-header">
<h1>App Templates</h1>
<p className="page-description">One-click deployment for popular self-hosted applications</p>
diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsx
index 04989651..d4e177de 100644
--- a/frontend/src/pages/Terminal.jsx
+++ b/frontend/src/pages/Terminal.jsx
@@ -18,7 +18,7 @@ const Terminal = () => {
const [activeTab, setActiveTab] = useTabParam('/terminal', VALID_TABS);
return (
- <div className="page terminal-page">
+ <div className="page-container terminal-page">
<div className="page-header">
<div>
<h1>Terminal & Logs</h1>
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index da1eb2a5..9dc5c5af 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -64,7 +64,7 @@ function WordPress() {
if (loading) {
return (
- <div className="docker-page-new wordpress-page">
+ <div className="page-container wordpress-page">
<div className="page-header">
<div className="page-header-content">
<h1>WordPress</h1>
@@ -102,7 +102,7 @@ function WordPress() {
// Lite tier with no sites -> resource gate
if (sites.length === 0 && isLiteTier) {
return (
- <div className="docker-page-new wordpress-page">
+ <div className="page-container wordpress-page">
<ResourceGate feature="wordpress_create">
<div />
</ResourceGate>
@@ -111,7 +111,7 @@ function WordPress() {
}
return (
- <div className="docker-page-new wordpress-page">
+ <div className="page-container wordpress-page">
<div className="page-header">
<div className="page-header-content">
<h1>WordPress</h1>
diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsx
index 3b899d92..0df2f081 100644
--- a/frontend/src/pages/Workspaces.jsx
+++ b/frontend/src/pages/Workspaces.jsx
@@ -104,7 +104,7 @@ const Workspaces = () => {
if (loading) return <Spinner />;
return (
- <div className="workspaces-page">
+ <div className="page-container workspaces-page">
<div className="page-header">
<div className="page-header-content">
<h1>Workspaces</h1>
diff --git a/frontend/src/styles/components/_tabs.scss b/frontend/src/styles/components/_tabs.scss
index 1b577c0a..c08328b2 100644
--- a/frontend/src/styles/components/_tabs.scss
+++ b/frontend/src/styles/components/_tabs.scss
@@ -44,10 +44,22 @@
color: $text-primary;
}
- &.active {
+ &.active,
+ &[data-state="active"] {
color: $accent-primary;
border-bottom-color: $accent-primary;
}
+
+ &:disabled {
+ opacity: 0.5;
+ pointer-events: none;
+ }
+
+ &:focus-visible {
+ outline: 2px solid $accent-primary;
+ outline-offset: 2px;
+ border-radius: $radius-sm;
+ }
}
.tab-content {
diff --git a/frontend/src/styles/layout/_main-content.scss b/frontend/src/styles/layout/_main-content.scss
index b1655f8b..70a42d2f 100644
--- a/frontend/src/styles/layout/_main-content.scss
+++ b/frontend/src/styles/layout/_main-content.scss
@@ -105,11 +105,8 @@
}
}
-// Page placeholder
-.page {
- font-size: $font-size-2xl;
- color: $text-secondary;
-}
+// .page is a legacy alias for .page-container — kept for any stragglers, no styling.
+// New pages should use .page-container directly.
// Loading state (full-page spinner)
.loading {