- Notifications
You must be signed in to change notification settings - Fork927
feat: create and modify organization groups#13887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
14 commits Select commitHold shift + click to select a range
6f5952e
🫣
aslilac504f561
Merge branch 'main' into org-groups
aslilac46cb3c7
fix a bunch of stuff
aslilac571bb5e
🧹
aslilac9cdee44
u
aslilac3399d21
iykyk
aslilacb252a50
do the thing here too
aslilac5ef6485
:^)
aslilac0c2ddac
better
aslilac91732b6
oops
aslilac40faf01
Merge branch 'main' into org-groups
aslilac560fd4f
query refetching is cool
aslilacc636009
feedback
aslilacbdf5965
🧹
aslilacFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
9 changes: 5 additions & 4 deletionsenterprise/coderd/groups.go
This file contains hidden or 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
15 changes: 9 additions & 6 deletionssite/src/api/api.ts
This file contains hidden or 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
40 changes: 24 additions & 16 deletionssite/src/api/queries/groups.ts
This file contains hidden or 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
9 changes: 5 additions & 4 deletionssite/src/api/queries/organizations.ts
This file contains hidden or 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
20 changes: 20 additions & 0 deletionssite/src/components/PageHeader/PageHeader.tsx
This file contains hidden or 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
9 changes: 2 additions & 7 deletionssite/src/pages/GroupsPage/CreateGroupPage.tsx
This file contains hidden or 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
7 changes: 5 additions & 2 deletionssite/src/pages/GroupsPage/GroupPage.tsx
This file contains hidden or 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
12 changes: 6 additions & 6 deletionssite/src/pages/GroupsPage/SettingsGroupPage.tsx
This file contains hidden or 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
33 changes: 33 additions & 0 deletionssite/src/pages/ManagementSettingsPage/GroupsPage/CreateGroupPage.tsx
This file contains hidden or 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,33 @@ | ||
import type { FC } from "react"; | ||
import { Helmet } from "react-helmet-async"; | ||
import { useMutation, useQueryClient } from "react-query"; | ||
import { useNavigate, useParams } from "react-router-dom"; | ||
import { createGroup } from "api/queries/groups"; | ||
import { pageTitle } from "utils/page"; | ||
import CreateGroupPageView from "./CreateGroupPageView"; | ||
export const CreateGroupPage: FC = () => { | ||
const queryClient = useQueryClient(); | ||
const navigate = useNavigate(); | ||
const { organization } = useParams() as { organization: string }; | ||
const createGroupMutation = useMutation( | ||
createGroup(queryClient, organization), | ||
); | ||
return ( | ||
<> | ||
<Helmet> | ||
<title>{pageTitle("Create Group")}</title> | ||
</Helmet> | ||
<CreateGroupPageView | ||
onSubmit={async (data) => { | ||
const newGroup = await createGroupMutation.mutateAsync(data); | ||
navigate(`/organizations/${organization}/groups/${newGroup.name}`); | ||
}} | ||
error={createGroupMutation.error} | ||
isLoading={createGroupMutation.isLoading} | ||
/> | ||
</> | ||
); | ||
}; | ||
export default CreateGroupPage; |
32 changes: 32 additions & 0 deletionssite/src/pages/ManagementSettingsPage/GroupsPage/CreateGroupPageView.stories.tsx
This file contains hidden or 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 type { Meta, StoryObj } from "@storybook/react"; | ||
import { userEvent, within } from "@storybook/test"; | ||
import { mockApiError } from "testHelpers/entities"; | ||
import { CreateGroupPageView } from "./CreateGroupPageView"; | ||
const meta: Meta<typeof CreateGroupPageView> = { | ||
title: "pages/OrganizationGroupsPage/CreateGroupPageView", | ||
component: CreateGroupPageView, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof CreateGroupPageView>; | ||
export const Example: Story = {}; | ||
export const WithError: Story = { | ||
args: { | ||
error: mockApiError({ | ||
message: "A group named new-group already exists.", | ||
validations: [{ field: "name", detail: "Group names must be unique" }], | ||
}), | ||
}, | ||
play: async ({ canvasElement, step }) => { | ||
const canvas = within(canvasElement); | ||
await step("Enter name", async () => { | ||
const input = canvas.getByLabelText("Name"); | ||
await userEvent.type(input, "new-group"); | ||
input.blur(); | ||
}); | ||
}, | ||
}; |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.