From 64119d9028f7c1c20aafacb26a61b866a328b7f0 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Tue, 22 Oct 2024 16:04:01 -0700 Subject: [PATCH] cleanup --- .../_components/job-drawer/JobAgent.tsx | 1 + .../_components/job-drawer/JobDrawer.tsx | 105 ++++++++++-------- .../_components/job-drawer/JobMetadata.tsx | 21 ++-- 3 files changed, 68 insertions(+), 59 deletions(-) diff --git a/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobAgent.tsx b/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobAgent.tsx index b1989477..67235f7e 100644 --- a/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobAgent.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobAgent.tsx @@ -24,6 +24,7 @@ export const JobAgent: React.FC = ({ job }) => ( Job Config + diff --git a/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobDrawer.tsx b/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobDrawer.tsx index 0124085c..2b588ebc 100644 --- a/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobDrawer.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobDrawer.tsx @@ -5,6 +5,7 @@ import Link from "next/link"; import { IconDotsVertical, IconExternalLink, + IconLoader2, IconRocket, } from "@tabler/icons-react"; @@ -44,56 +45,64 @@ export const JobDrawer: React.FC = () => { showBar={false} className="left-auto right-0 top-0 mt-0 h-screen w-1/3 overflow-auto rounded-none focus-visible:outline-none" > - -
-
- -
- Job - {job != null && ( - - - - )} + {jobQ.isLoading && ( +
+
- {links != null && ( -
- <> - {Object.entries(links).map(([label, url]) => ( - + +
+
+ +
+ Job + {job != null && ( + - - {label} - - ))} - -
- )} -
- - {job != null && ( -
- - - -
+ + + )} +
+ {links != null && ( +
+ <> + {Object.entries(links).map(([label, url]) => ( + + + {label} + + ))} + +
+ )} + + {job != null && ( +
+ + + +
+ )} + )} diff --git a/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobMetadata.tsx b/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobMetadata.tsx index 173b3e6d..329ff274 100644 --- a/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobMetadata.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/_components/job-drawer/JobMetadata.tsx @@ -11,17 +11,9 @@ type JobMetadataProps = { }; export const JobMetadata: React.FC = ({ job }) => { - const { metadata } = job.job; - const metadataRecord = metadata.reduce( - (acc, curr) => { - acc[curr.key] = curr.value; - return acc; - }, - {} as Record, - ); - const sortedMetadata = Object.entries(metadataRecord).sort(([keyA], [keyB]) => - keyA.localeCompare(keyB), - ); + const sortedMetadata = job.job.metadata + .map(({ key, value }) => [key, value] as [string, string]) + .sort(([keyA], [keyB]) => keyA.localeCompare(keyB)); const { search, setSearch, result } = useMatchSorterWithSearch( sortedMetadata, { keys: ["0", "1"] }, @@ -33,10 +25,17 @@ export const JobMetadata: React.FC = ({ job }) => { setSearch(e.target.value)} />
+ {result.length === 0 && ( +
+ No matching metadata found +
+ )} {result.map(([key, value]) => (