-
Notifications
You must be signed in to change notification settings - Fork 0
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added users edit form #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
Edit, | ||
SimpleForm, | ||
TextInput, | ||
ReferenceInput, | ||
AutocompleteInput, | ||
email, | ||
} from "react-admin"; | ||
|
||
const filterToQuery = (searchText: any) => ({ | ||
"name@ilike": `%${searchText}%`, | ||
}); | ||
|
||
export const UserEdit = () => ( | ||
<Edit resource="users" redirect="/users_view"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also need to change the redirect on the DeleteButton |
||
<SimpleForm> | ||
<TextInput source="username" label="Username" /> | ||
<TextInput source="first_name" label="First Name" /> | ||
<TextInput source="last_name" label="Last Name" /> | ||
<TextInput source="email" label="Email" validate={email()} /> | ||
<ReferenceInput source="league_id" reference="leagues"> | ||
<AutocompleteInput | ||
optionText="name" | ||
label="League" | ||
filterToQuery={filterToQuery} | ||
/> | ||
</ReferenceInput> | ||
</SimpleForm> | ||
</Edit> | ||
); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -22,7 +22,7 @@ const postFilters = [ | |||||
|
||||||
export const UserList = () => ( | ||||||
<List filters={postFilters}> | ||||||
<Datagrid> | ||||||
<Datagrid isRowSelectable={() => false}> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<TextField source="id" /> | ||||||
<TextField source="username" label="Username" /> | ||||||
<TextField source="first_name" label="First name" /> | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ALTER TABLE games DROP CONSTRAINT IF EXISTS games_first_player_id_fkey; | ||
ALTER TABLE games DROP CONSTRAINT IF EXISTS games_second_player_id_fkey; | ||
|
||
ALTER TABLE games | ||
ADD CONSTRAINT games_first_player_id_fkey | ||
FOREIGN KEY (first_player_id) | ||
REFERENCES users(id) | ||
ON DELETE CASCADE; | ||
|
||
ALTER TABLE games | ||
ADD CONSTRAINT games_second_player_id_fkey | ||
FOREIGN KEY (second_player_id) | ||
REFERENCES users(id) | ||
ON DELETE CASCADE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use
bulkActionButtons={false}
instead (it completely hides the checkboxes)