Files
supervisor-ui/app/page.tsx
Sebastian Krüger e0cfd371c0
Some checks failed
Build and Push Docker Image to Gitea / build-and-push (push) Failing after 1m22s
feat: initial commit - Supervisor UI with Next.js 16 and Tailwind CSS 4
- Modern web interface for Supervisor process management
- Built with Next.js 16 (App Router) and Tailwind CSS 4
- Full XML-RPC client implementation for Supervisor API
- Real-time process monitoring with auto-refresh
- Process control: start, stop, restart operations
- Modern dashboard with system status and statistics
- Dark/light theme with OKLCH color system
- Docker multi-stage build with runtime env var configuration
- Gitea CI/CD workflow for automated builds
- Comprehensive documentation (README, IMPLEMENTATION, DEPLOYMENT)

Features:
- Backend proxy pattern for secure API communication
- React Query for state management and caching
- TypeScript strict mode with Zod validation
- Responsive design with mobile support
- Health check endpoint for monitoring
- Non-root user security in Docker

Environment Variables:
- SUPERVISOR_HOST, SUPERVISOR_PORT
- SUPERVISOR_USERNAME, SUPERVISOR_PASSWORD (optional)
- Configurable at build-time and runtime

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 18:23:51 +01:00

136 lines
5.3 KiB
TypeScript

'use client';
import { Activity, Server, FileText, Settings } from 'lucide-react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { SystemStatus } from '@/components/process/SystemStatus';
import { useProcesses } from '@/lib/hooks/useSupervisor';
import { ProcessState } from '@/lib/supervisor/types';
export default function HomePage() {
const { data: processes, isLoading } = useProcesses();
const stats = {
total: processes?.length ?? 0,
running: processes?.filter((p) => p.state === ProcessState.RUNNING).length ?? 0,
stopped: processes?.filter((p) => p.state === ProcessState.STOPPED || p.state === ProcessState.EXITED).length ?? 0,
fatal: processes?.filter((p) => p.state === ProcessState.FATAL).length ?? 0,
};
return (
<div className="space-y-8 animate-fade-in">
{/* Header */}
<div>
<h1 className="text-4xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
Supervisor Dashboard
</h1>
<p className="text-muted-foreground mt-2">
Monitor and manage your processes in real-time
</p>
</div>
{/* System Status */}
<SystemStatus />
{/* Process Statistics */}
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-4">
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Total Processes</CardTitle>
<Activity className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">{isLoading ? '...' : stats.total}</div>
<p className="text-xs text-muted-foreground mt-1">
All configured processes
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Running</CardTitle>
<div className="h-3 w-3 rounded-full bg-success animate-pulse-slow" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-success">{isLoading ? '...' : stats.running}</div>
<p className="text-xs text-muted-foreground mt-1">
Active processes
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Stopped</CardTitle>
<div className="h-3 w-3 rounded-full bg-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-muted-foreground">{isLoading ? '...' : stats.stopped}</div>
<p className="text-xs text-muted-foreground mt-1">
Inactive processes
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Fatal</CardTitle>
<div className="h-3 w-3 rounded-full bg-destructive animate-pulse-slow" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-destructive">{isLoading ? '...' : stats.fatal}</div>
<p className="text-xs text-muted-foreground mt-1">
Failed processes
</p>
</CardContent>
</Card>
</div>
{/* Quick Actions */}
<div className="grid gap-6 md:grid-cols-3">
<Card className="hover:shadow-lg transition-shadow cursor-pointer" onClick={() => window.location.href = '/processes'}>
<CardHeader>
<div className="flex items-center gap-3">
<div className="p-3 rounded-lg bg-primary/10">
<Server className="h-6 w-6 text-primary" />
</div>
<div>
<CardTitle>Manage Processes</CardTitle>
<CardDescription>Start, stop, and restart</CardDescription>
</div>
</div>
</CardHeader>
</Card>
<Card className="hover:shadow-lg transition-shadow cursor-pointer" onClick={() => window.location.href = '/logs'}>
<CardHeader>
<div className="flex items-center gap-3">
<div className="p-3 rounded-lg bg-accent/10">
<FileText className="h-6 w-6 text-accent" />
</div>
<div>
<CardTitle>View Logs</CardTitle>
<CardDescription>Monitor process output</CardDescription>
</div>
</div>
</CardHeader>
</Card>
<Card className="hover:shadow-lg transition-shadow cursor-pointer" onClick={() => window.location.href = '/config'}>
<CardHeader>
<div className="flex items-center gap-3">
<div className="p-3 rounded-lg bg-success/10">
<Settings className="h-6 w-6 text-success" />
</div>
<div>
<CardTitle>Configuration</CardTitle>
<CardDescription>Manage settings</CardDescription>
</div>
</div>
</CardHeader>
</Card>
</div>
</div>
);
}