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

Update the UI to switch user aka become user #4294

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

theskumar
Copy link
Member

@theskumar theskumar commented Dec 18, 2024

Fixes #4131

  • Rename to "switch user"
  • Can switch from the user menu
  • Switch to choices.js from Select2
  • Update the hijacked view, shows an alert at the top

Screenshot 2024-12-18 at 9  22 59@2x
Screenshot 2024-12-18 at 9  23 31@2x
Screenshot 2024-12-18 at 9  23 53@2x
Screenshot 2024-12-18 at 9  24 19@2x

@theskumar theskumar self-assigned this Dec 18, 2024
@frjo frjo added Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Patch Mini change, used in release drafter labels Dec 18, 2024
@frjo
Copy link
Contributor

frjo commented Dec 18, 2024

This looks and works really nicely! Will be a pleasure to use when we get it deployed.

I have one issue. The function get_become_user_choices() is slow. I think get_role_names() takes up most of the time.

With 4000 users it takes around three (3) seconds. I think OTF has even more users. This should not be used in production but even test data can have a lot of users.

Possible to speed it up a bit, showing the role in the list is useful so good if we can keep that. Maybe caching the list would work?

hypha/apply/users/forms.py Outdated Show resolved Hide resolved
@theskumar
Copy link
Member Author

I have one issue. The function get_become_user_choices() is slow. I think get_role_names() takes up most of the time.

With 4000 users it takes around three (3) seconds. I think OTF has even more users. This should not be used in production but even test data can have a lot of users.

Will look into it.

@wes-otf
Copy link
Contributor

wes-otf commented Dec 18, 2024

This is super slick! I really like the banner as opposed to the pop up window that you need to dismiss every time you reload the page. Nice improvement!

@theskumar
Copy link
Member Author

theskumar commented Dec 20, 2024

@frjo Updated the query to fetch the groups. It should always come down to 2 queries now. That said, if we face issue in the test site, we can switch to fetching the options as you type, via a search api.

@theskumar
Copy link
Member Author

The new implementation of user.is_* checks will improve the performance overall at multiple places.

@theskumar theskumar force-pushed the enchancement/hijack-interface branch 2 times, most recently from 33c3b69 to 8487108 Compare December 20, 2024 09:23
@theskumar theskumar requested a review from frjo December 20, 2024 09:26
- Rename to "switch user"
- Can switch from the user menu
- Switch to choices.js from Select2
- Update the hijacked view, so an alert at the top
@theskumar theskumar force-pushed the enchancement/hijack-interface branch from 8487108 to 9bf14fb Compare December 20, 2024 10:31
Copy link
Contributor

@frjo frjo left a comment

Choose a reason for hiding this comment

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

Now the load time is more or less instant and works equally well in other respects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Patch Mini change, used in release drafter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the "Become" functionality to the user menu
3 participants