From e83124ebfff7f16649ba5cdd6e8bbcd45019c0bd Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Mon, 13 May 2024 01:11:12 -0700 Subject: [PATCH] build ConfigOrDeployments --- .../src/components/resources/build/config.tsx | 5 +- .../src/components/resources/build/index.tsx | 74 +++++++++++++++---- 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/resources/build/config.tsx b/frontend/src/components/resources/build/config.tsx index 219270987..dfd513f4e 100644 --- a/frontend/src/components/resources/build/config.tsx +++ b/frontend/src/components/resources/build/config.tsx @@ -19,10 +19,10 @@ import { } from "@ui/select"; import { Textarea } from "@ui/textarea"; import { PlusCircle } from "lucide-react"; -import { useEffect, useState } from "react"; +import { ReactNode, useEffect, useState } from "react"; import { CopyGithubWebhook, LabelsConfig, ResourceSelector } from "../common"; -export const BuildConfig = ({ id }: { id: string }) => { +export const BuildConfig = ({ id, titleOther }: { id: string; titleOther: ReactNode }) => { const perms = useRead("GetPermissionLevel", { target: { type: "Build", id }, }).data; @@ -37,6 +37,7 @@ export const BuildConfig = ({ id }: { id: string }) => { return ( useRead("ListBuilds", {}).data?.find((d) => d.id === id); @@ -25,6 +27,61 @@ const BuildIcon = ({ id, size }: { id?: string; size: number }) => { return ; }; +const ConfigOrDeployments = ({ id }: { id: string }) => { + const [view, setView] = useState("Config"); + const deployments = useRead("ListDeployments", {}).data?.filter( + (deployment) => deployment.info.build_id === id + ); + const deploymentsDisabled = (deployments?.length || 0) === 0; + return ( + + + + + Config + + + Deployments + + + } + /> + + +
+ + Config + + + Deployments + + + } + > + +
+
+
+ ); +}; + export const BuildComponents: RequiredResourceComponents = { Dashboard: BuildChart, @@ -73,20 +130,9 @@ export const BuildComponents: RequiredResourceComponents = { Actions: { RunBuild }, - Page: { - Deployments: ({ id }) => { - const deployments = useRead("ListDeployments", {}).data?.filter( - (deployment) => deployment.info.build_id === id - ); - return ( -
}> - -
- ); - }, - }, + Page: {}, - Config: BuildConfig, + Config: ConfigOrDeployments, DangerZone: ({ id }) => , };