Renamed deploy app to instsall
This commit is contained in:
@@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
|
|||||||
import testAuth from "../auth";
|
import testAuth from "../auth";
|
||||||
import { StatusCodes } from "http-status-codes";
|
import { StatusCodes } from "http-status-codes";
|
||||||
import {
|
import {
|
||||||
deployNewApp,
|
installApp,
|
||||||
getApplications,
|
getApplications,
|
||||||
removeApp,
|
removeApp,
|
||||||
} from "@/core/server/application";
|
} from "@/core/server/application";
|
||||||
@@ -44,7 +44,7 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await deployNewApp(name, repo, nodeId);
|
const res = await installApp(name, repo, nodeId);
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
message: "ok",
|
message: "ok",
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { DashboardLayout } from "@/components/dashboard/DashboardLayout";
|
|||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Play, Square, MoreVertical, Plus } from "lucide-react";
|
import { Play, Square, MoreVertical, Plus, Rocket } from "lucide-react";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import { Progress } from "@/components/ui/progress";
|
||||||
import DeployApplication from "@/components/dialogs/DeployApplication";
|
import InstallApplicationDialog from "@/components/dialogs/InstallApplication";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { ImageApp } from "@/lib/types";
|
import { ImageApp } from "@/lib/types";
|
||||||
import { getApplications, removeApp } from "@/core/application";
|
import { getApplications, removeApp } from "@/core/application";
|
||||||
@@ -34,7 +34,7 @@ export default function ApplicationsPage() {
|
|||||||
return (
|
return (
|
||||||
<DashboardLayout
|
<DashboardLayout
|
||||||
title="Applications"
|
title="Applications"
|
||||||
subtitle="Manage deployed applications"
|
subtitle="Manage installed applications"
|
||||||
>
|
>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-6">
|
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-6">
|
||||||
@@ -45,12 +45,12 @@ export default function ApplicationsPage() {
|
|||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DeployApplication>
|
<InstallApplicationDialog>
|
||||||
<Button size="sm" className="gap-2 w-full sm:w-auto">
|
<Button size="sm" className="gap-2 w-full sm:w-auto">
|
||||||
<Plus className="w-4 h-4" />
|
<Plus className="w-4 h-4" />
|
||||||
Deploy Application
|
Install Application
|
||||||
</Button>
|
</Button>
|
||||||
</DeployApplication>
|
</InstallApplicationDialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
@@ -137,7 +137,7 @@ export default function ApplicationsPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button variant="ghost" size="icon-sm">
|
<Button variant="ghost" size="icon-sm">
|
||||||
<Play className="w-3 h-3" />
|
<Rocket className="w-3 h-3" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<RemoveDialog
|
<RemoveDialog
|
||||||
|
|||||||
+4
-4
@@ -16,9 +16,9 @@ import { Label } from "@/components/ui/label";
|
|||||||
import { getLiveNodes } from "@/core/node";
|
import { getLiveNodes } from "@/core/node";
|
||||||
import { Combobox } from "../ui/combobox";
|
import { Combobox } from "../ui/combobox";
|
||||||
import { Node, NodeLiveData } from "@/lib/types";
|
import { Node, NodeLiveData } from "@/lib/types";
|
||||||
import { deployNewApp } from "@/core/application";
|
import { installApp } from "@/core/application";
|
||||||
|
|
||||||
export default function DeployApplication({
|
export default function InstallApplicationDialog({
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
@@ -36,7 +36,7 @@ export default function DeployApplication({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const deploy = async () => {
|
const deploy = async () => {
|
||||||
console.log(await deployNewApp(name, repo, node));
|
console.log(await installApp(name, repo, node));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -45,7 +45,7 @@ export default function DeployApplication({
|
|||||||
|
|
||||||
<DialogContent className="sm:max-w-106.25">
|
<DialogContent className="sm:max-w-106.25">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Deploy Application</DialogTitle>
|
<DialogTitle>Install Application</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="grid gap-4">
|
<div className="grid gap-4">
|
||||||
@@ -5,7 +5,7 @@ import { getNodes } from "./node";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Env, EnvVariable, ImageApp } from "@/lib/types";
|
import { Env, EnvVariable, ImageApp } from "@/lib/types";
|
||||||
|
|
||||||
export async function deployNewApp(name: string, repo: string, nodeId: string) {
|
export async function installApp(name: string, repo: string, nodeId: string) {
|
||||||
if (await verifySession()) {
|
if (await verifySession()) {
|
||||||
throw new Error("Unauthorized");
|
throw new Error("Unauthorized");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export async function getApplications(): Promise<ImageApp[]> {
|
|||||||
return apps;
|
return apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deployNewApp(name: string, repo: string, nodeId: string) {
|
export async function installApp(name: string, repo: string, nodeId: string) {
|
||||||
// Create app ID
|
// Create app ID
|
||||||
const appId = `app_${randomUUID()}`;
|
const appId = `app_${randomUUID()}`;
|
||||||
const appDir = path.join(DATA_DIR, appId);
|
const appDir = path.join(DATA_DIR, appId);
|
||||||
|
|||||||
Reference in New Issue
Block a user