diff --git a/frontend/src/components/config/util.tsx b/frontend/src/components/config/util.tsx index 2f65db155..f179f4973 100644 --- a/frontend/src/components/config/util.tsx +++ b/frontend/src/components/config/util.tsx @@ -26,7 +26,7 @@ export const ConfigItem = ({ }) => (
diff --git a/frontend/src/resources/build/components/config.tsx b/frontend/src/resources/build/components/config.tsx index 3df058a40..728f28ef6 100644 --- a/frontend/src/resources/build/components/config.tsx +++ b/frontend/src/resources/build/components/config.tsx @@ -1,110 +1,66 @@ -import { ConfigAgain } from "@components/config/again"; import { AccountSelector, ResourceSelector } from "@components/config/util"; import { useWrite, useRead } from "@hooks"; -import { ConfigLayout } from "@layouts/page"; +import { ConfigInner } from "@layouts/page"; import { Types } from "@monitor/client"; -import { Button } from "@ui/button"; -import { Card, CardHeader, CardTitle, CardContent } from "@ui/card"; import { useState } from "react"; -const BuildConfigInner = ({ - id, - config, -}: { - id: string; - config: Types.BuildConfig; -}) => { - const [update, set] = useState>({}); - const [show, setShow] = useState("general"); - const { mutate } = useWrite("UpdateBuild"); - - return ( - mutate({ id, config: update })} - onReset={() => set({})} - > -
-
- {["general", "docker", "volumes"].map((item) => ( - - ))} -
- - - {show} - - - {/* General Config */} - {show === "general" && ( - set((p) => ({ ...p, ...u }))} - components={{ - builder_id: (id, set) => ( -
-
Builder
- set({ builder_id })} - /> -
- ), - repo: true, - branch: true, - github_account: (account, set) => ( - set({ github_account })} - /> - ), - }} - /> - )} - - {/* Docker Config */} - {show === "docker" && ( - set((p) => ({ ...p, ...u }))} - components={{ - build_path: true, - dockerfile_path: true, - docker_account: (account, set) => ( - set({ docker_account })} - /> - ), - // docker_organization, - use_buildx: true, - }} - /> - )} -
-
-
-
- ); -}; - export const BuildConfig = ({ id }: { id: string }) => { const config = useRead("GetBuild", { id }).data?.config; + const [update, set] = useState>({}); + const { mutate } = useWrite("UpdateBuild"); + if (!config) return null; - return ; + + return ( + mutate({ id, config: update })} + components={{ + general: { + general: { + builder_id: (id, set) => ( +
+
Builder
+ set({ builder_id })} + /> +
+ ), + repo: true, + branch: true, + github_account: (account, set) => ( + set({ github_account })} + /> + ), + }, + }, + docker: { + docker: { + build_path: true, + dockerfile_path: true, + docker_account: (account, set) => ( + set({ docker_account })} + /> + ), + use_buildx: true, + // docker_organization, + }, + }, + }} + /> + ); }; diff --git a/frontend/src/resources/builder/config.tsx b/frontend/src/resources/builder/config.tsx index 05bb38de7..15ba96c11 100644 --- a/frontend/src/resources/builder/config.tsx +++ b/frontend/src/resources/builder/config.tsx @@ -64,7 +64,7 @@ const BuilderConfigInner = ({ >
- +