feat: Add update user roles action (#1361)

This commit is contained in:
Bruno Quaresma
2022-05-10 14:13:07 -05:00
committed by GitHub
parent c96d439f3d
commit 2df92e6fd3
15 changed files with 469 additions and 46 deletions

View File

@ -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>