Deploy MVP

This commit is contained in:
2026-01-02 23:35:40 +01:00
parent f9bbfc7f0a
commit 555b94b9b2
5 changed files with 220 additions and 28 deletions
+6 -7
View File
@@ -1,7 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import testAuth from "../auth";
import { StatusCodes } from "http-status-codes";
import { getDeployments } from "@/core/deployment";
import { deployApp, getDeployments } from "@/core/deployment";
import { getApplications } from "@/core/application";
export async function GET(req: NextRequest): Promise<NextResponse> {
@@ -26,8 +26,7 @@ export async function GET(req: NextRequest): Promise<NextResponse> {
export async function POST(req: NextRequest): Promise<NextResponse> {
const auth = await testAuth(req);
const { name, repo, nodeId }: { name: string; repo: string; nodeId: string } =
await req.json();
const { name, appId }: { name: string; appId: string } = await req.json();
if (auth) {
return NextResponse.json(
@@ -36,17 +35,17 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
);
}
if (!name || !repo || !nodeId) {
if (!name || !appId) {
return NextResponse.json(
{ message: "Body missing name, repo, nodeId" },
{ message: "Body missing name, appId, nodeId" },
{ status: StatusCodes.BAD_REQUEST }
);
}
const res = await installApp(name, repo, nodeId);
const deployId = await deployApp(name, appId);
return NextResponse.json({
message: "ok",
...res,
deployId,
});
}
+7 -4
View File
@@ -17,6 +17,7 @@ import { Application, Deployment } from "@/lib/types";
import { getDeployments } from "@/lib/dockship/deploy";
import { getApplications } from "@/lib/dockship/application";
import { cn } from "@/lib/utils";
import DeployAppDialog from "@/components/dialogs/DeployApp";
export default function DeploymentsPage() {
const [applications, setApplications] = useState<Application[]>([]);
@@ -39,10 +40,12 @@ export default function DeploymentsPage() {
<div className="flex flex-row gap-3 items-center justify-between mb-6">
<Badge>{deployments.length} deployments</Badge>
<Button size="sm" className="gap-2 self-auto">
<Plus className="w-4 h-4" />
New Deployment
</Button>
<DeployAppDialog>
<Button size="sm" className="gap-2 self-auto">
<Plus className="w-4 h-4" />
New Deployment
</Button>
</DeployAppDialog>
</div>
<div className="hidden md:visible space-y-3">