-
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 GlobalConcurrencyLimitEmptyState component to be u…
…sed in concurrency route development (#16195)
- Loading branch information
1 parent
276544d
commit 730f56e
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
ui-v2/src/components/concurrency/global-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 { GlobalConcurrencyLimitEmptyState } from "./global-concurrency-limit-empty-state"; | ||
|
||
describe("GlobalConcurrencyLimitEmptyState", () => { | ||
it("when adding limit, callback gets fired", async () => { | ||
const user = userEvent.setup(); | ||
|
||
const mockFn = vi.fn(); | ||
|
||
render(<GlobalConcurrencyLimitEmptyState onClick={mockFn} />); | ||
await user.click( | ||
screen.getByRole("button", { name: /Add Concurrency Limit/i }), | ||
); | ||
expect(mockFn).toHaveBeenCalledOnce(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
ui-v2/src/components/concurrency/global-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,30 @@ | ||
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 GlobalConcurrencyLimitEmptyState = ({ onClick }: Props) => ( | ||
<EmptyState> | ||
<EmptyStateIcon id="AlignVerticalJustifyStart" /> | ||
<EmptyStateTitle>Add a concurrency limit</EmptyStateTitle> | ||
<EmptyStateDescription> | ||
Global concurrency limits can be applied to flow runs, task runs and any | ||
operation where you want to control concurrency. | ||
</EmptyStateDescription> | ||
<EmptyStateActions> | ||
<Button onClick={onClick}> | ||
Add Concurrency Limit <PlusIcon className="h-4 w-4 ml-2" /> | ||
</Button> | ||
<DocsLink id="global-concurrency-guide" /> | ||
</EmptyStateActions> | ||
</EmptyState> | ||
); |