mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat: Add update user roles action (#1361)
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import React from "react"
|
||||
import { UserResponse } from "../../api/types"
|
||||
import * as TypesGen from "../../api/typesGenerated"
|
||||
import { ErrorSummary } from "../../components/ErrorSummary/ErrorSummary"
|
||||
import { Header } from "../../components/Header/Header"
|
||||
import { Margins } from "../../components/Margins/Margins"
|
||||
@ -16,15 +17,21 @@ export interface UsersPageViewProps {
|
||||
openUserCreationDialog: () => void
|
||||
onSuspendUser: (user: UserResponse) => void
|
||||
onResetUserPassword: (user: UserResponse) => void
|
||||
onUpdateUserRoles: (user: UserResponse, roles: TypesGen.Role["name"][]) => void
|
||||
roles: TypesGen.Role[]
|
||||
error?: unknown
|
||||
isUpdatingUserRoles?: boolean
|
||||
}
|
||||
|
||||
export const UsersPageView: React.FC<UsersPageViewProps> = ({
|
||||
users,
|
||||
roles,
|
||||
openUserCreationDialog,
|
||||
onSuspendUser,
|
||||
onResetUserPassword,
|
||||
onUpdateUserRoles,
|
||||
error,
|
||||
isUpdatingUserRoles,
|
||||
}) => {
|
||||
return (
|
||||
<Stack spacing={4}>
|
||||
@ -33,7 +40,14 @@ export const UsersPageView: React.FC<UsersPageViewProps> = ({
|
||||
{error ? (
|
||||
<ErrorSummary error={error} />
|
||||
) : (
|
||||
<UsersTable users={users} onSuspendUser={onSuspendUser} onResetUserPassword={onResetUserPassword} />
|
||||
<UsersTable
|
||||
users={users}
|
||||
onSuspendUser={onSuspendUser}
|
||||
onResetUserPassword={onResetUserPassword}
|
||||
onUpdateUserRoles={onUpdateUserRoles}
|
||||
roles={roles}
|
||||
isUpdatingUserRoles={isUpdatingUserRoles}
|
||||
/>
|
||||
)}
|
||||
</Margins>
|
||||
</Stack>
|
||||
|
Reference in New Issue
Block a user