-
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: Scaffolds concurrency-limit route (#16370)
- Loading branch information
1 parent
f1aaad2
commit cf2f269
Showing
85 changed files
with
1,142 additions
and
382 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
ui-v2/src/components/concurrency/concurrency-limits-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,17 @@ | ||
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 { ConcurrencyLimitsTabs } from "./concurrency-limits-tabs"; | ||
|
||
export const ConcurrencyLimitsPage = () => { | ||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<Typography variant="h2">Concurrency</Typography> | ||
<ConcurrencyLimitsTabs | ||
globalView={<GlobalConcurrencyLimitsView />} | ||
taskRunView={<TaskRunConcurrencyLimitsView />} | ||
/> | ||
</div> | ||
); | ||
}; |
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
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...-limits-create-or-edit-dialog/global-concurrency-limits-create-or-edit-dialog.stories.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,29 @@ | ||
import { | ||
createFakeGlobalConcurrencyLimit, | ||
reactQueryDecorator, | ||
} from "@/storybook/utils"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { GlobalConcurrencyLimitsCreateOrEditDialog } from "./global-concurrency-limits-create-or-edit-dialog"; | ||
|
||
const meta = { | ||
title: | ||
"Components/Concurrency/GlobalConcurrencyLimits/GlobalConcurrencyLimitsCreateOrEditDialog", | ||
component: GlobalConcurrencyLimitsCreateOrEditDialog, | ||
decorators: [reactQueryDecorator], | ||
args: { | ||
onOpenChange: () => {}, | ||
onSubmit: () => {}, | ||
}, | ||
} satisfies Meta<typeof GlobalConcurrencyLimitsCreateOrEditDialog>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof GlobalConcurrencyLimitsCreateOrEditDialog>; | ||
|
||
export const CreateLimit: Story = {}; | ||
|
||
export const EditLimit: Story = { | ||
args: { | ||
limitToUpdate: createFakeGlobalConcurrencyLimit(), | ||
}, | ||
}; |
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
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
1 change: 1 addition & 0 deletions
1
...rrency/global-concurrency-limits/global-concurrency-limits-create-or-edit-dialog/index.ts
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 @@ | ||
export { GlobalConcurrencyLimitsCreateOrEditDialog } from "./global-concurrency-limits-create-or-edit-dialog"; |
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
52 changes: 52 additions & 0 deletions
52
...ncurrency/global-concurrency-limits/global-concurrency-limits-data-table/actions-cell.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,52 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuLabel, | ||
DropdownMenuTrigger, | ||
} from "@/components/ui/dropdown-menu"; | ||
import { Icon } from "@/components/ui/icons"; | ||
import type { GlobalConcurrencyLimit } from "@/hooks/global-concurrency-limits"; | ||
import { useToast } from "@/hooks/use-toast"; | ||
import type { CellContext } from "@tanstack/react-table"; | ||
|
||
type Props = CellContext<GlobalConcurrencyLimit, unknown> & { | ||
onEditRow: (row: GlobalConcurrencyLimit) => void; | ||
onDeleteRow: (row: GlobalConcurrencyLimit) => void; | ||
}; | ||
|
||
export const ActionsCell = ({ onEditRow, onDeleteRow, ...props }: Props) => { | ||
const { toast } = useToast(); | ||
|
||
const handleCopyId = (id: string | undefined) => { | ||
if (!id) { | ||
throw new Error("'id' field expected in GlobalConcurrencyLimit"); | ||
} | ||
void navigator.clipboard.writeText(id); | ||
toast({ title: "ID copied" }); | ||
}; | ||
|
||
const row = props.row.original; | ||
|
||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button variant="outline" className="h-8 w-8 p-0"> | ||
<span className="sr-only">Open menu</span> | ||
<Icon id="MoreVertical" className="h-4 w-4" /> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent align="end"> | ||
<DropdownMenuLabel>Actions</DropdownMenuLabel> | ||
<DropdownMenuItem onClick={() => handleCopyId(row.id)}> | ||
Copy ID | ||
</DropdownMenuItem> | ||
<DropdownMenuItem onClick={() => onDeleteRow(row)}> | ||
Delete | ||
</DropdownMenuItem> | ||
<DropdownMenuItem onClick={() => onEditRow(row)}>Edit</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
); | ||
}; |
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
34 changes: 34 additions & 0 deletions
34
...its/global-concurrency-limits-data-table/global-concurrency-limits-data-table.stories.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,34 @@ | ||
import { | ||
createFakeGlobalConcurrencyLimit, | ||
reactQueryDecorator, | ||
} from "@/storybook/utils"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { Table as GlobalConcurrencyLimitsDataTable } from "./global-concurrency-limits-data-table"; | ||
|
||
const MOCK_DATA = [ | ||
createFakeGlobalConcurrencyLimit(), | ||
createFakeGlobalConcurrencyLimit(), | ||
createFakeGlobalConcurrencyLimit(), | ||
createFakeGlobalConcurrencyLimit(), | ||
createFakeGlobalConcurrencyLimit(), | ||
]; | ||
|
||
const meta = { | ||
title: | ||
"Components/Concurrency/GlobalConcurrencyLimits/GlobalConcurrencyLimitsDataTable", | ||
component: GlobalConcurrencyLimitsDataTable, | ||
decorators: [reactQueryDecorator], | ||
args: { | ||
data: MOCK_DATA, | ||
onDeleteRow: () => {}, | ||
onEditRow: () => {}, | ||
onSearchChange: () => {}, | ||
searchValue: "", | ||
}, | ||
} satisfies Meta<typeof GlobalConcurrencyLimitsDataTable>; | ||
|
||
export default meta; | ||
|
||
export const Story: StoryObj = { | ||
name: "GlobalConcurrencyLimitsDataTable", | ||
}; |
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
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
1 change: 1 addition & 0 deletions
1
...nents/concurrency/global-concurrency-limits/global-concurrency-limits-data-table/index.ts
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 @@ | ||
export { GlobalConcurrencyLimitsDataTable } from "./global-concurrency-limits-data-table"; |
22 changes: 22 additions & 0 deletions
22
...obal-concurrency-limits-delete-dialog/global-concurrency-limits-delete-dialog.stories.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,22 @@ | ||
import { | ||
createFakeGlobalConcurrencyLimit, | ||
reactQueryDecorator, | ||
} from "@/storybook/utils"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { GlobalConcurrencyLimitsDeleteDialog } from "./global-concurrency-limits-delete-dialog"; | ||
|
||
const meta = { | ||
title: | ||
"Components/Concurrency/GlobalConcurrencyLimits/GlobalConcurrencyLimitsDeleteDialog", | ||
component: GlobalConcurrencyLimitsDeleteDialog, | ||
decorators: [reactQueryDecorator], | ||
args: { | ||
limit: createFakeGlobalConcurrencyLimit(), | ||
onOpenChange: () => {}, | ||
onDelete: () => {}, | ||
}, | ||
} satisfies Meta<typeof GlobalConcurrencyLimitsDeleteDialog>; | ||
|
||
export default meta; | ||
|
||
export const story: StoryObj = { name: "GlobalConcurrencyLimitsDeleteDialog" }; |
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
Oops, something went wrong.