diff --git a/bin/core/src/helpers/resource.rs b/bin/core/src/helpers/resource.rs index 0c7daea4d..fef5dc7c3 100644 --- a/bin/core/src/helpers/resource.rs +++ b/bin/core/src/helpers/resource.rs @@ -410,6 +410,7 @@ impl StateResource for Build { last_built_at: build.info.last_built_at, version: build.config.version, repo: build.config.repo, + branch: build.config.branch, }, }) } @@ -444,6 +445,8 @@ impl StateResource for Repo { resource_type: ResourceTargetVariant::Repo, info: RepoInfo { last_pulled_at: repo.info.last_pulled_at, + repo: repo.config.repo, + branch: repo.config.branch, }, }) } diff --git a/client/core/rs/src/entities/build.rs b/client/core/rs/src/entities/build.rs index 9f9dab095..533bda79d 100644 --- a/client/core/rs/src/entities/build.rs +++ b/client/core/rs/src/entities/build.rs @@ -24,6 +24,7 @@ pub struct BuildListItemInfo { pub last_built_at: I64, pub version: Version, pub repo: String, + pub branch: String, } #[typeshare] diff --git a/client/core/rs/src/entities/repo.rs b/client/core/rs/src/entities/repo.rs index bfc67f00d..2b2d7e54d 100644 --- a/client/core/rs/src/entities/repo.rs +++ b/client/core/rs/src/entities/repo.rs @@ -22,6 +22,8 @@ pub type RepoListItem = ResourceListItem; #[derive(Serialize, Deserialize, Debug, Clone, Default)] pub struct RepoInfo { pub last_pulled_at: I64, + pub repo: String, + pub branch: String, } #[typeshare(serialized_as = "Partial")] diff --git a/client/core/ts/src/types.ts b/client/core/ts/src/types.ts index 596f348ff..a080da2b1 100644 --- a/client/core/ts/src/types.ts +++ b/client/core/ts/src/types.ts @@ -142,6 +142,7 @@ export interface BuildListItemInfo { last_built_at: I64; version: Version; repo: string; + branch: string; } export type BuildListItem = ResourceListItem; @@ -366,6 +367,8 @@ export interface RepoConfig { export interface RepoInfo { last_pulled_at: I64; + repo: string; + branch: string; } export type Repo = Resource; diff --git a/frontend/src/components/layouts.tsx b/frontend/src/components/layouts.tsx index 6bc721f02..16af16124 100644 --- a/frontend/src/components/layouts.tsx +++ b/frontend/src/components/layouts.tsx @@ -12,14 +12,7 @@ import { } from "@ui/dialog"; import { Types } from "@monitor/client"; import { ResourceComponents } from "./resources"; -import { - Card, - CardHeader, - CardTitle, - CardDescription, - CardContent, - CardFooter, -} from "@ui/card"; +import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@ui/card"; import { ResourceTags } from "./tags"; import { Topbar } from "./topbar"; @@ -92,7 +85,7 @@ export const NewResource = ({ enabled, onSuccess, }: { - entityType: String; + entityType: string; children: ReactNode; enabled: boolean; onSuccess: () => Promise; @@ -148,9 +141,9 @@ export const ResourceCard = ({ - + {/* - + */} @@ -189,9 +182,9 @@ export const ResourceRow = ({ ))}
- + {/* - + */}
diff --git a/frontend/src/components/omnibar.tsx b/frontend/src/components/omnibar.tsx index 274c90b5b..d47751472 100644 --- a/frontend/src/components/omnibar.tsx +++ b/frontend/src/components/omnibar.tsx @@ -18,6 +18,7 @@ import { RESOURCE_TARGETS } from "@lib/utils"; import { DeploymentComponents } from "./resources/deployment"; import { BuildComponents } from "./resources/build"; import { ServerComponents } from "./resources/server"; +import { ProcedureComponents } from "./resources/procedure"; export const Omnibar = () => { const [open, set] = useState(false); @@ -58,36 +59,43 @@ export const Omnibar = () => { No results found. - + nav("/")} > Home nav("/deployments")} > Deployments nav("/builds")} > Builds nav("/servers")} > Servers + nav("/procedures")} + > + + Procedures + @@ -109,7 +117,7 @@ const ResourceGroup = ({ onSelect, }: { type: UsableResource; - onSelect: (value: string) => void; + onSelect: (path: string) => void; }) => { const data = useRead(`List${type}s`, {}).data; const Components = ResourceComponents[type]; @@ -122,7 +130,7 @@ const ResourceGroup = ({ return ( onSelect(`/${type.toLowerCase()}s/${id}`)} > @@ -132,4 +140,4 @@ const ResourceGroup = ({ })} ); -}; \ No newline at end of file +}; diff --git a/frontend/src/components/resources/alerter/index.tsx b/frontend/src/components/resources/alerter/index.tsx index 3bf9573aa..e5e219920 100644 --- a/frontend/src/components/resources/alerter/index.tsx +++ b/frontend/src/components/resources/alerter/index.tsx @@ -26,7 +26,6 @@ const useAlerter = (id?: string) => export const AlerterComponents: RequiredResourceComponents = { Name: ({ id }: { id: string }) => <>{useAlerter(id)?.name}, Icon: () => , - Description: ({ id }) => <>{useAlerter(id)?.info.alerter_type} alerter, Link: ({ id }) => , Info: [], Status: () => <>, diff --git a/frontend/src/components/resources/build/index.tsx b/frontend/src/components/resources/build/index.tsx index b8bed78fa..68f761938 100644 --- a/frontend/src/components/resources/build/index.tsx +++ b/frontend/src/components/resources/build/index.tsx @@ -3,14 +3,13 @@ import { ConfirmButton } from "@components/util"; import { useExecute, useRead, useWrite } from "@lib/hooks"; import { RequiredResourceComponents } from "@types"; import { Input } from "@ui/input"; -import { AlertTriangle, Ban, Hammer, History, Loader2 } from "lucide-react"; +import { AlertTriangle, Ban, FolderGit, Hammer, History, Loader2 } from "lucide-react"; import { useState } from "react"; import { useToast } from "@ui/use-toast"; import { BuildConfig } from "./config"; import { fill_color_class_by_intention } from "@lib/color"; import { BuildChart } from "./dashboard"; import { BuildTable } from "./table"; -import { fmt_version } from "@lib/formatting"; import { CopyResource, DeleteResource, ResourceLink } from "../common"; const useBuild = (id?: string) => @@ -28,9 +27,17 @@ export const BuildComponents: RequiredResourceComponents = { Table: BuildTable, Dashboard: BuildChart, Name: ({ id }) => <>{useBuild(id)?.name}, - Description: ({ id }) => <>{fmt_version(useBuild(id)?.info.version)}, Link: ({ id }) => , Info: [ + ({ id }) => { + const repo = useBuild(id)?.info.repo; + return ( +
+ + {repo} +
+ ); + }, ({ id }) => { const ts = useBuild(id)?.info.last_built_at; return ( diff --git a/frontend/src/components/resources/builder/index.tsx b/frontend/src/components/resources/builder/index.tsx index c26f714ec..4ec16a1c9 100644 --- a/frontend/src/components/resources/builder/index.tsx +++ b/frontend/src/components/resources/builder/index.tsx @@ -25,7 +25,6 @@ const useBuilder = (id?: string) => export const BuilderComponents: RequiredResourceComponents = { Name: ({ id }: { id: string }) => <>{useBuilder(id)?.name}, - Description: () => <>, Link: ({ id }) => , Info: [ ({ id }) => ( diff --git a/frontend/src/components/resources/deployment/index.tsx b/frontend/src/components/resources/deployment/index.tsx index 03b4bbffd..bedd7b743 100644 --- a/frontend/src/components/resources/deployment/index.tsx +++ b/frontend/src/components/resources/deployment/index.tsx @@ -34,7 +34,6 @@ export const useDeployment = (id?: string) => export const DeploymentComponents: RequiredResourceComponents = { Name: ({ id }) => <>{useDeployment(id)?.name}, - Description: ({ id }) => <>{useDeployment(id)?.info.status}, Link: ({ id }) => , Info: [ ({ id }) => { diff --git a/frontend/src/components/resources/procedure/index.tsx b/frontend/src/components/resources/procedure/index.tsx index 714b50f48..54c0aae23 100644 --- a/frontend/src/components/resources/procedure/index.tsx +++ b/frontend/src/components/resources/procedure/index.tsx @@ -24,7 +24,6 @@ const useProcedure = (id?: string) => export const ProcedureComponents: RequiredResourceComponents = { Name: ({ id }) => <>{useProcedure(id)?.name}, - Description: ({ id }) => <>{useProcedure(id)?.info.procedure_type}, Link: ({ id }) => , Info: [({ id }) => <>{useProcedure(id)?.info.procedure_type}], Icon: () => , diff --git a/frontend/src/components/resources/repo/index.tsx b/frontend/src/components/resources/repo/index.tsx index 2b8eb78c6..4ed100343 100644 --- a/frontend/src/components/resources/repo/index.tsx +++ b/frontend/src/components/resources/repo/index.tsx @@ -3,7 +3,7 @@ import { useRead, useWrite } from "@lib/hooks"; import { RequiredResourceComponents } from "@types"; import { Card, CardDescription, CardHeader, CardTitle } from "@ui/card"; import { DataTable } from "@ui/data-table"; -import { AlertTriangle, GitBranch } from "lucide-react"; +import { AlertTriangle, FolderGit, GitBranch, History } from "lucide-react"; import { Link } from "react-router-dom"; import { RepoConfig } from "./config"; import { useState } from "react"; @@ -17,11 +17,29 @@ const useRepo = (id?: string) => export const RepoComponents: RequiredResourceComponents = { Name: ({ id }: { id: string }) => <>{useRepo(id)?.name}, - Description: ({ id }) => <>{id}, Icon: () => , Link: ({ id }) => , - Info: [], - Status: () => <>, + Info: [ + ({ id }) => { + const repo = useRepo(id)?.info.repo; + return ( +
+ + {repo} +
+ ); + }, + ({ id }) => { + const ts = useRepo(id)?.info.last_pulled_at; + return ( +
+ + {ts ? new Date(ts).toLocaleString() : "Never Pulled"} +
+ ); + }, + ], + Status: () => <>Repo, Actions: [PullRepo, CloneRepo], Page: { Config: RepoConfig, @@ -51,10 +69,17 @@ export const RepoComponents: RequiredResourceComponents = { } columns={[ { - accessorKey: "id", header: "Name", cell: ({ row }) => , }, + { + header: "Repo", + accessorKey: "info.repo", + }, + { + header: "Branch", + accessorKey: "info.branch", + }, { header: "Tags", cell: ({ row }) => { diff --git a/frontend/src/components/resources/server/index.tsx b/frontend/src/components/resources/server/index.tsx index b1b7758b9..b8c4b0ac2 100644 --- a/frontend/src/components/resources/server/index.tsx +++ b/frontend/src/components/resources/server/index.tsx @@ -25,7 +25,6 @@ export const useServer = (id?: string) => export const ServerComponents: RequiredResourceComponents = { Name: ({ id }: { id: string }) => <>{useServer(id)?.name}, - Description: ({ id }) => <>{useServer(id)?.info.status}, Link: ({ id }) => , Info: [ ({ id }) => ( diff --git a/frontend/src/types.d.ts b/frontend/src/types.d.ts index be8a7d74b..320e57b7a 100644 --- a/frontend/src/types.d.ts +++ b/frontend/src/types.d.ts @@ -14,7 +14,6 @@ export interface RequiredResourceComponents { Dashboard: React.FC; Name: IdComponent; - Description: IdComponent; Status: IdComponent; Link: IdComponent;