api+ui: kind-scoped save/delete endpoints and links

API: /config/{services,jobs,tools,static}/{name} now pin the twin they
target — _save_deployment/_delete_deployment take an explicit kind so a
patch to a 'backup' service can't bleed into a 'backup' job/tool. Add
/tools and /static endpoints; keep /deployments/{name} kind-agnostic.
New test_kind_twins proves per-kind save/delete isolation on disk.

UI: ConfigPanel and CreateDeploymentForm write to the kind-scoped
resource; GatewayPanel/NodeDetail/DeploymentsSection link via a shared
detailPath(name, kind) helper instead of the ambiguous /deployment/:name.

Includes incidental ruff-format reflow of untouched api files.
This commit is contained in:
2026-07-06 02:51:08 -07:00
parent 0cb41851cf
commit 20bf78caf1
24 changed files with 353 additions and 98 deletions

View File

@@ -3,6 +3,7 @@ import { ArrowLeft, Server } from "lucide-react"
import { useNode } from "@/services/api/hooks"
import { KindBadge } from "@/components/KindBadge"
import { StackBadge } from "@/components/StackBadge"
import { detailPath } from "@/lib/labels"
import { cn } from "@/lib/utils"
export function NodeDetailPage() {
@@ -77,7 +78,7 @@ export function NodeDetailPage() {
>
<td className="px-3 py-2.5">
<Link
to={`/deployment/${comp.id}`}
to={detailPath(comp.id, comp.kind ?? "service")}
className="font-medium hover:text-[var(--primary)] transition-colors"
>
{comp.id}

View File

@@ -50,24 +50,16 @@ export function ScheduledDetailPage() {
<Clock size={14} className="shrink-0 text-[var(--muted)]" />
{deployment.schedule}
</span>
{deployment.systemd && (
<>
<span className="text-[var(--muted)]">Timer unit</span>
<span className="font-mono break-all">
{deployment.systemd.unit_name.replace(".service", ".timer")}
</span>
</>
)}
</div>
</div>
)}
<ConfigPanel deployment={deployment} configSection="jobs" onRefetch={refetch} />
{deployment.systemd && (
<SystemdPanel name={deployment.id} systemd={deployment.systemd} />
)}
<ConfigPanel deployment={deployment} configSection="jobs" onRefetch={refetch} />
{deployment.managed && (
<div className="mb-6">
<h2 className="text-lg font-semibold mb-3">Logs</h2>

View File

@@ -146,10 +146,6 @@ export function ServiceDetailPage() {
</div>
</div>
{deployment.systemd && (
<SystemdPanel name={deployment.id} systemd={deployment.systemd} />
)}
{isGateway && caddyfile?.content && (
<div className="bg-[var(--card)] border border-[var(--border)] rounded-lg p-5 mb-6">
<h2 className="text-sm font-semibold text-[var(--muted)] uppercase tracking-wider mb-1">
@@ -170,6 +166,10 @@ export function ServiceDetailPage() {
onRefetch={refetch}
/>
{deployment.systemd && (
<SystemdPanel name={deployment.id} systemd={deployment.systemd} />
)}
{deployment.managed && (
<div className="mb-6">
<h2 className="text-lg font-semibold mb-3">Logs</h2>