Skip to content

Commit

Permalink
[UI v2] fix: Create consistent concurrency limit nav title (#16559)
Browse files Browse the repository at this point in the history
  • Loading branch information
devinvillarosa authored Jan 2, 2025
1 parent 1c801c7 commit 50dfa9a
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
import {
Breadcrumb,
BreadcrumbLink,
BreadcrumbList,
} from "@/components/ui/breadcrumb";
import { Button } from "@/components/ui/button";
import { DocsLink } from "@/components/ui/docs-link";
import { Icon } from "@/components/ui/icons";
import { Typography } from "@/components/ui/typography";
import { Link } from "@tanstack/react-router";

export const AutomationsHeader = () => {
return (
<div className="flex items-center gap-2">
<Typography variant="h4">Automations</Typography>
<Button size="icon" className="h-7 w-7" variant="outline">
<Link to="/automations/create">
<Icon id="Plus" className="h-4 w-4" />
</Link>
</Button>
<div className="flex items-center justify-between">
<Header />
<DocsLink id="automations-guide" label="Documentation" />
</div>
);
};

const Header = () => (
<div className="flex items-center gap-2">
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbLink
to="/concurrency-limits"
className="text-xl font-semibold"
>
Automations
</BreadcrumbLink>
</BreadcrumbList>
</Breadcrumb>
<Button size="icon" className="h-7 w-7" variant="outline">
<Link to="/automations/create">
<Icon id="Plus" className="h-4 w-4" />
</Link>
</Button>
</div>
);
20 changes: 17 additions & 3 deletions ui-v2/src/components/concurrency/concurrency-limits-page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
import { Typography } from "@/components/ui/typography";

import { GlobalConcurrencyLimitsView } from "@/components/concurrency/global-concurrency-limits/global-concurrency-limits-view";
import { TaskRunConcurrencyLimitsView } from "@/components/concurrency/task-run-concurrency-limits/task-run-concurrency-limits-view";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbList,
} from "@/components/ui/breadcrumb";

import { ConcurrencyLimitsTabs } from "./concurrency-limits-tabs";

export const ConcurrencyLimitsPage = () => {
return (
<div className="flex flex-col gap-4">
<Typography variant="h2">Concurrency</Typography>
<ConcurrencyLimitTitle />
<ConcurrencyLimitsTabs
globalView={<GlobalConcurrencyLimitsView />}
taskRunView={<TaskRunConcurrencyLimitsView />}
/>
</div>
);
};

const ConcurrencyLimitTitle = () => (
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem className="text-xl font-semibold">
Concurrency
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
);
4 changes: 2 additions & 2 deletions ui-v2/src/components/concurrency/concurrency-limits-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const ConcurrencyLimitsTabs = ({
const navigate = routeApi.useNavigate();

return (
<Tabs className="flex flex-col gap-4" defaultValue="Global" value={tab}>
<TabsList className="grid w-full grid-cols-2">
<Tabs defaultValue="Global" value={tab}>
<TabsList>
<TabsTrigger
value={TAB_OPTIONS.global.tabSearchValue}
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ test("GlobalConcurrencyLimitsHeader can successfully call onAdd", async () => {
render(<GlobalConcurrencyLimitsHeader onAdd={mockOnAddFn} />);

// ------------ Act
expect(
screen.getByRole("heading", { name: /global concurrency limits/i }),
).toBeVisible();
expect(screen.getByText(/global concurrency limits/i)).toBeVisible();
await user.click(
screen.getByRole("button", {
name: /add global concurrency limit/i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ type Props = {
export const GlobalConcurrencyLimitsHeader = ({ onAdd }: Props) => {
return (
<div className="flex gap-2 items-center">
<Typography variant="h4">Global Concurrency Limits</Typography>
<Typography className="font-semibold">
Global Concurrency Limits
</Typography>
<Button
onClick={onAdd}
size="icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ type Props = {
export const TaskRunConcurrencyLimitsHeader = ({ onAdd }: Props) => {
return (
<div className="flex gap-2 items-center">
<Typography variant="h4">Task Run Concurrency Limits</Typography>
<Typography className="font-semibold">
Task Run Concurrency Limits
</Typography>
<Button
onClick={onAdd}
size="icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ test("TaskRunConcurrencyLimitsHeader can successfully call onAdd", async () => {

// ------------ Act
expect(
screen.getByRole("heading", { name: /task run concurrency limits/i }),
).toBeVisible();
expect(screen.getByText(/task run concurrency limits/i)).toBeVisible(),
);

await user.click(
screen.getByRole("button", {
name: /add task run concurrency limit/i,
Expand Down

0 comments on commit 50dfa9a

Please sign in to comment.