forked from PrefectHQ/prefect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI v2] feat: Scaffolds UX components for deployment details page (Pr…
- Loading branch information
1 parent
a02cc8d
commit 3d9e678
Showing
4 changed files
with
174 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
ui-v2/src/components/deployments/deployment-details-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Deployment } from "@/api/deployments"; | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "../ui/breadcrumb"; | ||
|
||
type DeploymentDetailsHeaderProps = { | ||
deployment: Deployment; | ||
}; | ||
export const DeploymentDetailsHeader = ({ | ||
deployment, | ||
}: DeploymentDetailsHeaderProps) => { | ||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink to="/deployments" className="text-xl font-semibold"> | ||
Deployments | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem className="text-xl font-semibold"> | ||
<BreadcrumbPage>{deployment.name}</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
}; |
41 changes: 41 additions & 0 deletions
41
ui-v2/src/components/deployments/deployment-details-page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { buildDeploymentDetailsQuery } from "@/api/deployments"; | ||
import { useSuspenseQuery } from "@tanstack/react-query"; | ||
|
||
import { DeploymentDetailsHeader } from "./deployment-details-header"; | ||
import { DeploymentDetailsTabs } from "./deployment-details-tabs"; | ||
|
||
type DeploymentDetailsPageProps = { | ||
id: string; | ||
}; | ||
|
||
export const DeploymentDetailsPage = ({ id }: DeploymentDetailsPageProps) => { | ||
const { data } = useSuspenseQuery(buildDeploymentDetailsQuery(id)); | ||
|
||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<div className="flex align-middle justify-between"> | ||
<div className="flex flex-col gap-2"> | ||
<DeploymentDetailsHeader deployment={data} /> | ||
<div className="border border-red-400">{"<FlowLink />"}</div> | ||
</div> | ||
<div className="flex align-middle gap-2"> | ||
<div className="border border-red-400">{"<RunButton />"}</div> | ||
<div className="border border-red-400">{"<Actions />"}</div> | ||
</div> | ||
</div> | ||
<div className="grid gap-4" style={{ gridTemplateColumns: "3fr 1fr" }}> | ||
<div className="flex flex-col gap-5"> | ||
<DeploymentDetailsTabs /> | ||
</div> | ||
<div className="flex flex-col gap-3"> | ||
<div className="border border-red-400">{"<SchedulesSection />"}</div> | ||
<div className="border border-red-400">{"<TriggerSection />"}</div> | ||
<hr /> | ||
<div className="border border-red-400">{"<StatusSection />"}</div> | ||
<hr /> | ||
<div className="border border-red-400">{"<IDsSection />"}</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
97 changes: 97 additions & 0 deletions
97
ui-v2/src/components/deployments/deployment-details-tabs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; | ||
import type { DeploymentDetailsTabOptions } from "@/routes/deployments/deployment.$id"; | ||
import { Link, getRouteApi } from "@tanstack/react-router"; | ||
import { type JSX } from "react"; | ||
|
||
const routeApi = getRouteApi("/deployments/deployment/$id"); | ||
|
||
type TabOption = { | ||
value: DeploymentDetailsTabOptions; | ||
LinkComponent: () => JSX.Element; | ||
ViewComponent: () => JSX.Element; | ||
}; | ||
|
||
const TAB_OPTIONS = [ | ||
{ | ||
value: "Runs", | ||
LinkComponent: () => ( | ||
<Link to="." search={{ tab: "Runs" }}> | ||
<TabsTrigger value="Runs">Runs</TabsTrigger> | ||
</Link> | ||
), | ||
ViewComponent: () => ( | ||
<TabsContent value="Runs"> | ||
<div className="border border-red-400">{"<RunsView />"}</div> | ||
</TabsContent> | ||
), | ||
}, | ||
{ | ||
value: "Upcoming", | ||
LinkComponent: () => ( | ||
<Link to="." search={{ tab: "Upcoming" }}> | ||
<TabsTrigger value="Upcoming">Upcoming</TabsTrigger> | ||
</Link> | ||
), | ||
ViewComponent: () => ( | ||
<TabsContent value="Upcoming"> | ||
<div className="border border-red-400">{"<UpcomingView />"}</div> | ||
</TabsContent> | ||
), | ||
}, | ||
{ | ||
value: "Upcoming", | ||
LinkComponent: () => ( | ||
<Link to="." search={{ tab: "Parameters" }}> | ||
<TabsTrigger value="Parameters">Parameters</TabsTrigger> | ||
</Link> | ||
), | ||
ViewComponent: () => ( | ||
<TabsContent value="Parameters"> | ||
<div className="border border-red-400">{"<ParametersView />"}</div> | ||
</TabsContent> | ||
), | ||
}, | ||
{ | ||
value: "Configuration", | ||
LinkComponent: () => ( | ||
<Link to="." search={{ tab: "Configuration" }}> | ||
<TabsTrigger value="Configuration">Configuration</TabsTrigger> | ||
</Link> | ||
), | ||
ViewComponent: () => ( | ||
<TabsContent value="Configuration"> | ||
<div className="border border-red-400">{"<ConfigurationView />"}</div> | ||
</TabsContent> | ||
), | ||
}, | ||
{ | ||
value: "Description", | ||
LinkComponent: () => ( | ||
<Link to="." search={{ tab: "Description" }}> | ||
<TabsTrigger value="Description">Description</TabsTrigger> | ||
</Link> | ||
), | ||
ViewComponent: () => ( | ||
<TabsContent value="Description"> | ||
<div className="border border-red-400">{"<DescriptionView />"}</div> | ||
</TabsContent> | ||
), | ||
}, | ||
] as const satisfies Array<TabOption>; | ||
|
||
export const DeploymentDetailsTabs = (): JSX.Element => { | ||
const { tab } = routeApi.useSearch(); | ||
|
||
return ( | ||
<Tabs defaultValue={TAB_OPTIONS[0].value} value={tab}> | ||
<TabsList> | ||
{TAB_OPTIONS.map(({ value, LinkComponent }) => ( | ||
<LinkComponent key={value} /> | ||
))} | ||
</TabsList> | ||
{TAB_OPTIONS.map(({ value, ViewComponent }) => ( | ||
<ViewComponent key={value} /> | ||
))} | ||
</Tabs> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters