ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add Windows service support and new UI components
Juan Denis19c727be4cd5
diff --git a/agent/cmd/agent/main.go b/agent/cmd/agent/main.goindex 99fc5b0f..32e36b30 100644--- a/agent/cmd/agent/main.go+++ b/agent/cmd/agent/main.go@@ -258,6 +258,26 @@ func runUpdate(force, checkOnly bool) error {}func runAgent() error {+ // SCM detection: when launched as a Windows Service, the binary must+ // implement the Service Control dispatcher protocol or SCM kills it+ // with error 1053 within 30s. Older versions of the agent skipped+ // this entirely — every "Start-Service ServerKitAgent" was silently+ // failing while manual `serverkit-agent start` worked, which had+ // users running the agent in foreground console windows as a+ // workaround. Now: if SCM started us, route through svc.Run; if+ // the user ran it from CLI, run directly with signal handling.+ if isWindowsService() {+ return runAsService(agentMainLoop)+ }+ return agentMainLoop(nil)+}++// agentMainLoop is the actual run logic, factored out so both the+// SCM-driven path (svc.Run dispatching to serviceHandler.Execute) and+// the CLI path can share it. Pass nil for ctx to use a fresh+// signal-handled context (CLI mode); pass the SCM-supplied ctx for+// service mode.+func agentMainLoop(parentCtx context.Context) error {// Load configurationcfg, err := config.Load(cfgFile)if err != nil {@@ -274,6 +294,7 @@ func runAgent() error {log.Info("Starting ServerKit Agent","version", Version,"config", config.DefaultConfigPath(),+ "mode", map[bool]string{true: "service", false: "cli"}[isWindowsService()],)// Single-instance enforcement for the service. Multiple "start"@@ -316,8 +337,23 @@ func runAgent() error {return fmt.Errorf("agent not registered. Run 'serverkit-agent register' first")}- // Create and start agent- ctx, cancel := context.WithCancel(context.Background())+ // Build the run context. Service mode supplies its own (cancelled+ // when SCM sends Stop). CLI mode wires SIGINT/SIGTERM as the+ // cancellation signal.+ var ctx context.Context+ var cancel context.CancelFunc+ if parentCtx != nil {+ ctx, cancel = context.WithCancel(parentCtx)+ } else {+ ctx, cancel = context.WithCancel(context.Background())+ sigCh := make(chan os.Signal, 1)+ signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)+ go func() {+ sig := <-sigCh+ log.Info("Received shutdown signal", "signal", sig.String())+ cancel()+ }()+ }defer cancel()ag, err := agent.New(cfg, log)@@ -329,16 +365,6 @@ func runAgent() error {updateChecker := updater.NewChecker(cfg, log, Version)go updateChecker.Start(ctx)- // Handle graceful shutdown- sigCh := make(chan os.Signal, 1)- signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)-- go func() {- sig := <-sigCh- log.Info("Received shutdown signal", "signal", sig.String())- cancel()- }()-// Start agentif err := ag.Run(ctx); err != nil && err != context.Canceled {return fmt.Errorf("agent error: %w", err)diff --git a/agent/cmd/agent/service_other.go b/agent/cmd/agent/service_other.gonew file mode 100644index 00000000..7fad4d1c--- /dev/null+++ b/agent/cmd/agent/service_other.go@@ -0,0 +1,13 @@+//go:build !windows++package main++import "context"++// runAsService is a no-op stub on POSIX — systemd handles process+// supervision, so there's nothing to dispatch.+func runAsService(runFn func(ctx context.Context) error) error {+ return runFn(context.Background())+}++func isWindowsService() bool { return false }diff --git a/agent/cmd/agent/service_windows.go b/agent/cmd/agent/service_windows.gonew file mode 100644index 00000000..1ad8f853--- /dev/null+++ b/agent/cmd/agent/service_windows.go@@ -0,0 +1,100 @@+//go:build windows++package main++import (+ "context"+ "fmt"++ "golang.org/x/sys/windows/svc"+)++// serviceHandler implements the Windows Service Control dispatcher+// contract. SCM launches the binary, calls Execute on a serviceHandler,+// expects status callbacks via the supplied channel within 30s. Without+// this dispatcher the binary runs normally but never signals+// SERVICE_RUNNING and SCM kills it with error 1053. Agents on Windows+// have been silently failing as services since the 1.0 line because of+// this — the whole "Start-Service ServerKitAgent" path was broken.+type serviceHandler struct {+ // runFn is the actual agent loop. Returns when ctx is cancelled or+ // the agent terminates on its own. We pass it a cancellable ctx and+ // flip cancel when SCM tells us to stop.+ runFn func(ctx context.Context) error+}++// Execute is invoked by svc.Run after the SCM connection is established.+// We immediately tell SCM we're starting, then SCM we're running, then+// run the agent loop in a goroutine while we listen for stop/shutdown+// requests on the supplied channel. The svc package owns the timing of+// the SCM handshake so all we need to do is push the right StateRunning+// / StateStopped statuses at the right moments.+func (h *serviceHandler) Execute(args []string, r <-chan svc.ChangeRequest, status chan<- svc.Status) (svcSpecificEC bool, exitCode uint32) {+ const accepted = svc.AcceptStop | svc.AcceptShutdown+ status <- svc.Status{State: svc.StartPending}++ ctx, cancel := context.WithCancel(context.Background())+ defer cancel()++ runDone := make(chan error, 1)+ go func() {+ runDone <- h.runFn(ctx)+ }()++ status <- svc.Status{State: svc.Running, Accepts: accepted}++ for {+ select {+ case c := <-r:+ switch c.Cmd {+ case svc.Interrogate:+ // SCM polling for liveness — re-echo our status so it+ // knows we're still alive. Required by the contract.+ status <- c.CurrentStatus+ case svc.Stop, svc.Shutdown:+ status <- svc.Status{State: svc.StopPending}+ cancel()+ // Wait for the agent loop to exit cleanly. svc.Run+ // internally allows up to 30s after StopPending+ // before SCM force-kills, which matches the existing+ // shutdown timing in agent.Run.+ <-runDone+ status <- svc.Status{State: svc.Stopped}+ return false, 0+ default:+ // Unknown control code — ignore. SCM doesn't send+ // pause/continue without us advertising support.+ }+ case err := <-runDone:+ // Agent loop exited on its own (config error, fatal panic+ // caught upstream, etc.). Tell SCM we're done so the+ // service shows as stopped instead of "running but dead".+ if err != nil && err != context.Canceled {+ status <- svc.Status{State: svc.Stopped, Win32ExitCode: 1}+ return false, 1+ }+ status <- svc.Status{State: svc.Stopped}+ return false, 0+ }+ }+}++// runAsService is the SCM entry point. Called from runAgent when we+// detect we're in a service context. Blocks until SCM tells us to stop.+func runAsService(runFn func(ctx context.Context) error) error {+ if err := svc.Run("ServerKitAgent", &serviceHandler{runFn: runFn}); err != nil {+ return fmt.Errorf("service dispatcher failed: %w", err)+ }+ return nil+}++// isWindowsService reports whether the current process was launched by+// the SCM. The svc package detects this by inspecting the process tree+// and the Windows session — there's no other reliable signal.+func isWindowsService() bool {+ in, err := svc.IsWindowsService()+ if err != nil {+ return false+ }+ return in+}diff --git a/frontend/src/App.jsx b/frontend/src/App.jsxindex cb8cbdbc..855bb40d 100644--- a/frontend/src/App.jsx+++ b/frontend/src/App.jsx@@ -238,6 +238,7 @@ function AppRoutes() {<Route path="cloud" element={<CloudProvision />} /><Route path="marketplace" element={<Marketplace />} /><Route path="style-guide" element={<StyleGuide />} />+ <Route path="style-guide/:tab" element={<StyleGuide />} /><Route path="downloads" element={<Downloads />} /><Route path="firewall" element={<Navigate to="/security/firewall" replace />} /><Route path="git" element={<Git />} />diff --git a/frontend/src/components/DangerZone.jsx b/frontend/src/components/DangerZone.jsxnew file mode 100644index 00000000..d97f4ec7--- /dev/null+++ b/frontend/src/components/DangerZone.jsx@@ -0,0 +1,18 @@+import React from 'react';++export function DangerZone({ title, description, action, children, className = '' }) {+ if (children) {+ return <div className={`danger-zone ${className}`.trim()}>{children}</div>;+ }+ return (+ <div className={`danger-zone ${className}`.trim()}>+ <div>+ {title && <h4>{title}</h4>}+ {description && <p>{description}</p>}+ </div>+ {action}+ </div>+ );+}++export default DangerZone;diff --git a/frontend/src/components/InfoList.jsx b/frontend/src/components/InfoList.jsxnew file mode 100644index 00000000..ed031387--- /dev/null+++ b/frontend/src/components/InfoList.jsx@@ -0,0 +1,17 @@+import React from 'react';++export function InfoList({ children, className = '', style }) {+ return <div className={`info-list ${className}`.trim()} style={style}>{children}</div>;+}++export function InfoItem({ label, value, mono = false, children }) {+ const valueClass = ['info-value', mono && 'mono'].filter(Boolean).join(' ');+ return (+ <div className="info-item">+ <span className="info-label">{label}</span>+ {children ?? <span className={valueClass}>{value}</span>}+ </div>+ );+}++export default InfoList;diff --git a/frontend/src/components/JournalControls.jsx b/frontend/src/components/JournalControls.jsxnew file mode 100644index 00000000..bc056632--- /dev/null+++ b/frontend/src/components/JournalControls.jsx@@ -0,0 +1,92 @@+import React from 'react';+import { Input } from '@/components/ui/input';+import { Button } from '@/components/ui/button';++const PRIORITY_OPTIONS = [+ { value: '', label: 'All' },+ { value: '0', label: 'Emergency' },+ { value: '1', label: 'Alert' },+ { value: '2', label: 'Critical' },+ { value: '3', label: 'Error' },+ { value: '4', label: 'Warning' },+ { value: '5', label: 'Notice' },+ { value: '6', label: 'Info' },+ { value: '7', label: 'Debug' },+];++export function JournalControls({+ unit = '',+ onUnitChange,+ unitLabel = 'Service/Unit',+ unitPlaceholder = 'All services',+ quickUnits = [],+ showQuickUnits = true,+ lineCount,+ onLineCountChange,+ lineCountOptions = [50, 100, 200, 500],+ priority,+ onPriorityChange,+ showPriority = true,+ loading = false,+ onLoad,+ loadLabel = 'Load Logs',+}) {+ return (+ <div className="journal-controls">+ <div className="control-group">+ <label>{unitLabel}</label>+ <div className="input-with-suggestions">+ <Input+ type="text"+ value={unit}+ onChange={(e) => onUnitChange?.(e.target.value)}+ placeholder={unitPlaceholder}+ />+ {showQuickUnits && quickUnits.length > 0 && (+ <div className="quick-units">+ {quickUnits.map(u => (+ <button+ key={u}+ className={`unit-chip ${unit === u ? 'active' : ''}`}+ onClick={() => onUnitChange?.(unit === u ? '' : u)}+ >+ {u}+ </button>+ ))}+ </div>+ )}+ </div>+ </div>++ {onLineCountChange && (+ <div className="control-group">+ <label>Lines</label>+ <select value={lineCount} onChange={(e) => onLineCountChange(parseInt(e.target.value, 10))}>+ {lineCountOptions.map(n => (+ <option key={n} value={n}>{n}</option>+ ))}+ </select>+ </div>+ )}++ {showPriority && onPriorityChange && (+ <div className="control-group">+ <label>Priority</label>+ <select value={priority ?? ''} onChange={(e) => onPriorityChange(e.target.value)}>+ {PRIORITY_OPTIONS.map(o => (+ <option key={o.value} value={o.value}>{o.label}</option>+ ))}+ </select>+ </div>+ )}++ {onLoad && (+ <Button onClick={onLoad} disabled={loading}>+ {loading ? 'Loading...' : loadLabel}+ </Button>+ )}+ </div>+ );+}++export default JournalControls;diff --git a/frontend/src/components/LogViewer.jsx b/frontend/src/components/LogViewer.jsxnew file mode 100644index 00000000..d05f7c29--- /dev/null+++ b/frontend/src/components/LogViewer.jsx@@ -0,0 +1,145 @@+import React from 'react';+import { Search, RefreshCw, FileText } from 'lucide-react';+import { Input } from '@/components/ui/input';+import { Button } from '@/components/ui/button';++export function LogViewer({+ files = [],+ selectedPath,+ onSelectFile,+ onRefreshFiles,+ content,+ contentLoading = false,+ contentEmpty,+ searchPattern = '',+ onSearchChange,+ onSearchSubmit,+ lineCount,+ onLineCountChange,+ lineCountOptions = [50, 100, 200, 500, 1000],+ autoRefresh = false,+ onAutoRefreshChange,+ onRefreshContent,+ onDownload,+ onClear,+ formatFileSize = defaultFormatFileSize,+ getLogIconType = () => 'default',+}) {+ return (+ <div className="logs-layout">+ <div className="logs-sidebar">+ <div className="sidebar-header">+ <h3>Log Files</h3>+ {onRefreshFiles && (+ <Button variant="outline" size="sm" onClick={onRefreshFiles}>+ <RefreshCw size={14} />+ </Button>+ )}+ </div>+ <div className="log-files-list">+ {files.length === 0 ? (+ <div className="empty-hint">No log files found</div>+ ) : (+ files.map((log) => (+ <div+ key={log.path}+ className={`log-file-item ${selectedPath === log.path ? 'active' : ''}`}+ onClick={() => onSelectFile?.(log)}+ >+ <div className={`log-icon ${getLogIconType(log)}`}>+ <FileText size={16} />+ </div>+ <div className="log-file-info">+ <span className="log-file-name">{log.name}</span>+ <span className="log-file-path">{log.path}</span>+ </div>+ <span className="log-file-size">{formatFileSize(log.size)}</span>+ </div>+ ))+ )}+ </div>+ </div>++ <div className="logs-viewer">+ <div className="viewer-toolbar">+ <div className="toolbar-left">+ <div className="search-input">+ <Search size={16} />+ <Input+ type="text"+ value={searchPattern}+ onChange={(e) => onSearchChange?.(e.target.value)}+ onKeyDown={(e) => e.key === 'Enter' && onSearchSubmit?.()}+ placeholder="Search pattern..."+ />+ </div>+ {onLineCountChange && (+ <select+ value={lineCount}+ onChange={(e) => onLineCountChange(parseInt(e.target.value, 10))}+ className="lines-select"+ >+ {lineCountOptions.map(n => (+ <option key={n} value={n}>{n} lines</option>+ ))}+ </select>+ )}+ </div>+ <div className="toolbar-right">+ {onAutoRefreshChange && (+ <label className="auto-refresh-toggle">+ <input+ type="checkbox"+ checked={autoRefresh}+ onChange={(e) => onAutoRefreshChange(e.target.checked)}+ />+ <span>Auto-refresh</span>+ </label>+ )}+ {onRefreshContent && (+ <Button+ variant="outline"+ size="sm"+ onClick={onRefreshContent}+ disabled={!selectedPath || contentLoading}+ >+ Refresh+ </Button>+ )}+ {onDownload && (+ <Button variant="outline" size="sm" onClick={onDownload} disabled={!content}>+ Download+ </Button>+ )}+ {onClear && (+ <Button variant="destructive" size="sm" onClick={onClear} disabled={!selectedPath}>+ Clear+ </Button>+ )}+ </div>+ </div>+ <div className="log-content">+ {contentLoading ? (+ <div className="logs-viewer__loading">Loading...</div>+ ) : !content ? (+ <div className="logs-viewer__empty">+ {contentEmpty ?? 'Select a log file to view its contents.'}+ </div>+ ) : (+ <pre>{content}</pre>+ )}+ </div>+ </div>+ </div>+ );+}++function defaultFormatFileSize(bytes) {+ if (bytes == null) return '';+ if (bytes < 1024) return `${bytes} B`;+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;+}++export default LogViewer;diff --git a/frontend/src/components/MetricRow.jsx b/frontend/src/components/MetricRow.jsxnew file mode 100644index 00000000..e853ecdd--- /dev/null+++ b/frontend/src/components/MetricRow.jsx@@ -0,0 +1,16 @@+import React from 'react';++export function MetricRow({ children, className = '' }) {+ return <div className={`metric-row ${className}`.trim()}>{children}</div>;+}++export function MetricItem({ label, value, children, className = '' }) {+ return (+ <div className={`metric-item ${className}`.trim()}>+ <span className="text-tertiary text-sm">{label}</span>+ {children ?? <span className="metric-value">{value}</span>}+ </div>+ );+}++export default MetricRow;diff --git a/frontend/src/components/ProcessTable.jsx b/frontend/src/components/ProcessTable.jsxnew file mode 100644index 00000000..9292e47d--- /dev/null+++ b/frontend/src/components/ProcessTable.jsx@@ -0,0 +1,158 @@+import React from 'react';+import { X, AlertTriangle } from 'lucide-react';+import { Button } from '@/components/ui/button';+import { Badge } from '@/components/ui/badge';++export function UsageCell({ percent = 0, variant = 'cpu' }) {+ const clamped = Math.min(Number(percent) || 0, 100);+ return (+ <div className="usage-cell">+ <div className={`usage-bar ${variant}`} style={{ width: `${clamped}%` }} />+ <span>{clamped.toFixed(1)}%</span>+ </div>+ );+}++export function ProcessTable({+ processes = [],+ selectedPid = null,+ onSelect,+ onKill,+ onForceKill,+ formatMemory = defaultFormatMemory,+ getStatusVariant = defaultGetStatusVariant,+}) {+ return (+ <div className="processes-table-wrapper">+ <table className="table processes-table">+ <thead>+ <tr>+ <th>PID</th>+ <th>Name</th>+ <th>User</th>+ <th>CPU %</th>+ <th>Memory %</th>+ <th>Memory</th>+ <th>Status</th>+ <th>Actions</th>+ </tr>+ </thead>+ <tbody>+ {processes.map(p => (+ <tr+ key={p.pid}+ className={selectedPid === p.pid ? 'selected' : ''}+ onClick={() => onSelect?.(p)}+ >+ <td className="mono">{p.pid}</td>+ <td><div className="process-name"><span>{p.name}</span></div></td>+ <td>{p.user}</td>+ <td><UsageCell percent={p.cpu_percent} variant="cpu" /></td>+ <td><UsageCell percent={p.memory_percent} variant="memory" /></td>+ <td>{formatMemory(p.memory_info?.rss)}</td>+ <td>+ <Badge variant={getStatusVariant(p.status)}>{p.status}</Badge>+ </td>+ <td>+ <div className="action-buttons">+ {onKill && (+ <Button+ variant="outline"+ size="sm"+ onClick={(e) => { e.stopPropagation(); onKill(p); }}+ title="Kill"+ >+ <X size={12} />+ </Button>+ )}+ {onForceKill && (+ <Button+ variant="destructive"+ size="sm"+ onClick={(e) => { e.stopPropagation(); onForceKill(p); }}+ title="Force Kill"+ >+ <AlertTriangle size={12} />+ </Button>+ )}+ </div>+ </td>+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ );+}++export function ProcessDetailsPanel({ process, onClose, formatMemory = defaultFormatMemory }) {+ if (!process) return null;+ return (+ <div className="process-details-panel">+ <div className="panel-header">+ <h3>Process Details</h3>+ <Button variant="outline" size="sm" onClick={onClose}>Close</Button>+ </div>+ <div className="panel-body">+ <div className="details-grid">+ <DetailItem label="PID" value={process.pid} mono />+ <DetailItem label="Name" value={process.name} />+ <DetailItem label="User" value={process.user} />+ <DetailItem label="Status" value={process.status} />+ <DetailItem label="CPU" value={`${(process.cpu_percent || 0).toFixed(2)}%`} />+ <DetailItem label="Memory" value={formatMemory(process.memory_info?.rss)} />+ <DetailItem label="Threads" value={process.num_threads} />+ <DetailItem+ label="Created"+ value={process.create_time ? new Date(process.create_time * 1000).toLocaleString() : '-'}+ />+ </div>+ {process.command && (+ <div className="command-line">+ <span className="detail-label">Command</span>+ <code>{process.command}</code>+ </div>+ )}+ </div>+ </div>+ );+}++export function DetailItem({ label, value, mono = false, children }) {+ const valueClass = ['detail-value', mono && 'mono'].filter(Boolean).join(' ');+ return (+ <div className="detail-item">+ <span className="detail-label">{label}</span>+ {children ?? <span className={valueClass}>{value}</span>}+ </div>+ );+}++function defaultFormatMemory(bytes) {+ if (!bytes) return '-';+ const units = ['B', 'KB', 'MB', 'GB'];+ let i = 0;+ while (bytes >= 1024 && i < units.length - 1) {+ bytes /= 1024;+ i++;+ }+ return `${bytes.toFixed(1)} ${units[i]}`;+}++function defaultGetStatusVariant(status) {+ switch (status?.toLowerCase()) {+ case 'running':+ case 'sleeping':+ return 'success';+ case 'stopped':+ case 'zombie':+ return 'destructive';+ case 'idle':+ case 'disk-sleep':+ return 'warning';+ default:+ return 'secondary';+ }+}++export default ProcessTable;diff --git a/frontend/src/components/ProgressBar.jsx b/frontend/src/components/ProgressBar.jsxnew file mode 100644index 00000000..b1207481--- /dev/null+++ b/frontend/src/components/ProgressBar.jsx@@ -0,0 +1,13 @@+import React from 'react';++export function ProgressBar({ percent = 0, color, className = '' }) {+ const clamped = Math.max(0, Math.min(100, Number(percent) || 0));+ const fillStyle = { width: `${clamped}%`, ...(color && { background: color }) };+ return (+ <div className={`progress-bar ${className}`.trim()}>+ <div className="progress-fill" style={fillStyle} />+ </div>+ );+}++export default ProgressBar;diff --git a/frontend/src/components/ServiceCard.jsx b/frontend/src/components/ServiceCard.jsxnew file mode 100644index 00000000..7d746658--- /dev/null+++ b/frontend/src/components/ServiceCard.jsx@@ -0,0 +1,64 @@+import React from 'react';+import { Badge } from '@/components/ui/badge';++export function ServicesGrid({ children, className = '' }) {+ return <div className={`services-grid ${className}`.trim()}>{children}</div>;+}++export function ServiceCard({+ name,+ description,+ status,+ statusVariant,+ meta = [],+ actions,+ children,+}) {+ const variant = statusVariant ?? defaultStatusVariant(status);+ return (+ <div className="service-card">+ <div className="service-header">+ <div className="service-info">+ <span className={`status-dot ${variant}`} />+ <h4>{name}</h4>+ </div>+ <Badge variant={variant}>{status}</Badge>+ </div>++ {description && <p className="service-description">{description}</p>}++ {meta.length > 0 && (+ <div className="service-meta">+ {meta.map((m, i) => (+ <span key={i} className="meta-item">+ <span className="meta-label">{m.label}:</span> {m.value}+ </span>+ ))}+ </div>+ )}++ {(actions || children) && (+ <div className="service-actions">+ {actions ?? children}+ </div>+ )}+ </div>+ );+}++function defaultStatusVariant(status) {+ switch (status?.toLowerCase()) {+ case 'running':+ case 'active':+ return 'success';+ case 'stopped':+ case 'failed':+ return 'destructive';+ case 'inactive':+ return 'secondary';+ default:+ return 'warning';+ }+}++export default ServiceCard;diff --git a/frontend/src/components/StatCard.jsx b/frontend/src/components/StatCard.jsxnew file mode 100644index 00000000..07ee375a--- /dev/null+++ b/frontend/src/components/StatCard.jsx@@ -0,0 +1,36 @@+import React from 'react';++export function StatsGrid({ children, className = '' }) {+ return <div className={`stats-grid ${className}`.trim()}>{children}</div>;+}++export function StatCard({+ icon: Icon,+ iconVariant,+ iconNode,+ label,+ value,+ suffix,+ valueClassName = '',+ children,+}) {+ const iconClass = ['stat-icon', iconVariant].filter(Boolean).join(' ');+ return (+ <div className="stat-card">+ <div className={iconClass}>+ {iconNode ?? (Icon ? <Icon size={20} /> : null)}+ </div>+ <div className="stat-content">+ <span className="stat-label">{label}</span>+ {children ?? (+ <span className={`stat-value ${valueClassName}`.trim()}>+ {value}+ {suffix && <span className="stat-suffix">{suffix}</span>}+ </span>+ )}+ </div>+ </div>+ );+}++export default StatCard;diff --git a/frontend/src/components/security/AutoUpdatesTab.jsx b/frontend/src/components/security/AutoUpdatesTab.jsxindex d39b9a92..ff916542 100644--- a/frontend/src/components/security/AutoUpdatesTab.jsx+++ b/frontend/src/components/security/AutoUpdatesTab.jsx@@ -1,6 +1,7 @@import React, { useState, useEffect } from 'react';import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';+import { InfoList, InfoItem } from '../InfoList';import { Button } from '@/components/ui/button';import { Badge } from '@/components/ui/badge';@@ -91,24 +92,19 @@ const AutoUpdatesTab = () => {<Button variant="outline" size="sm" onClick={loadStatus}>Refresh</Button></div><div className="card-body">- <div className="info-list">- <div className="info-item">- <span className="info-label">Package</span>- <span className="info-value">{status.package}</span>- </div>- <div className="info-item">- <span className="info-label">Installed</span>+ <InfoList>+ <InfoItem label="Package" value={status.package} />+ <InfoItem label="Installed"><Badge variant={status.installed ? 'success' : 'warning'}>{status.installed ? 'Yes' : 'No'}</Badge>- </div>- <div className="info-item">- <span className="info-label">Status</span>+ </InfoItem>+ <InfoItem label="Status"><Badge variant={status.enabled ? 'success' : 'secondary'}>{status.enabled ? 'Enabled' : 'Disabled'}</Badge>- </div>- </div>+ </InfoItem>+ </InfoList><div className="auto-updates-actions" style={{ marginTop: '1.5rem' }}>{!status.installed ? (diff --git a/frontend/src/components/security/Fail2banTab.jsx b/frontend/src/components/security/Fail2banTab.jsxindex 872341cd..965a32b1 100644--- a/frontend/src/components/security/Fail2banTab.jsx+++ b/frontend/src/components/security/Fail2banTab.jsx@@ -3,6 +3,7 @@ import api from '../../services/api';import ConfirmDialog from '../ConfirmDialog';import { useToast } from '../../contexts/ToastContext';import Modal from '../Modal';+import { InfoList, InfoItem } from '../InfoList';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';@@ -121,26 +122,16 @@ const Fail2banTab = () => {</div></div><div className="card-body">- <div className="info-list">- <div className="info-item">- <span className="info-label">Service</span>+ <InfoList>+ <InfoItem label="Service"><Badge variant={status.service_running ? 'success' : 'destructive'}>{status.service_running ? 'Running' : 'Stopped'}</Badge>- </div>- <div className="info-item">- <span className="info-label">Version</span>- <span className="info-value">{status.version || 'Unknown'}</span>- </div>- <div className="info-item">- <span className="info-label">Active Jails</span>- <span className="info-value">{status.jails?.join(', ') || 'None'}</span>- </div>- <div className="info-item">- <span className="info-label">Total Banned IPs</span>- <span className="info-value">{bans.length}</span>- </div>- </div>+ </InfoItem>+ <InfoItem label="Version" value={status.version || 'Unknown'} />+ <InfoItem label="Active Jails" value={status.jails?.join(', ') || 'None'} />+ <InfoItem label="Total Banned IPs" value={bans.length} />+ </InfoList></div></div>diff --git a/frontend/src/components/security/FirewallTab.jsx b/frontend/src/components/security/FirewallTab.jsxindex 371b11bd..63ddb352 100644--- a/frontend/src/components/security/FirewallTab.jsx+++ b/frontend/src/components/security/FirewallTab.jsx@@ -3,6 +3,7 @@ import api from '../../services/api';import ConfirmDialog from '../ConfirmDialog';import { useToast } from '../../contexts/ToastContext';import Modal from '../Modal';+import { InfoList, InfoItem } from '../InfoList';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';@@ -304,24 +305,17 @@ const FirewallTab = () => {<Button variant="outline" size="sm" onClick={loadData}>Refresh</Button></div><div className="card-body">- <div className="info-list">- <div className="info-item">- <span className="info-label">Type</span>- <span className="info-value">{activeFirewall?.toUpperCase()}</span>- </div>- <div className="info-item">- <span className="info-label">Status</span>+ <InfoList>+ <InfoItem label="Type" value={activeFirewall?.toUpperCase()} />+ <InfoItem label="Status"><Badge variant={isActive ? 'success' : 'destructive'}>{isActive ? 'Active' : 'Inactive'}</Badge>- </div>+ </InfoItem>{activeFirewall === 'firewalld' && status?.firewalld?.default_zone && (- <div className="info-item">- <span className="info-label">Default Zone</span>- <span className="info-value">{status.firewalld.default_zone}</span>- </div>+ <InfoItem label="Default Zone" value={status.firewalld.default_zone} />)}- </div>+ </InfoList></div></div>)}diff --git a/frontend/src/components/security/OverviewTab.jsx b/frontend/src/components/security/OverviewTab.jsxindex e1516c96..654d146f 100644--- a/frontend/src/components/security/OverviewTab.jsx+++ b/frontend/src/components/security/OverviewTab.jsx@@ -1,5 +1,6 @@import React, { useState, useEffect } from 'react';import api from '../../services/api';+import { InfoList, InfoItem } from '../InfoList';import { Button } from '@/components/ui/button';import { Badge } from '@/components/ui/badge';@@ -116,24 +117,18 @@ const OverviewTab = ({ status, onRefresh }) => {{loading ? (<div className="loading-sm">Loading...</div>) : clamavStatus?.installed ? (- <div className="info-list">- <div className="info-item">- <span className="info-label">Version</span>- <span className="info-value">{clamavStatus.version || 'Unknown'}</span>- </div>- <div className="info-item">- <span className="info-label">Service</span>+ <InfoList>+ <InfoItem label="Version" value={clamavStatus.version || 'Unknown'} />+ <InfoItem label="Service"><Badge variant={clamavStatus.service_running ? 'success' : 'warning'}>{clamavStatus.service_running ? 'Running' : 'Stopped'}</Badge>- </div>- <div className="info-item">- <span className="info-label">Last Definition Update</span>- <span className="info-value">- {clamavStatus.last_update ? new Date(clamavStatus.last_update).toLocaleString() : 'Unknown'}- </span>- </div>- </div>+ </InfoItem>+ <InfoItem+ label="Last Definition Update"+ value={clamavStatus.last_update ? new Date(clamavStatus.last_update).toLocaleString() : 'Unknown'}+ />+ </InfoList>) : (<div className="not-installed"><p>ClamAV is not installed on this server.</p>@@ -148,24 +143,19 @@ const OverviewTab = ({ status, onRefresh }) => {<h3>File Integrity Monitoring</h3></div><div className="card-body">- <div className="info-list">- <div className="info-item">- <span className="info-label">Status</span>+ <InfoList>+ <InfoItem label="Status"><Badge variant={status?.file_integrity?.enabled ? 'success' : 'secondary'}>{status?.file_integrity?.enabled ? 'Enabled' : 'Disabled'}</Badge>- </div>- <div className="info-item">- <span className="info-label">Database</span>+ </InfoItem>+ <InfoItem label="Database"><Badge variant={status?.file_integrity?.database_exists ? 'success' : 'warning'}>{status?.file_integrity?.database_exists ? 'Initialized' : 'Not Initialized'}</Badge>- </div>- <div className="info-item">- <span className="info-label">Changes Detected (24h)</span>- <span className="info-value">{alerts.integrity_changes || 0}</span>- </div>- </div>+ </InfoItem>+ <InfoItem label="Changes Detected (24h)" value={alerts.integrity_changes || 0} />+ </InfoList></div></div>@@ -174,14 +164,13 @@ const OverviewTab = ({ status, onRefresh }) => {<h3>Notifications</h3></div><div className="card-body">- <div className="info-list">- <div className="info-item">- <span className="info-label">Security Alerts</span>+ <InfoList>+ <InfoItem label="Security Alerts"><Badge variant={status?.notifications_enabled ? 'success' : 'secondary'}>{status?.notifications_enabled ? 'Enabled' : 'Disabled'}</Badge>- </div>- </div>+ </InfoItem>+ </InfoList><p className="help-text" style={{ marginTop: '1rem' }}>Configure notification channels in Settings → Notifications to receive security alerts via Discord, Slack, or Telegram.</p>diff --git a/frontend/src/components/security/VulnerabilityTab.jsx b/frontend/src/components/security/VulnerabilityTab.jsxindex 61358084..e344c0fb 100644--- a/frontend/src/components/security/VulnerabilityTab.jsx+++ b/frontend/src/components/security/VulnerabilityTab.jsx@@ -1,6 +1,7 @@import React, { useState, useEffect } from 'react';import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';+import { InfoList, InfoItem } from '../InfoList';import { Button } from '@/components/ui/button';import { Badge } from '@/components/ui/badge';@@ -107,18 +108,14 @@ const VulnerabilityTab = () => {</Button></div><div className="card-body">- <div className="info-list">- <div className="info-item">- <span className="info-label">Version</span>- <span className="info-value">{lynisStatus.version || 'Unknown'}</span>- </div>- <div className="info-item">- <span className="info-label">Scan Status</span>+ <InfoList>+ <InfoItem label="Version" value={lynisStatus.version || 'Unknown'} />+ <InfoItem label="Scan Status"><Badge variant={scanStatus?.status === 'completed' ? 'success' : scanStatus?.status === 'running' ? 'info' : 'secondary'}>{scanStatus?.status || 'Idle'}</Badge>- </div>- </div>+ </InfoItem>+ </InfoList></div></div>diff --git a/frontend/src/components/service-detail/SettingsTab.jsx b/frontend/src/components/service-detail/SettingsTab.jsxindex b4dd6f0b..f43a43c8 100644--- a/frontend/src/components/service-detail/SettingsTab.jsx+++ b/frontend/src/components/service-detail/SettingsTab.jsx@@ -2,6 +2,7 @@ import React, { useState } from 'react';import { useNavigate } from 'react-router-dom';import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';+import { DangerZone } from '../DangerZone';import { Button } from '@/components/ui/button';import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';@@ -152,16 +153,14 @@ const SettingsTab = ({ app, deployConfig, onUpdate, onOpenGitModal }) => {{/* Danger Zone */}<div className="svc-settings__section"><h3 className="svc-settings__section-title">Danger Zone</h3>- <div className="card danger-zone">- <p>Once you delete a service, there is no going back. All data will be permanently removed.</p>- <Button- variant="destructive"- onClick={handleDelete}- disabled={deleting}- >- {deleting ? 'Deleting...' : 'Delete Service'}- </Button>- </div>+ <DangerZone+ description="Once you delete a service, there is no going back. All data will be permanently removed."+ action={+ <Button variant="destructive" onClick={handleDelete} disabled={deleting}>+ {deleting ? 'Deleting...' : 'Delete Service'}+ </Button>+ }+ /></div></div>);diff --git a/frontend/src/components/settings/SystemTab.jsx b/frontend/src/components/settings/SystemTab.jsxindex 80e25d1e..8e804e93 100644--- a/frontend/src/components/settings/SystemTab.jsx+++ b/frontend/src/components/settings/SystemTab.jsx@@ -1,6 +1,7 @@import React, { useState, useEffect } from 'react';import { useAuth } from '../../contexts/AuthContext';import api from '../../services/api';+import { InfoList, InfoItem } from '../InfoList';import { Button } from '@/components/ui/button';import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';@@ -115,96 +116,52 @@ const SystemTab = () => {<div className="system-info-grid"><div className="settings-card"><h3>CPU</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Usage</span>- <span className="info-value">{metrics?.cpu?.percent?.toFixed(1) || 0}%</span>- </div>- <div className="info-item">- <span className="info-label">Cores</span>- <span className="info-value">{metrics?.cpu?.count || '-'}</span>- </div>- <div className="info-item">- <span className="info-label">Load Average</span>- <span className="info-value">- {metrics?.cpu?.load_avg ? metrics.cpu.load_avg.map(l => l.toFixed(2)).join(', ') : '-'}- </span>- </div>- </div>+ <InfoList>+ <InfoItem label="Usage" value={`${metrics?.cpu?.percent?.toFixed(1) || 0}%`} />+ <InfoItem label="Cores" value={metrics?.cpu?.count || '-'} />+ <InfoItem+ label="Load Average"+ value={metrics?.cpu?.load_avg ? metrics.cpu.load_avg.map(l => l.toFixed(2)).join(', ') : '-'}+ />+ </InfoList></div><div className="settings-card"><h3>Memory</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Usage</span>- <span className="info-value">{metrics?.memory?.percent?.toFixed(1) || 0}%</span>- </div>- <div className="info-item">- <span className="info-label">Used</span>- <span className="info-value">{formatBytes(metrics?.memory?.used)}</span>- </div>- <div className="info-item">- <span className="info-label">Total</span>- <span className="info-value">{formatBytes(metrics?.memory?.total)}</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Usage" value={`${metrics?.memory?.percent?.toFixed(1) || 0}%`} />+ <InfoItem label="Used" value={formatBytes(metrics?.memory?.used)} />+ <InfoItem label="Total" value={formatBytes(metrics?.memory?.total)} />+ </InfoList></div><div className="settings-card"><h3>Disk</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Usage</span>- <span className="info-value">{metrics?.disk?.percent?.toFixed(1) || 0}%</span>- </div>- <div className="info-item">- <span className="info-label">Used</span>- <span className="info-value">{formatBytes(metrics?.disk?.used)}</span>- </div>- <div className="info-item">- <span className="info-label">Total</span>- <span className="info-value">{formatBytes(metrics?.disk?.total)}</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Usage" value={`${metrics?.disk?.percent?.toFixed(1) || 0}%`} />+ <InfoItem label="Used" value={formatBytes(metrics?.disk?.used)} />+ <InfoItem label="Total" value={formatBytes(metrics?.disk?.total)} />+ </InfoList></div><div className="settings-card"><h3>Network</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Bytes Sent</span>- <span className="info-value">{formatBytes(metrics?.network?.bytes_sent)}</span>- </div>- <div className="info-item">- <span className="info-label">Bytes Received</span>- <span className="info-value">{formatBytes(metrics?.network?.bytes_recv)}</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Bytes Sent" value={formatBytes(metrics?.network?.bytes_sent)} />+ <InfoItem label="Bytes Received" value={formatBytes(metrics?.network?.bytes_recv)} />+ </InfoList></div></div>{metrics?.system && (<div className="settings-card"><h3>System Details</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Hostname</span>- <span className="info-value">{metrics.system.hostname || '-'}</span>- </div>- <div className="info-item">- <span className="info-label">Platform</span>- <span className="info-value">{metrics.system.platform || '-'}</span>- </div>- <div className="info-item">- <span className="info-label">OS Version</span>- <span className="info-value">{metrics.system.version || '-'}</span>- </div>- <div className="info-item">- <span className="info-label">Uptime</span>- <span className="info-value">{formatUptime(metrics.system.uptime)}</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Hostname" value={metrics.system.hostname || '-'} />+ <InfoItem label="Platform" value={metrics.system.platform || '-'} />+ <InfoItem label="OS Version" value={metrics.system.version || '-'} />+ <InfoItem label="Uptime" value={formatUptime(metrics.system.uptime)} />+ </InfoList></div>)}@@ -212,20 +169,11 @@ const SystemTab = () => {<div className="settings-card"><h3>Server Time & Timezone</h3>{metrics?.time && (- <div className="info-list" style={{ marginBottom: '1rem' }}>- <div className="info-item">- <span className="info-label">Current Time</span>- <span className="info-value">{metrics.time.current_time_formatted}</span>- </div>- <div className="info-item">- <span className="info-label">UTC Offset</span>- <span className="info-value">{metrics.time.utc_offset}</span>- </div>- <div className="info-item">- <span className="info-label">Current Timezone</span>- <span className="info-value">{metrics.time.timezone_id || metrics.time.timezone_name}</span>- </div>- </div>+ <InfoList style={{ marginBottom: '1rem' }}>+ <InfoItem label="Current Time" value={metrics.time.current_time_formatted} />+ <InfoItem label="UTC Offset" value={metrics.time.utc_offset} />+ <InfoItem label="Current Timezone" value={metrics.time.timezone_id || metrics.time.timezone_name} />+ </InfoList>)}<div className="form-group"><label>Change Timezone</label>diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsxindex 50a10832..261c256e 100644--- a/frontend/src/pages/AgentFleet.jsx+++ b/frontend/src/pages/AgentFleet.jsx@@ -27,6 +27,7 @@ import {import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useAuth } from '../contexts/AuthContext';+import { StatCard, StatsGrid } from '../components/StatCard';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Badge } from '@/components/ui/badge';@@ -240,44 +241,12 @@ const AgentFleet = () => {{/* ==================== Dashboard ==================== */}{activeTab === 'dashboard' && health && (<div className="space-y-6">- <div className="grid grid-cols-1 md:grid-cols-4 gap-4">- <div className="stat-card">- <div className="stat-icon bg-blue-100 text-blue-600">- <Server size={24} />- </div>- <div className="stat-content">- <div className="stat-value">{health.total_servers}</div>- <div className="stat-label">Total Agents</div>- </div>- </div>- <div className="stat-card">- <div className="stat-icon bg-green-100 text-green-600">- <CheckCircle size={24} />- </div>- <div className="stat-content">- <div className="stat-value">{health.online_servers}</div>- <div className="stat-label">Online</div>- </div>- </div>- <div className="stat-card">- <div className="stat-icon bg-red-100 text-red-600">- <AlertCircle size={24} />- </div>- <div className="stat-content">- <div className="stat-value">{health.offline_servers}</div>- <div className="stat-label">Offline</div>- </div>- </div>- <div className="stat-card">- <div className="stat-icon bg-purple-100 text-purple-600">- <Zap size={24} />- </div>- <div className="stat-content">- <div className="stat-value">{health.command_success_rate}%</div>- <div className="stat-label">Success Rate</div>- </div>- </div>- </div>+ <StatsGrid>+ <StatCard icon={Server} iconVariant="backups" label="Total Agents" value={health.total_servers} />+ <StatCard icon={CheckCircle} iconVariant="apps" label="Online" value={health.online_servers} />+ <StatCard icon={AlertCircle} iconVariant="alerts" label="Offline" value={health.offline_servers} />+ <StatCard icon={Zap} iconVariant="schedules" label="Success Rate" value={`${health.command_success_rate}%`} />+ </StatsGrid><div className="grid grid-cols-1 lg:grid-cols-2 gap-6"><div className="card">diff --git a/frontend/src/pages/ApplicationDetail.jsx b/frontend/src/pages/ApplicationDetail.jsxindex d625f8ef..1cab4ed9 100644--- a/frontend/src/pages/ApplicationDetail.jsx+++ b/frontend/src/pages/ApplicationDetail.jsx@@ -6,6 +6,8 @@ import useTabParam from '../hooks/useTabParam';import { useToast } from '../contexts/ToastContext';import { useConfirm } from '../hooks/useConfirm';import { ConfirmDialog } from '../components/ConfirmDialog';+import { DangerZone } from '../components/DangerZone';+import { InfoList, InfoItem } from '../components/InfoList';import EnvironmentVariables from '../components/EnvironmentVariables';import PrivateURLSection from '../components/PrivateURLSection';import LinkedAppsSection from '../components/LinkedAppsSection';@@ -1052,16 +1054,10 @@ const BuildTab = ({ appId, appPath }) => {</Button></div>{buildConfig ? (- <div className="info-list">- <div className="info-item">- <span className="info-label">Method</span>- <span className="info-value">{buildConfig.build_method}</span>- </div>- <div className="info-item">- <span className="info-label">Timeout</span>- <span className="info-value">{buildConfig.timeout}s</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Method" value={buildConfig.build_method} />+ <InfoItem label="Timeout" value={`${buildConfig.timeout}s`} />+ </InfoList>) : (<p className="hint">No build configuration. Click Configure to set up.</p>)}@@ -1384,17 +1380,15 @@ const SettingsTab = ({ app, onUpdate }) => {)}</div>- <div className="card danger-zone">- <h4>Danger Zone</h4>- <p>Once you delete an application, there is no going back.</p>- <Button- variant="destructive"- onClick={handleDelete}- disabled={deleting}- >- {deleting ? 'Deleting...' : 'Delete Application'}- </Button>- </div>+ <DangerZone+ title="Danger Zone"+ description="Once you delete an application, there is no going back."+ action={+ <Button variant="destructive" onClick={handleDelete} disabled={deleting}>+ {deleting ? 'Deleting...' : 'Delete Application'}+ </Button>+ }+ /><ConfirmDialogisOpen={confirmAppSettingsState.isOpen}title={confirmAppSettingsState.title}@@ -1606,20 +1600,11 @@ const DeployTab = ({ appId, appPath }) => {<div className="deploy-grid"><div className="card"><h3>Configuration</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Repository</span>- <span className="info-value mono">{config.repo_url}</span>- </div>- <div className="info-item">- <span className="info-label">Branch</span>- <span className="info-value">{config.branch}</span>- </div>- <div className="info-item">- <span className="info-label">Auto Deploy</span>- <span className="info-value">{config.auto_deploy ? 'Enabled' : 'Disabled'}</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Repository" value={config.repo_url} mono />+ <InfoItem label="Branch" value={config.branch} />+ <InfoItem label="Auto Deploy" value={config.auto_deploy ? 'Enabled' : 'Disabled'} />+ </InfoList><div className="card-actions"><Button variant="outline" size="sm" onClick={() => setShowConfigModal(true)}>Editdiff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsxindex 4f32e5de..dd84b1e8 100644--- a/frontend/src/pages/Backups.jsx+++ b/frontend/src/pages/Backups.jsx@@ -5,6 +5,7 @@ import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useConfirm } from '../hooks/useConfirm';import { ConfirmDialog } from '../components/ConfirmDialog';+import { StatCard, StatsGrid } from '../components/StatCard';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Textarea } from '@/components/ui/textarea';@@ -390,59 +391,15 @@ const Backups = () => {)}{/* Stats Cards */}- <div className="stats-grid">- <div className="stat-card">- <div className="stat-icon backups">- <Download size={24} />- </div>- <div className="stat-content">- <span className="stat-label">Total Backups</span>- <span className="stat-value">{stats?.total_backups || 0}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon apps">- <Package size={24} />- </div>- <div className="stat-content">- <span className="stat-label">Application Backups</span>- <span className="stat-value">{stats?.application_backups || 0}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon databases">- <Database size={24} />- </div>- <div className="stat-content">- <span className="stat-label">Database Backups</span>- <span className="stat-value">{stats?.database_backups || 0}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon size">- <HardDrive size={24} />- </div>- <div className="stat-content">- <span className="stat-label">Local Size</span>- <span className="stat-value">{stats?.total_size_human || '0 B'}</span>- </div>- </div>-+ <StatsGrid>+ <StatCard icon={Download} iconVariant="backups" label="Total Backups" value={stats?.total_backups || 0} />+ <StatCard icon={Package} iconVariant="apps" label="Application Backups" value={stats?.application_backups || 0} />+ <StatCard icon={Database} iconVariant="databases" label="Database Backups" value={stats?.database_backups || 0} />+ <StatCard icon={HardDrive} iconVariant="size" label="Local Size" value={stats?.total_size_human || '0 B'} />{storageConfig?.provider !== 'local' && (- <div className="stat-card">- <div className="stat-icon cloud">- <Cloud size={24} />- </div>- <div className="stat-content">- <span className="stat-label">Remote Backups</span>- <span className="stat-value">{stats?.remote_count || 0}</span>- </div>- </div>+ <StatCard icon={Cloud} iconVariant="cloud" label="Remote Backups" value={stats?.remote_count || 0} />)}- </div>+ </StatsGrid><Tabs value={activeTab} onValueChange={setActiveTab}><TabsList>diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsxindex 0da80cf7..b3daefbd 100644--- a/frontend/src/pages/CronJobs.jsx+++ b/frontend/src/pages/CronJobs.jsx@@ -3,6 +3,8 @@ import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useConfirm } from '../hooks/useConfirm';import { ConfirmDialog } from '../components/ConfirmDialog';+import { StatCard, StatsGrid } from '../components/StatCard';+import { Clock, FileText, CheckCircle, Monitor } from 'lucide-react';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';@@ -223,63 +225,12 @@ const CronJobs = () => {)}{/* Status Cards */}- <div className="stats-grid">- <div className="stat-card">- <div className="stat-icon cron">- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">- <circle cx="12" cy="12" r="10"/>- <polyline points="12 6 12 12 16 14"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Cron Service</span>- <span className="stat-value">{status?.available ? 'Available' : 'Not Available'}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon jobs">- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>- <polyline points="14 2 14 8 20 8"/>- <line x1="16" y1="13" x2="8" y2="13"/>- <line x1="16" y1="17" x2="8" y2="17"/>- <polyline points="10 9 9 9 8 9"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Total Jobs</span>- <span className="stat-value">{jobs.length}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon active">- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>- <polyline points="22 4 12 14.01 9 11.01"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Active Jobs</span>- <span className="stat-value">{jobs.filter(j => j.enabled).length}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon platform">- <svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" fill="none" strokeWidth="2">- <rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>- <line x1="8" y1="21" x2="16" y2="21"/>- <line x1="12" y1="17" x2="12" y2="21"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Platform</span>- <span className="stat-value">{status?.platform || 'Unknown'}</span>- </div>- </div>- </div>+ <StatsGrid>+ <StatCard icon={Clock} iconVariant="cron" label="Cron Service" value={status?.available ? 'Available' : 'Not Available'} />+ <StatCard icon={FileText} iconVariant="jobs" label="Total Jobs" value={jobs.length} />+ <StatCard icon={CheckCircle} iconVariant="active" label="Active Jobs" value={jobs.filter(j => j.enabled).length} />+ <StatCard icon={Monitor} iconVariant="platform" label="Platform" value={status?.platform || 'Unknown'} />+ </StatsGrid>{/* Jobs List */}<div className="card">diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsxindex a01e3f74..05e5014f 100644--- a/frontend/src/pages/FileManager.jsx+++ b/frontend/src/pages/FileManager.jsx@@ -3,6 +3,7 @@ import { api } from '../services/api';import { useToast } from '../contexts/ToastContext';import Spinner from '../components/Spinner';import ConfirmDialog from '../components/ConfirmDialog';+import { ProgressBar } from '../components/ProgressBar';import {Folder, File, FileCode, FileText, FileImage, FileVideo, FileAudio,FileArchive, Database, Terminal, Upload, FolderPlus, FilePlus,@@ -360,9 +361,7 @@ function FileManager() {{uploadProgress !== null && (<div className="upload-progress">- <div className="progress-bar">- <div className="progress-fill" style={{ width: `${uploadProgress}%` }}></div>- </div>+ <ProgressBar percent={uploadProgress} /><span>{Math.round(uploadProgress)}%</span></div>)}diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsxindex 3f166b00..cc42b8a5 100644--- a/frontend/src/pages/Git.jsx+++ b/frontend/src/pages/Git.jsx@@ -4,6 +4,7 @@ import { api } from '../services/api';import { useToast } from '../contexts/ToastContext';import Spinner from '../components/Spinner';import ConfirmDialog from '../components/ConfirmDialog';+import { DangerZone } from '../components/DangerZone';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Textarea } from '@/components/ui/textarea';@@ -1370,12 +1371,10 @@ function Git() {</Button></div></div>- <div className="info-card danger-zone">- <h3>Danger Zone</h3>- <p className="text-muted">- Uninstalling will stop the Gitea container. Your data will be preserved unless you choose to remove it.- </p>- </div>+ <DangerZone+ title="Danger Zone"+ description="Uninstalling will stop the Gitea container. Your data will be preserved unless you choose to remove it."+ /></div></TabsContent></div>diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsxindex c08ffc21..f0083a56 100644--- a/frontend/src/pages/Monitoring.jsx+++ b/frontend/src/pages/Monitoring.jsx@@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react';import useTabParam from '../hooks/useTabParam';import api from '../services/api';import { useToast } from '../contexts/ToastContext';+import { StatCard, StatsGrid } from '../components/StatCard';+import { Circle, Bell, Clock, Mail } from 'lucide-react';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';@@ -195,65 +197,31 @@ const Monitoring = () => {<TabsContent value="overview"><div className="monitoring-overview">- <div className="stats-grid">- <div className="stat-card">- <div className="stat-icon status">- <svg viewBox="0 0 24 24" width="24" height="24">- <circle cx="12" cy="12" r="10"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Monitoring Status</span>- <span className={`stat-value ${status?.monitoring_active ? 'text-success' : 'text-muted'}`}>- {status?.monitoring_active ? 'Active' : 'Inactive'}- </span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon alerts">- <svg viewBox="0 0 24 24" width="24" height="24">- <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/>- <path d="M13.73 21a2 2 0 0 1-3.46 0"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Recent Alerts</span>- <span className="stat-value">{alertHistory.length}</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon interval">- <svg viewBox="0 0 24 24" width="24" height="24">- <circle cx="12" cy="12" r="10"/>- <polyline points="12 6 12 12 16 14"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Check Interval</span>- <span className="stat-value">{config?.check_interval || 60}s</span>- </div>- </div>-- <div className="stat-card">- <div className="stat-icon notifications">- <svg viewBox="0 0 24 24" width="24" height="24">- <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>- <polyline points="22,6 12,13 2,6"/>- </svg>- </div>- <div className="stat-content">- <span className="stat-label">Notifications</span>- <span className="stat-value">- {config?.alert_email ? 'Email' : ''}- {config?.alert_email && config?.alert_webhook ? ' + ' : ''}- {config?.alert_webhook ? 'Webhook' : ''}- {!config?.alert_email && !config?.alert_webhook ? 'None' : ''}- </span>- </div>- </div>- </div>+ <StatsGrid>+ <StatCard+ icon={Circle}+ iconVariant="status"+ label="Monitoring Status"+ value={status?.monitoring_active ? 'Active' : 'Inactive'}+ valueClassName={status?.monitoring_active ? 'text-success' : 'text-muted'}+ />+ <StatCard icon={Bell} iconVariant="alerts" label="Recent Alerts" value={alertHistory.length} />+ <StatCard icon={Clock} iconVariant="interval" label="Check Interval" value={`${config?.check_interval || 60}s`} />+ <StatCard+ icon={Mail}+ iconVariant="notifications"+ label="Notifications"+ value={+ config?.alert_email && config?.alert_webhook+ ? 'Email + Webhook'+ : config?.alert_email+ ? 'Email'+ : config?.alert_webhook+ ? 'Webhook'+ : 'None'+ }+ />+ </StatsGrid><div className="card"><div className="card-header">diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsxindex 4db8e04a..10a38104 100644--- a/frontend/src/pages/ServerDetail.jsx+++ b/frontend/src/pages/ServerDetail.jsx@@ -5,6 +5,8 @@ import { useToast } from '../contexts/ToastContext';import MetricsGraph from '../components/MetricsGraph';import { useConfirm } from '../hooks/useConfirm';import { ConfirmDialog } from '../components/ConfirmDialog';+import { DangerZone } from '../components/DangerZone';+import { InfoList, InfoItem } from '../components/InfoList';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Textarea } from '@/components/ui/textarea';@@ -301,84 +303,45 @@ const OverviewTab = ({ server, metrics, systemInfo }) => {<div className="overview-grid"><div className="info-card"><h3>Server Information</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Status</span>+ <InfoList>+ <InfoItem label="Status"><span className={`status-badge ${server.status}`}>{server.status}</span>- </div>- <div className="info-item">- <span className="info-label">Hostname</span>- <span className="info-value">{server.hostname || 'N/A'}</span>- </div>- <div className="info-item">- <span className="info-label">IP Address</span>- <span className="info-value">{server.ip_address || 'N/A'}</span>- </div>- <div className="info-item">- <span className="info-label">Group</span>- <span className="info-value">{server.group_name || 'Ungrouped'}</span>- </div>- <div className="info-item">- <span className="info-label">Last Seen</span>- <span className="info-value">- {server.last_seen ? new Date(server.last_seen).toLocaleString() : 'Never'}- </span>- </div>- </div>+ </InfoItem>+ <InfoItem label="Hostname" value={server.hostname || 'N/A'} />+ <InfoItem label="IP Address" value={server.ip_address || 'N/A'} />+ <InfoItem label="Group" value={server.group_name || 'Ungrouped'} />+ <InfoItem+ label="Last Seen"+ value={server.last_seen ? new Date(server.last_seen).toLocaleString() : 'Never'}+ />+ </InfoList></div><div className="info-card"><h3>System Information</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Operating System</span>- <span className="info-value">- {systemInfo?.os || server.os_type || 'Unknown'}- {systemInfo?.os_version && ` ${systemInfo.os_version}`}- </span>- </div>- <div className="info-item">- <span className="info-label">Architecture</span>- <span className="info-value">{systemInfo?.architecture || server.architecture || 'N/A'}</span>- </div>- <div className="info-item">- <span className="info-label">CPU</span>- <span className="info-value">- {systemInfo?.cpu_model || 'N/A'}- {systemInfo?.cpu_cores && ` (${systemInfo.cpu_cores} cores)`}- </span>- </div>- <div className="info-item">- <span className="info-label">Total Memory</span>- <span className="info-value">{formatBytes(systemInfo?.total_memory)}</span>- </div>- <div className="info-item">- <span className="info-label">Total Disk</span>- <span className="info-value">{formatBytes(systemInfo?.total_disk)}</span>- </div>- </div>+ <InfoList>+ <InfoItem+ label="Operating System"+ value={`${systemInfo?.os || server.os_type || 'Unknown'}${systemInfo?.os_version ? ` ${systemInfo.os_version}` : ''}`}+ />+ <InfoItem label="Architecture" value={systemInfo?.architecture || server.architecture || 'N/A'} />+ <InfoItem+ label="CPU"+ value={`${systemInfo?.cpu_model || 'N/A'}${systemInfo?.cpu_cores ? ` (${systemInfo.cpu_cores} cores)` : ''}`}+ />+ <InfoItem label="Total Memory" value={formatBytes(systemInfo?.total_memory)} />+ <InfoItem label="Total Disk" value={formatBytes(systemInfo?.total_disk)} />+ </InfoList></div><div className="info-card"><h3>Agent Information</h3>- <div className="info-list">- <div className="info-item">- <span className="info-label">Agent Version</span>- <span className="info-value">{server.agent_version || 'Not installed'}</span>- </div>- <div className="info-item">- <span className="info-label">Agent ID</span>- <span className="info-value mono">{server.agent_id || 'N/A'}</span>- </div>- <div className="info-item">- <span className="info-label">Docker Version</span>- <span className="info-value">{server.docker_version || systemInfo?.docker_version || 'N/A'}</span>- </div>- <div className="info-item">- <span className="info-label">Uptime</span>- <span className="info-value">{formatUptime(metrics?.uptime)}</span>- </div>- </div>+ <InfoList>+ <InfoItem label="Agent Version" value={server.agent_version || 'Not installed'} />+ <InfoItem label="Agent ID" value={server.agent_id || 'N/A'} mono />+ <InfoItem label="Docker Version" value={server.docker_version || systemInfo?.docker_version || 'N/A'} />+ <InfoItem label="Uptime" value={formatUptime(metrics?.uptime)} />+ </InfoList></div>{server.status === 'online' && metrics && (@@ -1102,15 +1065,15 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {</div>)}- <div className="form-section danger-zone">- <h3>Danger Zone</h3>- <p className="section-description">- Removing this server will disconnect the agent and delete all associated data.- </p>- <Button variant="destructive" onClick={onDelete}>- <TrashIcon /> Remove Server- </Button>- </div>+ <DangerZone+ title="Danger Zone"+ description="Removing this server will disconnect the agent and delete all associated data."+ action={+ <Button variant="destructive" onClick={onDelete}>+ <TrashIcon /> Remove Server+ </Button>+ }+ /><ConfirmDialogisOpen={confirmSettingsState.isOpen}title={confirmSettingsState.title}diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsxindex 9dcba487..35556f16 100644--- a/frontend/src/pages/Settings.jsx+++ b/frontend/src/pages/Settings.jsx@@ -208,9 +208,17 @@ const Settings = () => {<Code size={18} />Icon Reference</Button>+ <Button+ variant="ghost"+ className="settings-nav-item"+ onClick={() => navigate('/style-guide')}+ >+ <PaintBucket size={18} />+ Style Guide+ </Button></>)}- {import.meta.env.DEV && (+ {import.meta.env.DEV && !devMode && (<><div className="settings-nav-divider">Local Dev</div><Buttondiff --git a/frontend/src/pages/StyleGuide.jsx b/frontend/src/pages/StyleGuide.jsxindex 29ea7be9..6b5598ab 100644--- a/frontend/src/pages/StyleGuide.jsx+++ b/frontend/src/pages/StyleGuide.jsx@@ -1,4 +1,5 @@import React, { useState } from 'react';+import useTabParam from '../hooks/useTabParam';import {Palette, Type, Box, Layout, Square, ToggleLeft, AlertTriangle,Info, CheckCircle, XCircle, Bell, Search, Plus, Trash2, Edit3,@@ -13,40 +14,52 @@ import { ConfirmDialog } from '../components/ConfirmDialog';import StatusBadge from '../components/StatusBadge';import EmptyState from '../components/EmptyState';import { Spinner } from '../components/Spinner';+import { StatCard, StatsGrid } from '../components/StatCard';+import { DangerZone } from '../components/DangerZone';+import { InfoList, InfoItem } from '../components/InfoList';+import { ProgressBar } from '../components/ProgressBar';+import { MetricRow, MetricItem } from '../components/MetricRow';+import { LogViewer } from '../components/LogViewer';+import { ProcessTable, ProcessDetailsPanel } from '../components/ProcessTable';+import { ServiceCard, ServicesGrid } from '../components/ServiceCard';+import { JournalControls } from '../components/JournalControls';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Textarea } from '@/components/ui/textarea';import { Badge } from '@/components/ui/badge';import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';+const SECTIONS = [+ { id: 'colors', label: 'Colors', icon: Palette },+ { id: 'typography', label: 'Typography', icon: Type },+ { id: 'spacing', label: 'Spacing & Radius', icon: Box },+ { id: 'buttons', label: 'Buttons', icon: Square },+ { id: 'forms', label: 'Forms', icon: ToggleLeft },+ { id: 'tables', label: 'Tables', icon: Table },+ { id: 'cards', label: 'Cards & Stats', icon: Layout },+ { id: 'badges', label: 'Badges & Status', icon: Shield },+ { id: 'alerts', label: 'Alerts & Errors', icon: AlertCircle },+ { id: 'modals', label: 'Modals & Dialogs', icon: Layers },+ { id: 'tabs', label: 'Tabs', icon: ChevronRight },+ { id: 'lists', label: 'Lists & Info', icon: Database },+ { id: 'feedback', label: 'Feedback & Loading', icon: Activity },+ { id: 'empty', label: 'States', icon: Inbox },+ { id: 'pageheaders', label: 'Page Headers', icon: FileText },+ { id: 'patterns', label: 'Page Patterns', icon: Monitor },+ { id: 'utilities', label: 'Utilities', icon: Zap },+];++const SECTION_IDS = SECTIONS.map(s => s.id);+export default function StyleGuide() {- const [activeSection, setActiveSection] = useState('colors');+ const [activeSection, setActiveSection] = useTabParam('/style-guide', SECTION_IDS, 'colors');const [modalOpen, setModalOpen] = useState(false);const [confirmOpen, setConfirmOpen] = useState(false);const [confirmVariant, setConfirmVariant] = useState('danger');const [inputValue, setInputValue] = useState('');const [selectValue, setSelectValue] = useState('');const [checkValue, setCheckValue] = useState(false);-- const sections = [- { id: 'colors', label: 'Colors', icon: Palette },- { id: 'typography', label: 'Typography', icon: Type },- { id: 'spacing', label: 'Spacing & Radius', icon: Box },- { id: 'buttons', label: 'Buttons', icon: Square },- { id: 'forms', label: 'Forms', icon: ToggleLeft },- { id: 'tables', label: 'Tables', icon: Table },- { id: 'cards', label: 'Cards & Stats', icon: Layout },- { id: 'badges', label: 'Badges & Status', icon: Shield },- { id: 'alerts', label: 'Alerts & Errors', icon: AlertCircle },- { id: 'modals', label: 'Modals & Dialogs', icon: Layers },- { id: 'tabs', label: 'Tabs', icon: ChevronRight },- { id: 'lists', label: 'Lists & Info', icon: Database },- { id: 'feedback', label: 'Feedback & Loading', icon: Activity },- { id: 'empty', label: 'States', icon: Inbox },- { id: 'pageheaders', label: 'Page Headers', icon: FileText },- { id: 'patterns', label: 'Page Patterns', icon: Monitor },- { id: 'utilities', label: 'Utilities', icon: Zap },- ];+ const sections = SECTIONS;return (<div className="styleguide">@@ -513,89 +526,49 @@ export default function StyleGuide() {</div></div>- <SectionTitle title="Stats Grid" />- <div className="stats-grid">- <div className="stat-card">- <div className="stat-icon apps"><Server size={20} /></div>- <div className="stat-content">- <span className="stat-label">Applications</span>- <span className="stat-value">12</span>- </div>- </div>- <div className="stat-card">- <div className="stat-icon databases"><Database size={20} /></div>- <div className="stat-content">- <span className="stat-label">Databases</span>- <span className="stat-value">5</span>- </div>- </div>- <div className="stat-card">- <div className="stat-icon backups"><Cloud size={20} /></div>- <div className="stat-content">- <span className="stat-label">Backups</span>- <span className="stat-value">24</span>- </div>- </div>- <div className="stat-card">- <div className="stat-icon size"><BarChart3 size={20} /></div>- <div className="stat-content">- <span className="stat-label">Disk Used</span>- <span className="stat-value">48<span className="stat-suffix">GB</span></span>- </div>- </div>- </div>+ <SectionTitle title="Stats Grid (StatCard / StatsGrid)" />+ <StatsGrid>+ <StatCard icon={Server} iconVariant="apps" label="Applications" value={12} />+ <StatCard icon={Database} iconVariant="databases" label="Databases" value={5} />+ <StatCard icon={Cloud} iconVariant="backups" label="Backups" value={24} />+ <StatCard icon={BarChart3} iconVariant="size" label="Disk Used" value={48} suffix="GB" />+ </StatsGrid>- <SectionTitle title="Metric Row" />+ <SectionTitle title="Metric Row (MetricRow / MetricItem)" /><div className="card" style={{ padding: 24 }}>- <div className="metric-row">- <div className="metric-item">- <span className="text-tertiary text-sm">CPU</span>- <span className="metric-value">23%</span>- </div>- <div className="metric-item">- <span className="text-tertiary text-sm">Memory</span>- <span className="metric-value">1.2 GB</span>- </div>- <div className="metric-item">- <span className="text-tertiary text-sm">Disk</span>- <span className="metric-value">48 GB</span>- </div>- <div className="metric-item">- <span className="text-tertiary text-sm">Network</span>- <span className="metric-value">2.4 Mbps</span>- </div>- </div>+ <MetricRow>+ <MetricItem label="CPU" value="23%" />+ <MetricItem label="Memory" value="1.2 GB" />+ <MetricItem label="Disk" value="48 GB" />+ <MetricItem label="Network" value="2.4 Mbps" />+ </MetricRow></div>- <SectionTitle title="Progress Bar" />+ <SectionTitle title="Progress Bar (ProgressBar)" /><div className="card" style={{ padding: 24 }}><div className="space-y-4">{[- ['Storage', '48 / 100 GB', '48%', null],- ['Memory', '6.2 / 8 GB', '78%', '#f59e0b'],- ['CPU', '92%', '92%', '#ef4444'],- ].map(([label, text, width, color]) => (+ ['Storage', '48 / 100 GB', 48, null],+ ['Memory', '6.2 / 8 GB', 78, '#f59e0b'],+ ['CPU', '92%', 92, '#ef4444'],+ ].map(([label, text, percent, color]) => (<div key={label}><div className="flex justify-between mb-1"><span className="text-sm text-secondary">{label}</span><span className="text-sm mono">{text}</span></div>- <div className="progress-bar">- <div className="progress-fill" style={{ width, ...(color && { background: color }) }} />- </div>+ <ProgressBar percent={percent} color={color} /></div>))}</div></div>- <SectionTitle title="Danger Zone" />- <div className="danger-zone">- <div>- <h4>Delete Application</h4>- <p className="text-secondary">Once deleted, this cannot be undone. All data will be permanently removed.</p>- </div>- <Button variant="destructive"><Trash2 size={16} /> Delete</Button>- </div>+ <SectionTitle title="Danger Zone (DangerZone)" />+ <DangerZone+ title="Delete Application"+ description="Once deleted, this cannot be undone. All data will be permanently removed."+ action={<Button variant="destructive"><Trash2 size={16} /> Delete</Button>}+ /></div>)}@@ -789,25 +762,17 @@ export default function StyleGuide() {{/* ── LISTS & INFO ── */}{activeSection === 'lists' && (<div className="space-y-6">- <SectionTitle title="Info List (Key-Value)" />+ <SectionTitle title="Info List (InfoList / InfoItem)" /><div className="card" style={{ padding: 24 }}>- <div className="info-list">- {[- ['Hostname', 'srv-01.example.com', true],- ['IP Address', '192.168.1.100', true],- ['OS', 'Ubuntu 22.04 LTS', false],- ['Uptime', '42 days, 7 hours', false],- ].map(([label, value, mono]) => (- <div key={label} className="info-item">- <span className="info-label">{label}</span>- <span className={`info-value ${mono ? 'mono' : ''}`}>{value}</span>- </div>- ))}- <div className="info-item">- <span className="info-label">Status</span>+ <InfoList>+ <InfoItem label="Hostname" value="srv-01.example.com" mono />+ <InfoItem label="IP Address" value="192.168.1.100" mono />+ <InfoItem label="OS" value="Ubuntu 22.04 LTS" />+ <InfoItem label="Uptime" value="42 days, 7 hours" />+ <InfoItem label="Status"><StatusBadge status="online" />- </div>- </div>+ </InfoItem>+ </InfoList></div><SectionTitle title="Environment Variables" />@@ -1066,89 +1031,43 @@ export default function StyleGuide() {<button className="alert-close">×</button></div>- <SectionTitle title="Log Viewer (Sidebar + Content)" />+ <SectionTitle title="Log Viewer (LogViewer)" /><p className="text-sm text-secondary mb-2">Split layout: file list sidebar + log content viewer with toolbar.</p><div style={{ height: 360 }}>- <div className="logs-layout" style={{ height: '100%' }}>- <div className="logs-sidebar">- <div className="sidebar-header">- <h3>Log Files</h3>- <Button size="sm" variant="outline"><RefreshCw size={14} /></Button>- </div>- <div className="log-files-list">- {[- { name: 'error.log', path: '/var/log/nginx/error.log', size: '2.4 MB', type: 'error' },- { name: 'access.log', path: '/var/log/nginx/access.log', size: '18.7 MB', type: 'access' },- { name: 'syslog', path: '/var/log/syslog', size: '5.1 MB', type: 'default' },- ].map((log, i) => (- <div key={i} className={`log-file-item ${i === 0 ? 'active' : ''}`}>- <div className={`log-icon ${log.type}`}>- <FileText size={16} />- </div>- <div className="log-file-info">- <span className="log-file-name">{log.name}</span>- <span className="log-file-path">{log.path}</span>- </div>- <span className="log-file-size">{log.size}</span>- </div>- ))}- </div>- </div>- <div className="logs-viewer">- <div className="viewer-toolbar">- <div className="toolbar-left">- <div className="search-input">- <Search size={16} />- <input type="text" placeholder="Search pattern..." />- </div>- <select className="lines-select">- <option>100 lines</option>- <option>200 lines</option>- <option>500 lines</option>- </select>- </div>- <div className="toolbar-right">- <label className="auto-refresh-toggle">- <input type="checkbox" />- <span>Auto-refresh</span>- </label>- <Button size="sm" variant="outline">Refresh</Button>- <Button size="sm" variant="outline">Download</Button>- <Button size="sm" variant="destructive">Clear</Button>- </div>- </div>- <div className="log-content">- <pre>{`[2026-03-29 14:23:01] ERROR connect() failed (111: Connection refused)\n[2026-03-29 14:23:05] WARN upstream timed out (110: Connection timed out)\n[2026-03-29 14:23:12] INFO nginx/1.24.0 started\n[2026-03-29 14:23:12] INFO worker process 1234 started`}</pre>- </div>- </div>- </div>+ <LogViewer+ files={[+ { name: 'error.log', path: '/var/log/nginx/error.log', size: 2516582, type: 'error' },+ { name: 'access.log', path: '/var/log/nginx/access.log', size: 19608371, type: 'access' },+ { name: 'syslog', path: '/var/log/syslog', size: 5347737, type: 'default' },+ ]}+ selectedPath="/var/log/nginx/error.log"+ getLogIconType={(log) => log.type}+ content={`[2026-03-29 14:23:01] ERROR connect() failed (111: Connection refused)\n[2026-03-29 14:23:05] WARN upstream timed out (110: Connection timed out)\n[2026-03-29 14:23:12] INFO nginx/1.24.0 started\n[2026-03-29 14:23:12] INFO worker process 1234 started`}+ searchPattern=""+ lineCount={100}+ onLineCountChange={() => {}}+ autoRefresh={false}+ onAutoRefreshChange={() => {}}+ onRefreshFiles={() => {}}+ onRefreshContent={() => {}}+ onDownload={() => {}}+ onClear={() => {}}+ /></div>- <SectionTitle title="Journal Controls (Filter Chips)" />+ <SectionTitle title="Journal Controls (JournalControls)" /><p className="text-sm text-secondary mb-2">Journal tab with service unit chips and priority filter.</p><div className="card" style={{ padding: 24 }}>- <div className="journal-controls">- <div className="control-group">- <label>Service/Unit</label>- <div className="input-with-suggestions">- <input type="text" placeholder="All services" />- <div className="quick-units">- {['nginx', 'mysql', 'postgresql', 'docker', 'sshd', 'cron'].map(u => (- <button key={u} className={`unit-chip ${u === 'nginx' ? 'active' : ''}`}>{u}</button>- ))}- </div>- </div>- </div>- <div className="control-group">- <label>Lines</label>- <select><option>100</option><option>200</option></select>- </div>- <div className="control-group">- <label>Priority</label>- <select><option>All</option><option>Error</option><option>Warning</option></select>- </div>- <Button>Load Logs</Button>- </div>+ <JournalControls+ unit="nginx"+ onUnitChange={() => {}}+ quickUnits={['nginx', 'mysql', 'postgresql', 'docker', 'sshd', 'cron']}+ lineCount={100}+ onLineCountChange={() => {}}+ priority=""+ onPriorityChange={() => {}}+ onLoad={() => {}}+ /></div><SectionTitle title="Code/Log Viewer Block" />@@ -1157,119 +1076,72 @@ export default function StyleGuide() {<pre>{`Mar 29 14:23:01 srv-01 nginx[1234]: worker process started\nMar 29 14:23:02 srv-01 systemd[1]: Started Nginx HTTP Server\nMar 29 14:23:05 srv-01 sshd[5678]: Accepted publickey for deploy\nMar 29 14:23:12 srv-01 cron[91011]: (root) CMD (/usr/local/bin/backup.sh)`}</pre></div>- <SectionTitle title="Process Table with Usage Bars" />+ <SectionTitle title="Process Table (ProcessTable)" /><p className="text-sm text-secondary mb-2">Table with inline usage bars and action buttons.</p>- <div className="processes-table-wrapper">- <table className="table processes-table" style={{ minWidth: 'auto' }}>- <thead>- <tr>- <th>PID</th>- <th>Name</th>- <th>User</th>- <th>CPU %</th>- <th>Memory %</th>- <th>Status</th>- <th>Actions</th>- </tr>- </thead>- <tbody>- {[- { pid: 1234, name: 'nginx', user: 'www-data', cpu: 12.5, mem: 3.2, status: 'running' },- { pid: 5678, name: 'postgres', user: 'postgres', cpu: 8.1, mem: 15.4, status: 'sleeping' },- { pid: 9012, name: 'node', user: 'deploy', cpu: 45.2, mem: 22.1, status: 'running' },- ].map(p => (- <tr key={p.pid}>- <td className="mono">{p.pid}</td>- <td><div className="process-name"><span>{p.name}</span></div></td>- <td>{p.user}</td>- <td>- <div className="usage-cell">- <div className="usage-bar cpu" style={{ width: `${p.cpu}%` }} />- <span>{p.cpu.toFixed(1)}%</span>- </div>- </td>- <td>- <div className="usage-cell">- <div className="usage-bar memory" style={{ width: `${p.mem}%` }} />- <span>{p.mem.toFixed(1)}%</span>- </div>- </td>- <td><Badge variant={p.status === 'running' ? 'success' : 'warning'}>{p.status}</Badge></td>- <td>- <div className="action-buttons">- <Button size="icon" variant="outline"><XCircle size={12} /></Button>- <Button size="icon" variant="destructive"><AlertTriangle size={12} /></Button>- </div>- </td>- </tr>- ))}- </tbody>- </table>- </div>+ <ProcessTable+ processes={[+ { pid: 1234, name: 'nginx', user: 'www-data', cpu_percent: 12.5, memory_percent: 3.2, memory_info: { rss: 134543872 }, status: 'running' },+ { pid: 5678, name: 'postgres', user: 'postgres', cpu_percent: 8.1, memory_percent: 15.4, memory_info: { rss: 644874240 }, status: 'sleeping' },+ { pid: 9012, name: 'node', user: 'deploy', cpu_percent: 45.2, memory_percent: 22.1, memory_info: { rss: 924844032 }, status: 'running' },+ ]}+ onKill={() => {}}+ onForceKill={() => {}}+ />- <SectionTitle title="Detail Panel" />+ <SectionTitle title="Detail Panel (ProcessDetailsPanel)" /><p className="text-sm text-secondary mb-2">Expandable detail panel below a list/table selection.</p>- <div className="process-details-panel">- <div className="panel-header">- <h3>Process Details</h3>- <Button size="sm" variant="outline">Close</Button>- </div>- <div className="panel-body">- <div className="details-grid">- {[- ['PID', '1234', true], ['Name', 'nginx', false], ['User', 'www-data', false],- ['Status', 'running', false], ['CPU', '12.50%', false], ['Memory', '128.4 MB', false],- ['Threads', '4', false], ['Created', '2026-03-29 08:00:00', false],- ].map(([label, value, mono]) => (- <div key={label} className="detail-item">- <span className="detail-label">{label}</span>- <span className={`detail-value ${mono ? 'mono' : ''}`}>{value}</span>- </div>- ))}- </div>- <div className="command-line">- <span className="detail-label">Command</span>- <code>/usr/sbin/nginx -g 'daemon off;'</code>- </div>- </div>- </div>+ <ProcessDetailsPanel+ process={{+ pid: 1234,+ name: 'nginx',+ user: 'www-data',+ status: 'running',+ cpu_percent: 12.5,+ memory_info: { rss: 134543872 },+ num_threads: 4,+ create_time: 1711700400,+ command: "/usr/sbin/nginx -g 'daemon off;'",+ }}+ onClose={() => {}}+ />- <SectionTitle title="Service Cards Grid" />+ <SectionTitle title="Service Cards Grid (ServiceCard / ServicesGrid)" /><p className="text-sm text-secondary mb-2">Grid of service cards with status dot, metadata, and action buttons.</p>- <div className="services-grid">+ <ServicesGrid>{[{ name: 'nginx', status: 'running', desc: 'HTTP and reverse proxy server', pid: 1234, mem: '48.2 MB' },{ name: 'postgresql', status: 'running', desc: 'PostgreSQL database server', pid: 5678, mem: '256 MB' },{ name: 'redis-server', status: 'inactive', desc: 'In-memory data structure store', pid: null, mem: null },{ name: 'php8.2-fpm', status: 'running', desc: 'PHP FastCGI Process Manager', pid: 3456, mem: '92 MB' },- ].map(s => (- <div key={s.name} className="service-card">- <div className="service-header">- <div className="service-info">- <span className={`status-dot ${s.status === 'running' ? 'success' : 'secondary'}`} />- <h4>{s.name}</h4>- </div>- <Badge variant={s.status === 'running' ? 'success' : 'secondary'}>{s.status}</Badge>- </div>- <p className="service-description">{s.desc}</p>- <div className="service-meta">- {s.pid && <span><span className="meta-label">PID:</span> {s.pid}</span>}- {s.mem && <span><span className="meta-label">Memory:</span> {s.mem}</span>}- </div>- <div className="service-actions">- {s.status === 'running' ? (+ ].map(s => {+ const meta = [+ s.pid && { label: 'PID', value: s.pid },+ s.mem && { label: 'Memory', value: s.mem },+ ].filter(Boolean);+ return (+ <ServiceCard+ key={s.name}+ name={s.name}+ status={s.status}+ description={s.desc}+ meta={meta}+ actions={<>- <Button size="sm" variant="outline">Restart</Button>- <Button size="sm" variant="outline">Stop</Button>+ {s.status === 'running' ? (+ <>+ <Button size="sm" variant="outline">Restart</Button>+ <Button size="sm" variant="outline">Stop</Button>+ </>+ ) : (+ <Button size="sm">Start</Button>+ )}+ <Button size="sm" variant="outline">Logs</Button></>- ) : (- <Button size="sm">Start</Button>- )}- <Button size="sm" variant="outline">Logs</Button>- </div>- </div>- ))}- </div>+ }+ />+ );+ })}+ </ServicesGrid></div>)}diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsxindex 94a166db..04989651 100644--- a/frontend/src/pages/Terminal.jsx+++ b/frontend/src/pages/Terminal.jsx@@ -4,9 +4,12 @@ import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useConfirm } from '../hooks/useConfirm';import { ConfirmDialog } from '../components/ConfirmDialog';+import { LogViewer } from '../components/LogViewer';+import { ProcessTable, ProcessDetailsPanel } from '../components/ProcessTable';+import { ServiceCard, ServicesGrid } from '../components/ServiceCard';+import { JournalControls } from '../components/JournalControls';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';-import { Badge } from '@/components/ui/badge';import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';const VALID_TABS = ['logs', 'journal', 'processes', 'services'];@@ -200,125 +203,27 @@ const LogFilesTab = () => {</div>)}- <div className="logs-layout">- <div className="logs-sidebar">- <div className="sidebar-header">- <h3>Log Files</h3>- <Button variant="outline" size="sm" onClick={loadLogFiles}>- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">- <polyline points="23 4 23 10 17 10"/>- <path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>- </svg>- </Button>- </div>- <div className="log-files-list">- {logFiles.length === 0 ? (- <div className="empty-hint">No log files found</div>- ) : (- logFiles.map((log, index) => (- <div- key={index}- className={`log-file-item ${selectedLog === log.path ? 'active' : ''}`}- onClick={() => loadLogContent(log.path)}- >- <div className={`log-icon ${getLogIcon(log.path)}`}>- <svg viewBox="0 0 24 24" width="16" height="16">- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>- <polyline points="14 2 14 8 20 8"/>- </svg>- </div>- <div className="log-file-info">- <span className="log-file-name">{log.name}</span>- <span className="log-file-path">{log.path}</span>- </div>- <span className="log-file-size">{formatFileSize(log.size)}</span>- </div>- ))- )}- </div>- </div>-- <div className="logs-viewer">- <div className="viewer-toolbar">- <div className="toolbar-left">- <div className="search-input">- <svg viewBox="0 0 24 24" width="16" height="16">- <circle cx="11" cy="11" r="8"/>- <line x1="21" y1="21" x2="16.65" y2="16.65"/>- </svg>- <Input- type="text"- value={searchPattern}- onChange={(e) => setSearchPattern(e.target.value)}- onKeyDown={(e) => e.key === 'Enter' && selectedLog && loadLogContent(selectedLog)}- placeholder="Search pattern..."- />- </div>- <select- value={lineCount}- onChange={(e) => setLineCount(parseInt(e.target.value))}- className="lines-select"- >- <option value={50}>50 lines</option>- <option value={100}>100 lines</option>- <option value={200}>200 lines</option>- <option value={500}>500 lines</option>- <option value={1000}>1000 lines</option>- </select>- </div>- <div className="toolbar-right">- <label className="auto-refresh-toggle">- <input- type="checkbox"- checked={autoRefresh}- onChange={(e) => setAutoRefresh(e.target.checked)}- />- <span>Auto-refresh</span>- </label>- <Button- variant="outline"- size="sm"- onClick={() => selectedLog && loadLogContent(selectedLog)}- disabled={!selectedLog || loadingContent}- >- Refresh- </Button>- <Button- variant="outline"- size="sm"- onClick={handleDownload}- disabled={!logContent}- >- Download- </Button>- <Button- variant="destructive"- size="sm"- onClick={handleClearLog}- disabled={!selectedLog}- >- Clear- </Button>- </div>- </div>-- <div className="log-content" ref={logViewerRef}>- {!selectedLog ? (- <div className="empty-viewer">- <svg viewBox="0 0 24 24" width="48" height="48">- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>- <polyline points="14 2 14 8 20 8"/>- </svg>- <p>Select a log file to view its contents</p>- </div>- ) : loadingContent ? (- <div className="loading">Loading log content...</div>- ) : (- <pre>{logContent}</pre>- )}- </div>- </div>- </div>+ <LogViewer+ files={logFiles}+ selectedPath={selectedLog}+ onSelectFile={(log) => loadLogContent(log.path)}+ onRefreshFiles={loadLogFiles}+ content={selectedLog ? logContent : ''}+ contentLoading={loadingContent}+ contentEmpty="Select a log file to view its contents."+ searchPattern={searchPattern}+ onSearchChange={setSearchPattern}+ onSearchSubmit={() => selectedLog && loadLogContent(selectedLog)}+ lineCount={lineCount}+ onLineCountChange={setLineCount}+ autoRefresh={autoRefresh}+ onAutoRefreshChange={setAutoRefresh}+ onRefreshContent={() => selectedLog && loadLogContent(selectedLog)}+ onDownload={handleDownload}+ onClear={handleClearLog}+ formatFileSize={formatFileSize}+ getLogIconType={(log) => getLogIcon(log.path)}+ /><ConfirmDialogisOpen={confirmState.isOpen}title={confirmState.title}@@ -399,63 +304,20 @@ const JournalTab = () => {return (<div className="journal-container">- <div className="journal-controls">- <div className="control-group">- <label>{isJournalctl ? 'Service/Unit' : 'Filter by service'}</label>- <div className="input-with-suggestions">- <Input- type="text"- value={unit}- onChange={(e) => setUnit(e.target.value)}- placeholder="All services"- />- {isJournalctl && (- <div className="quick-units">- {commonUnits.map(u => (- <button- key={u}- className={`unit-chip ${unit === u ? 'active' : ''}`}- onClick={() => setUnit(unit === u ? '' : u)}- >- {u}- </button>- ))}- </div>- )}- </div>- </div>-- <div className="control-group">- <label>Lines</label>- <select value={lineCount} onChange={(e) => setLineCount(parseInt(e.target.value))}>- <option value={50}>50</option>- <option value={100}>100</option>- <option value={200}>200</option>- <option value={500}>500</option>- </select>- </div>-- {isJournalctl && (- <div className="control-group">- <label>Priority</label>- <select value={priority} onChange={(e) => setPriority(e.target.value)}>- <option value="">All</option>- <option value="0">Emergency</option>- <option value="1">Alert</option>- <option value="2">Critical</option>- <option value="3">Error</option>- <option value="4">Warning</option>- <option value="5">Notice</option>- <option value="6">Info</option>- <option value="7">Debug</option>- </select>- </div>- )}-- <Button onClick={loadJournalLogs} disabled={loading}>- {loading ? 'Loading...' : 'Load Logs'}- </Button>- </div>+ <JournalControls+ unit={unit}+ onUnitChange={setUnit}+ unitLabel={isJournalctl ? 'Service/Unit' : 'Filter by service'}+ quickUnits={commonUnits}+ showQuickUnits={isJournalctl}+ lineCount={lineCount}+ onLineCountChange={setLineCount}+ priority={priority}+ onPriorityChange={setPriority}+ showPriority={isJournalctl}+ loading={loading}+ onLoad={loadJournalLogs}+ />{!isJournalctl && source && (<div className="journal-source-notice">@@ -564,153 +426,21 @@ const ProcessesTab = () => {</div></div>- <div className="processes-table-wrapper">- <table className="table processes-table">- <thead>- <tr>- <th>PID</th>- <th>Name</th>- <th>User</th>- <th>CPU %</th>- <th>Memory %</th>- <th>Memory</th>- <th>Status</th>- <th>Actions</th>- </tr>- </thead>- <tbody>- {filteredProcesses.map(process => (- <tr- key={process.pid}- className={selectedProcess?.pid === process.pid ? 'selected' : ''}- onClick={() => setSelectedProcess(process)}- >- <td className="mono">{process.pid}</td>- <td>- <div className="process-name">- <span>{process.name}</span>- </div>- </td>- <td>{process.user}</td>- <td>- <div className="usage-cell">- <div- className="usage-bar cpu"- style={{ width: `${Math.min(process.cpu_percent || 0, 100)}%` }}- />- <span>{(process.cpu_percent || 0).toFixed(1)}%</span>- </div>- </td>- <td>- <div className="usage-cell">- <div- className="usage-bar memory"- style={{ width: `${Math.min(process.memory_percent || 0, 100)}%` }}- />- <span>{(process.memory_percent || 0).toFixed(1)}%</span>- </div>- </td>- <td>{formatMemory(process.memory_info?.rss)}</td>- <td>- <Badge variant={getStatusVariant(process.status)}>- {process.status}- </Badge>- </td>- <td>- <div className="action-buttons">- <Button- variant="outline"- size="sm"- onClick={(e) => {- e.stopPropagation();- handleKillProcess(process.pid);- }}- title="Kill"- >- <svg viewBox="0 0 24 24" width="12" height="12">- <line x1="18" y1="6" x2="6" y2="18"/>- <line x1="6" y1="6" x2="18" y2="18"/>- </svg>- </Button>- <Button- variant="destructive"- size="sm"- onClick={(e) => {- e.stopPropagation();- handleKillProcess(process.pid, true);- }}- title="Force Kill"- >- <svg viewBox="0 0 24 24" width="12" height="12">- <polygon points="7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"/>- <line x1="15" y1="9" x2="9" y2="15"/>- <line x1="9" y1="9" x2="15" y2="15"/>- </svg>- </Button>- </div>- </td>- </tr>- ))}- </tbody>- </table>- </div>+ <ProcessTable+ processes={filteredProcesses}+ selectedPid={selectedProcess?.pid}+ onSelect={setSelectedProcess}+ onKill={(p) => handleKillProcess(p.pid)}+ onForceKill={(p) => handleKillProcess(p.pid, true)}+ formatMemory={formatMemory}+ getStatusVariant={getStatusVariant}+ />- {selectedProcess && (- <div className="process-details-panel">- <div className="panel-header">- <h3>Process Details</h3>- <Button variant="outline" size="sm" onClick={() => setSelectedProcess(null)}>- Close- </Button>- </div>- <div className="panel-body">- <div className="details-grid">- <div className="detail-item">- <span className="detail-label">PID</span>- <span className="detail-value mono">{selectedProcess.pid}</span>- </div>- <div className="detail-item">- <span className="detail-label">Name</span>- <span className="detail-value">{selectedProcess.name}</span>- </div>- <div className="detail-item">- <span className="detail-label">User</span>- <span className="detail-value">{selectedProcess.user}</span>- </div>- <div className="detail-item">- <span className="detail-label">Status</span>- <span className="detail-value">{selectedProcess.status}</span>- </div>- <div className="detail-item">- <span className="detail-label">CPU</span>- <span className="detail-value">{(selectedProcess.cpu_percent || 0).toFixed(2)}%</span>- </div>- <div className="detail-item">- <span className="detail-label">Memory</span>- <span className="detail-value">{formatMemory(selectedProcess.memory_info?.rss)}</span>- </div>- <div className="detail-item">- <span className="detail-label">Threads</span>- <span className="detail-value">{selectedProcess.num_threads}</span>- </div>- <div className="detail-item">- <span className="detail-label">Created</span>- <span className="detail-value">- {selectedProcess.create_time- ? new Date(selectedProcess.create_time * 1000).toLocaleString()- : '-'}- </span>- </div>- </div>- {selectedProcess.command && (- <div className="command-line">- <span className="detail-label">Command</span>- <code>{selectedProcess.command}</code>- </div>- )}- </div>- </div>- )}+ <ProcessDetailsPanel+ process={selectedProcess}+ onClose={() => setSelectedProcess(null)}+ formatMemory={formatMemory}+ /><ConfirmDialogisOpen={confirmState.isOpen}title={confirmState.title}@@ -796,82 +526,70 @@ const ServicesTab = () => {</Button></div>- <div className="services-grid">- {services.length === 0 ? (- <div className="empty-state">- <p>No services found</p>- </div>- ) : (- services.map(service => (- <div key={service.name} className="service-card">- <div className="service-header">- <div className="service-info">- <span className={`status-dot ${getServiceStatusVariant(service.status)}`} />- <h4>{service.name}</h4>- </div>- <Badge variant={getServiceStatusVariant(service.status)}>- {service.status}- </Badge>- </div>-- {service.description && (- <p className="service-description">{service.description}</p>- )}-- <div className="service-meta">- {service.pid && (- <span className="meta-item">- <span className="meta-label">PID:</span> {service.pid}- </span>- )}- {service.memory && (- <span className="meta-item">- <span className="meta-label">Memory:</span> {service.memory}- </span>- )}- </div>-- <div className="service-actions">- {service.status === 'running' || service.status === 'active' ? (+ {services.length === 0 ? (+ <div className="empty-state">+ <p>No services found</p>+ </div>+ ) : (+ <ServicesGrid>+ {services.map(service => {+ const meta = [+ service.pid && { label: 'PID', value: service.pid },+ service.memory && { label: 'Memory', value: service.memory },+ ].filter(Boolean);+ const isRunning = service.status === 'running' || service.status === 'active';+ return (+ <ServiceCard+ key={service.name}+ name={service.name}+ description={service.description}+ status={service.status}+ statusVariant={getServiceStatusVariant(service.status)}+ meta={meta}+ actions={<>+ {isRunning ? (+ <>+ <Button+ variant="outline"+ size="sm"+ onClick={() => handleServiceAction(service.name, 'restart')}+ disabled={actionLoading === `${service.name}-restart`}+ >+ {actionLoading === `${service.name}-restart` ? '...' : 'Restart'}+ </Button>+ <Button+ variant="outline"+ size="sm"+ onClick={() => handleServiceAction(service.name, 'stop')}+ disabled={actionLoading === `${service.name}-stop`}+ >+ {actionLoading === `${service.name}-stop` ? '...' : 'Stop'}+ </Button>+ </>+ ) : (+ <Button+ size="sm"+ onClick={() => handleServiceAction(service.name, 'start')}+ disabled={actionLoading === `${service.name}-start`}+ >+ {actionLoading === `${service.name}-start` ? '...' : 'Start'}+ </Button>+ )}<Buttonvariant="outline"size="sm"- onClick={() => handleServiceAction(service.name, 'restart')}- disabled={actionLoading === `${service.name}-restart`}+ onClick={() => viewServiceLogs(service.name)}>- {actionLoading === `${service.name}-restart` ? '...' : 'Restart'}- </Button>- <Button- variant="outline"- size="sm"- onClick={() => handleServiceAction(service.name, 'stop')}- disabled={actionLoading === `${service.name}-stop`}- >- {actionLoading === `${service.name}-stop` ? '...' : 'Stop'}+ Logs</Button></>- ) : (- <Button- size="sm"- onClick={() => handleServiceAction(service.name, 'start')}- disabled={actionLoading === `${service.name}-start`}- >- {actionLoading === `${service.name}-start` ? '...' : 'Start'}- </Button>- )}- <Button- variant="outline"- size="sm"- onClick={() => viewServiceLogs(service.name)}- >- Logs- </Button>- </div>- </div>- ))- )}- </div>+ }+ />+ );+ })}+ </ServicesGrid>+ )}{/* Service Logs Modal */}{showLogsModal && (