-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: Adds EmptyState for Task Run Concurrency Limits (#16203)
- Loading branch information
1 parent
1cab155
commit d47081f
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
ui-v2/src/components/concurrency/task-run-concurrency-limit-empty-state.test.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,18 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import userEvent from "@testing-library/user-event"; | ||
import { describe, expect, it, vi } from "vitest"; | ||
import { TaskRunConcurrencyLimitEmptyState } from "./task-run-concurrency-limit-empty-state"; | ||
|
||
describe("TaskRunConcurrencyLimitEmptyState", () => { | ||
it("when adding task run concurrency limit, callback gets fired", async () => { | ||
const user = userEvent.setup(); | ||
|
||
const mockFn = vi.fn(); | ||
|
||
render(<TaskRunConcurrencyLimitEmptyState onClick={mockFn} />); | ||
await user.click( | ||
screen.getByRole("button", { name: /Add Concurrency Limit/i }), | ||
); | ||
expect(mockFn).toHaveBeenCalledOnce(); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
ui-v2/src/components/concurrency/task-run-concurrency-limit-empty-state.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 { Button } from "@/components/ui/button"; | ||
import { DocsLink } from "@/components/ui/docs-link"; | ||
import { | ||
EmptyState, | ||
EmptyStateActions, | ||
EmptyStateDescription, | ||
EmptyStateIcon, | ||
EmptyStateTitle, | ||
} from "@/components/ui/empty-state"; | ||
import { PlusIcon } from "lucide-react"; | ||
|
||
type Props = { | ||
onClick: () => void; | ||
}; | ||
export const TaskRunConcurrencyLimitEmptyState = ({ onClick }: Props) => ( | ||
<EmptyState> | ||
<EmptyStateIcon id="CircleArrowOutUpRight" /> | ||
<EmptyStateTitle> | ||
Add a concurrency limit for your task runs | ||
</EmptyStateTitle> | ||
<EmptyStateDescription> | ||
Creating a limit allows you to limit the number of tasks running | ||
simultaneously with a given tag. | ||
</EmptyStateDescription> | ||
<EmptyStateActions> | ||
<Button onClick={onClick}> | ||
Add Concurrency Limit <PlusIcon className="h-4 w-4 ml-2" /> | ||
</Button> | ||
<DocsLink id="task-concurrency-guide" /> | ||
</EmptyStateActions> | ||
</EmptyState> | ||
); |
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