- Docker table: Restart and Stop buttons per container row (docker_compose_restart / docker_compose_stop) - Git repos list: Fetch and Pull buttons per repo; Pull disabled when working tree is dirty - systemd units list: Restart button per unit (systemctl_restart) - Caddy: Edit link on /caddy page, new /caddy/edit page with textarea + 3-step Validate → Save+Reload flow - All buttons open ConfirmDialog with exact agent-call preview, then stream output via StreamingTerminal - Add docker_compose_stop to ops-agent/commands.yml.example Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { redirect } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { getCurrentUser } from '@/lib/session'
|
|
import { execAgent } from '@/lib/agent-client'
|
|
import CaddyEditor from '../_components/caddy-editor'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export default async function CaddyEditPage() {
|
|
const user = await getCurrentUser()
|
|
if (!user) redirect('/login')
|
|
|
|
let initialContent = ''
|
|
let initialError: string | null = null
|
|
try {
|
|
initialContent = await execAgent('caddy_show_config')
|
|
} catch (err) {
|
|
initialError = err instanceof Error ? err.message : 'failed to load config'
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-background p-6">
|
|
<div className="mx-auto max-w-4xl space-y-6">
|
|
<div className="flex items-center gap-4">
|
|
<Link
|
|
href="/caddy"
|
|
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
|
>
|
|
← Caddy
|
|
</Link>
|
|
<div>
|
|
<h1 className="text-2xl font-semibold tracking-tight">Edit Caddyfile</h1>
|
|
<p className="text-sm text-muted-foreground">
|
|
Edit, validate, then save and reload Caddy
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<CaddyEditor initialContent={initialContent} initialError={initialError} />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|