Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add update user roles action#1361

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
BrunoQuaresma merged 18 commits intomainfrombq/fe/update-user-roles-action
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
32cba83
Load roles and show them in the table
BrunoQuaresmaMay 6, 2022
b167995
Update types
BrunoQuaresmaMay 6, 2022
cabe385
Update API
BrunoQuaresmaMay 6, 2022
b71ede5
Update roles to fetch the site roles
BrunoQuaresmaMay 6, 2022
d5e749f
Merge branch 'main' of github.com:coder/coder into bq/fe/update-user-…
BrunoQuaresmaMay 9, 2022
1e99a04
Add UI for update user roles
BrunoQuaresmaMay 9, 2022
46add41
Set fixed RoleSelect width
BrunoQuaresmaMay 9, 2022
16d1e7b
Fix UI to update user roles
BrunoQuaresmaMay 9, 2022
1e93bd2
Do not display the success notification
BrunoQuaresmaMay 9, 2022
82a60f8
Add role select storybook
BrunoQuaresmaMay 10, 2022
9c0587e
Add missing tests
BrunoQuaresmaMay 10, 2022
c7c7b95
Add fail test case
BrunoQuaresmaMay 10, 2022
a01cb87
Update site/src/components/RoleSelect/RoleSelect.tsx
BrunoQuaresmaMay 10, 2022
f402da0
Update site/src/components/RoleSelect/RoleSelect.tsx
BrunoQuaresmaMay 10, 2022
9f47873
Update site/src/pages/UsersPage/UsersPage.test.tsx
BrunoQuaresmaMay 10, 2022
6cf12b5
Clear get roles error
BrunoQuaresmaMay 10, 2022
16c3fe3
Fix storybook
BrunoQuaresmaMay 10, 2022
9bd6ca5
Add comment about fetch the roles
BrunoQuaresmaMay 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Add role select storybook
  • Loading branch information
@BrunoQuaresma
BrunoQuaresma committedMay 10, 2022
commit82a60f81575b1326391a835a6a4a7c0f0b51f5ff
67 changes: 67 additions & 0 deletionssite/src/components/UsersTable/RoleSelect.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
import { ComponentMeta, Story } from "@storybook/react"
import React from "react"
import { RoleSelect, RoleSelectProps } from "./RoleSelect"

export default {
title: "components/RoleSelect",
component: RoleSelect,
} as ComponentMeta<typeof RoleSelect>

const Template: Story<RoleSelectProps> = (args) => <RoleSelect {...args} />

export const Close = Template.bind({})
Close.args = {
roles: [
{
name: "admin",
display_name: "Admin",
},
{
name: "auditor",
display_name: "Auditor",
},
{
name: "member",
display_name: "Member",
},
],
selectedRoles: [
{
name: "admin",
display_name: "Admin",
},
{
name: "member",
display_name: "Member",
},
],
}

export const Open = Template.bind({})
Open.args = {
open: true,
roles: [
{
name: "admin",
display_name: "Admin",
},
{
name: "auditor",
display_name: "Auditor",
},
{
name: "member",
display_name: "Member",
},
],
selectedRoles: [
{
name: "admin",
display_name: "Admin",
},
{
name: "member",
display_name: "Member",
},
],
}
4 changes: 3 additions & 1 deletionsite/src/components/UsersTable/RoleSelect.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,18 @@ export interface RoleSelectProps {
selectedRoles: Role[]
onChange: (roles: Role["name"][]) => void
loading?: boolean
open?: boolean
}

export const RoleSelect: React.FC<RoleSelectProps> = ({ roles, selectedRoles, loading, onChange }) => {
export const RoleSelect: React.FC<RoleSelectProps> = ({ roles, selectedRoles, loading, onChange, open }) => {
const styles = useStyles()
const value = selectedRoles.map((r) => r.name)
const renderValue = () => selectedRoles.map((r) => r.display_name).join(", ")
const sortedRoles = roles.sort((a, b) => a.display_name.localeCompare(b.display_name))

return (
<Select
open={open}
multiple
value={value}
renderValue={renderValue}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp