"use client"; import { ArrowLeft, ExternalLink, Play, RotateCw, Square, Trash2 } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import type { BusinessStatus } from "@/services/management/types"; function formatBytes(value: number | null) { return value === null ? "Not available" : value < 1024 * 1024 ? `${Math.round(value / 1024)} KB` : `${(value / 1024 / 1024).toFixed(1)} MB`; } export function ManagerBusinessDetail({ business: initialBusiness, dockgeUrl }: { business: BusinessStatus; dockgeUrl: string }) { const [business, setBusiness] = useState(initialBusiness); const [pending, setPending] = useState(null); const [logs, setLogs] = useState(null); const [error, setError] = useState(null); async function action(actionName: string) { if (actionName === "remove" && !window.confirm("Remove the application deployment? The database and media volume will be kept.")) return; setPending(actionName); setError(null); const response = await fetch(`/api/manager/businesses/${business.slug}/actions`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action: actionName }) }); const result = await response.json(); setPending(null); if (!response.ok) { setError(result.error ?? "Action failed."); return; } if (actionName === "remove") { window.location.assign("/manager"); return; } setBusiness(result); } async function showLogs() { setPending("logs"); const response = await fetch(`/api/manager/businesses/${business.slug}/logs`); setLogs(await response.text()); setPending(null); } return
Businesses

Business deployment

{business.name}

{business.domain} ยท {business.slug}

Runtime

Application version
{business.image}
Container
{business.container}
Health
{business.health}
Database
{business.database}
Media storage
{formatBytes(business.storageBytes)}
Last updated
{new Date(business.updatedAt).toLocaleString()}

Manage deployment

{dockgeUrl && }

Update is explicit and uses the image pinned to this business. Removing the application does not delete its database or media volume.

{error &&

{error}

}{logs !== null &&

Recent logs

{logs}
}
; }