From 2a3f223a2b7fedc09b949e6d602dce13a25ada30 Mon Sep 17 00:00:00 2001 From: kv Date: Tue, 12 Sep 2023 14:24:38 -0700 Subject: [PATCH] init repo config --- frontend-v2/index.html | 2 +- .../src/components/resources/repo/index.tsx | 49 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/frontend-v2/index.html b/frontend-v2/index.html index 066bac405..481538709 100644 --- a/frontend-v2/index.html +++ b/frontend-v2/index.html @@ -4,7 +4,7 @@ - Vite + React + TS + Monitor
diff --git a/frontend-v2/src/components/resources/repo/index.tsx b/frontend-v2/src/components/resources/repo/index.tsx index f065be772..90d8a6d24 100644 --- a/frontend-v2/src/components/resources/repo/index.tsx +++ b/frontend-v2/src/components/resources/repo/index.tsx @@ -1,6 +1,10 @@ -import { useRead } from "@lib/hooks"; +import { ConfigInner } from "@components/config"; +import { AccountSelector, ResourceSelector } from "@components/config/util"; +import { useRead, useWrite } from "@lib/hooks"; +import { Types } from "@monitor/client"; import { RequiredResourceComponents } from "@types"; import { GitBranch } from "lucide-react"; +import { useState } from "react"; const useRepo = (id?: string) => useRead("ListRepos", {}).data?.find((d) => d.id === id); @@ -10,7 +14,48 @@ export const Repo: RequiredResourceComponents = { Description: ({ id }) => <>{id}, Info: ({ id }) => <>{id}, Icon: () => , - Page: {}, + Page: { + Config: ({ id }) => { + const config = useRead("GetRepo", { id }).data?.config; + const [update, set] = useState>({}); + const mutate = useWrite("UpdateRepo"); + if (!config) return null; + return ( + mutate} + components={{ + general: { + general: { + server_id: (selected, set) => ( + set({ server_id })} + /> + ), + github_account: (value, set) => ( + set({ github_account })} + /> + ), + repo: true, + branch: true, + on_pull: true, + on_clone: true, + }, + }, + }} + /> + ); + }, + }, Actions: () => null, New: () => null, };