From 999ce044cb4417fd4c85d741668bba35c607905d Mon Sep 17 00:00:00 2001 From: karamvir Date: Sat, 5 Aug 2023 22:45:17 -0700 Subject: [PATCH] add ui for extra args override --- frontend/src/resources/build/config.tsx | 137 +++++++++++++++--------- 1 file changed, 86 insertions(+), 51 deletions(-) diff --git a/frontend/src/resources/build/config.tsx b/frontend/src/resources/build/config.tsx index a3a91117b..2f87ecfca 100644 --- a/frontend/src/resources/build/config.tsx +++ b/frontend/src/resources/build/config.tsx @@ -3,7 +3,8 @@ import { useRead, useWrite } from "@hooks"; import { Section } from "@layouts/page"; import { Types } from "@monitor/client"; import { Button } from "@ui/button"; -import { Settings, Save, History } from "lucide-react"; +import { Input } from "@ui/input"; +import { Settings, Save, History, Trash, PlusCircle } from "lucide-react"; import { useState } from "react"; import { useParams } from "react-router-dom"; @@ -13,54 +14,88 @@ export const BuildConfig = () => { const [update, set] = useState>({}); const { mutate, isLoading } = useWrite("UpdateBuild"); - if (id && build?.config) { - return ( -
} - actions={ -
- - -
- } - > - set((update) => ({ ...update, ...input }))} - layout={{ - // general: ["version"], - repo: ["repo", "branch", "github_account"], - docker: [ - "build_path", - "dockerfile_path", - "docker_account", - "docker_organization", - "use_buildx", - ], - pre_build: ["pre_build"], - build_args: ["build_args"], - extra_args: ["extra_args"], - }} - // overrides={{ - // pre_build: (val, set) => {}, - // }} - /> - {/* */} -
- ); - } else { - // loading - return null; - } + if (!id || !build) return null; + + return ( +
} + actions={ +
+ + +
+ } + > + set((update) => ({ ...update, ...input }))} + layout={{ + repo: ["repo", "branch", "github_account"], + docker: [ + "build_path", + "dockerfile_path", + "docker_account", + "docker_organization", + "use_buildx", + ], + pre_build: ["pre_build"], + build_args: ["build_args"], + extra_args: ["extra_args"], + }} + overrides={{ + extra_args: (args, set) => ( +
+ {args?.map((arg, i) => { + if (!args) return null; + return ( +
+ { + if (args) { + args[i] = e.target.value; + set({ extra_args: [...args] }); + } + }} + /> + +
+ ); + })} + +
+ ), + }} + /> +
+ ); };