);
-const ImageConfig = ({
+export const ImageConfig = ({
image,
set,
}: {
diff --git a/frontend/src/resources/deployment/index.tsx b/frontend/src/resources/deployment/index.tsx
index e5de430f7..68d6d11a1 100644
--- a/frontend/src/resources/deployment/index.tsx
+++ b/frontend/src/resources/deployment/index.tsx
@@ -1,14 +1,22 @@
+import { ConfigAgain } from "@components/config/again";
import { ResourceUpdates } from "@components/updates/resource";
-import { useAddRecentlyViewed, useRead } from "@hooks";
+import { useAddRecentlyViewed, useRead, useWrite } from "@hooks";
import { ResourceCard } from "@layouts/card";
+import { ConfigLayout } from "@layouts/page";
import { Resource } from "@layouts/resource";
+import { Types } from "@monitor/client";
import {
RedeployContainer,
StartOrStopContainer,
RemoveContainer,
} from "@resources/deployment/components/actions";
import { DeploymentLogs } from "@resources/deployment/components/deployment-logs";
-import { DeploymentConfig } from "@resources/deployment/config";
+import {
+ EnvVars,
+ ImageConfig,
+ PortsConfig,
+ ServersSelector,
+} from "@resources/deployment/config";
import {
DeploymentBuild,
DeploymentName,
@@ -16,9 +24,151 @@ import {
DeploymentStatus,
DeploymentStatusIcon,
} from "@resources/deployment/util";
-import { CardDescription } from "@ui/card";
+import { Button } from "@ui/button";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@ui/card";
+import { useState } from "react";
import { Link, useParams } from "react-router-dom";
+export const DeploymentCard = ({ id }: { id: string }) => {
+ const deployments = useRead("ListDeployments", {}).data;
+ const deployment = deployments?.find((d) => d.id === id);
+ if (!deployment) return null;
+ return (
+
+
}
+ >
+
+
+
+
+
+
+ );
+};
+
+const DeploymentConfigInner = ({
+ id,
+ config,
+}: {
+ id: string;
+ config: Types.DeploymentConfig;
+}) => {
+ const [update, set] = useState
>({});
+ const [show, setShow] = useState("general");
+ const { mutate } = useWrite("UpdateDeployment");
+
+ return (
+ mutate({ id, config: update })}
+ onReset={() => set({})}
+ >
+
+
+ {["general", "networking", "environment", "volumes"].map((item) => (
+
+ ))}
+
+
+
+ {show}
+
+
+ {/* General Config */}
+ {show === "general" && (
+ set((p) => ({ ...p, ...u }))}
+ components={{
+ server_id: (value, set) => (
+
+ Server
+ set({ server_id })}
+ />
+
+ ),
+ image: (value, set) => (
+
+ ),
+ restart: true,
+ }}
+ />
+ )}
+
+ {/* Networking Config */}
+ {show === "networking" && (
+ set((p) => ({ ...p, ...u }))}
+ components={{
+ network: true,
+ ports: (value, set) => (
+
+ ),
+ }}
+ />
+ )}
+
+ {/* Environment Config */}
+ {show === "environment" && (
+ set((p) => ({ ...p, ...u }))}
+ components={{
+ skip_secret_interp: true,
+ environment: (value, set) => (
+
+ ),
+ }}
+ />
+ )}
+
+ {/* Environment Config */}
+ {show === "volumes" && (
+ set((p) => ({ ...p, ...u }))}
+ components={{
+ volumes: (value, set) => (
+
+ ),
+ }}
+ />
+ )}
+
+
+
+
+ );
+};
+
+const DeploymentConfig = ({ id }: { id: string }) => {
+ const config = useRead("GetDeployment", { id }).data?.config;
+ if (!config) return null;
+ return ;
+};
+
export const DeploymentPage = () => {
const id = useParams().deploymentId;
if (!id) return null;
@@ -49,27 +199,7 @@ export const DeploymentPage = () => {
>
-
+
);
};
-
-export const DeploymentCard = ({ id }: { id: string }) => {
- const deployments = useRead("ListDeployments", {}).data;
- const deployment = deployments?.find((d) => d.id === id);
- if (!deployment) return null;
- return (
-
- }
- >
-
-
-
-
-
-
- );
-};
diff --git a/frontend/src/resources/deployment/util.tsx b/frontend/src/resources/deployment/util.tsx
index 1bf6fa864..9196746d5 100644
--- a/frontend/src/resources/deployment/util.tsx
+++ b/frontend/src/resources/deployment/util.tsx
@@ -22,7 +22,7 @@ export const DeploymentStatus = ({
}) => {
const deployments = useRead("ListDeployments", {}).data;
const deployment = deployments?.find((d) => d.id === deploymentId);
- return <>{deployments ? deployment?.status ?? "not deployed" : "..."}>;
+ return <>{deployments ? deployment?.info.status ?? "not deployed" : "..."}>;
};
export const DeploymentStatusIcon = ({
@@ -32,7 +32,7 @@ export const DeploymentStatusIcon = ({
}) => {
const deployments = useRead("ListDeployments", {}).data;
const deployment = deployments?.find((d) => d.id === deploymentId);
- const s = deployment?.state;
+ const s = deployment?.info.state;
const color = () => {
if (s === DockerContainerState.Running) return "fill-green-500";
@@ -54,8 +54,8 @@ export const DeploymentServer = ({
return (
- {deployment?.server_id ? (
-
+ {deployment?.info.server_id ? (
+
) : (
"n/a"
)}
@@ -69,7 +69,11 @@ export const DeploymentBuild = ({ deploymentId }: { deploymentId: string }) => {
return (
- {deployment?.build_id ? : "n/a"}
+ {deployment?.info.build_id ? (
+
+ ) : (
+ "n/a"
+ )}
);
};