Skip to content
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

feat(auth): add create user modal to ui #4319

Merged
merged 6 commits into from
Aug 22, 2024

Conversation

Parker-Stafford
Copy link
Contributor

resolve #4278

Screen.Recording.2024-08-21.at.4.42.03.PM.mov

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Aug 21, 2024
disabled={!isDirty}
// Only allow submission if the form is dirty for edits
// When creating allow the user to click create without any changes as the form will be prefilled with valid values
disabled={formMode === "edit" ? !isDirty : false}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was something i noticed, this !isDirty made it so a user had to make edits in the create flow - was originally added so that updates couldn't just be spam clicked

Comment on lines +25 to +28
user {
id
email
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikeldking i did not have luck with datasets in spreading fragments that fetched connections and getting the fragment to refetch so i did not add query type onto the return here and am instead using fetchKey - let me know if i'm missing someting but connections don't seem to be refetchable like that? https://relay.dev/docs/tutorial/mutations-updates/#adding-comments--mutations-on-connections - although users table doesn' thave the connection directive so maybe it would work here...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm struggling with this as well. We can maybe use relay's optimistic updates instead. Then things will be better encapsulated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i'm not sure if optimistic updates work for connections, i might just try the connection directives - i had trouble last time but maybe i can get it to work here

@@ -67,6 +68,7 @@ export function UsersTable() {
],
data: tableData,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enables sorting to work, icons were showing up but wasn't sorting

Copy link
Contributor

@mikeldking mikeldking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments but I think we can iterate on top of this!

app/src/components/settings/RolePicker.tsx Outdated Show resolved Hide resolved
app/src/components/settings/UserForm.tsx Outdated Show resolved Hide resolved
app/src/components/settings/UserForm.tsx Outdated Show resolved Hide resolved
app/src/components/settings/UserForm.tsx Outdated Show resolved Hide resolved
app/src/components/settings/UserForm.tsx Outdated Show resolved Hide resolved
Comment on lines +5 to +7
import { UserRole } from "@phoenix/constants";

const UserRoles = Object.values(UserRole);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd sorta prefer to make this use the API to get the roles. It might be some overhead right now but ultimately a tad more flexible and honest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for me, i can make a follow up to do that

Comment on lines +25 to +28
user {
id
email
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm struggling with this as well. We can maybe use relay's optimistic updates instead. Then things will be better encapsulated

src/phoenix/auth.py Outdated Show resolved Hide resolved
app/src/components/settings/UserForm.tsx Outdated Show resolved Hide resolved
Comment on lines +1 to +4
export enum UserRole {
ADMIN = "ADMIN",
MEMBER = "MEMBER",
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always debate whether or not enums for this kinda thing is worth the effort. I know we do it a fair amount - non-blocking but when something can be expressed as string literal types very simply it begs the question a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll pull from the server - then we can get rid of this I think

@Parker-Stafford Parker-Stafford merged commit e77a390 into main Aug 22, 2024
16 checks passed
@Parker-Stafford Parker-Stafford deleted the parker/4278-create-user-modal branch August 22, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ui] create user modal on the users card in settings
2 participants