Skip to content

Commit

Permalink
Fix for empty user default tab after creation (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
dklimpel authored Oct 8, 2024
1 parent dbcb4f9 commit 9fc0050
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/resources/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
TopToolbar,
NumberField,
useListContext,
Identifier,
} from "react-admin";
import { Link } from "react-router-dom";

Expand Down Expand Up @@ -112,7 +113,10 @@ export const UserList = (props: ListProps) => (
actions={<UserListActions />}
pagination={<UserPagination />}
>
<Datagrid rowClick="edit" bulkActionButtons={<UserBulkActionButtons />}>
<Datagrid
rowClick={(id: Identifier, resource: string) => `/${resource}/${id}`}
bulkActionButtons={<UserBulkActionButtons />}
>
<AvatarField source="avatar_src" sx={{ height: "40px", width: "40px" }} sortBy="avatar_url" />
<TextField source="id" sortBy="name" />
<TextField source="displayname" />
Expand Down Expand Up @@ -153,7 +157,12 @@ const UserEditActions = () => {
};

export const UserCreate = (props: CreateProps) => (
<Create {...props}>
<Create
{...props}
redirect={(resource: string | undefined, id: Identifier | undefined) => {
return `${resource}/${id}`;
}}
>
<SimpleForm>
<TextInput source="id" autoComplete="off" validate={validateUser} />
<TextInput source="displayname" validate={maxLength(256)} />
Expand Down

0 comments on commit 9fc0050

Please sign in to comment.