-
-
Notifications
You must be signed in to change notification settings - Fork 834
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
Add users list to admin dashboard #2626
Conversation
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.
Thank you for putting this together! It's certainly a much needed feature. A few initial comments (I know this is WIP) to guide development:
EditUserModal
doesn't rely on any forum components. Perhaps that could be added here as a button?- A list of group badges might be appropriate here
- Would we want to include any kind of search? I'd lean towards doing that in a separate PR since all the search stuff is currently in the forum component
- Could a table component be a candidate for its own component? It would also be useful for Flag dismiss logging flags#21
@askvortsov1 Thanks for the comments! I'll address those a bit later on.
|
Stuff used by both common and forum should be under common. I'm not 100% sure about some of the stuff I listed (especially search, as all components for that are on the forum side). I think that it might be preferable to keep this minimal at first. We'll certainly want to eventually add more powerful management (for example, searching users, selecting checkboxes on the side, batch group assignment, etc), but that might be better as an extension. |
Added a button to open it up.
Also implemented!
I think it'd be a great addition but, as you said, probably best in a separate PR.
If you'd like me to make it a separate component, we should probably discuss a better API for it. I personally like the dynamic On another note, I have absolutely no clue how to retrieve the total number of users on the forum to correctly display this at the bottom of the table. If someone could point me in the way to go, that'd be a big help. (But if it needs back-end changes, I will run away faster than you can say "PHP"...) |
Yeah I think that's quite sensible. PermissionGrid uses something similar I believe, but I don't know if we'd want to refactor the two under a common use case, that might be a bit much (definitely not in this PR).
It wouldn't not require PHP 😛 |
That sounds like a good idea to me!
🏃 |
Ok, so I've implemented I've no clue about what sort of impact this has on the API response times, especially for very big forums. It's probably something that should be looked into, just in case. I'm just adding emails to the grid -- I'm thinking they should be blurred by default, just an extra thing to prevent "over shoulder data leakage".
I've updated the starting PR comment (?) with an updated GIF of the user list in action: |
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.
Overall this is looking very, very nice! Left a few more comments
It actually shouldn't be breaking. Right now we don't use the forum/common/admin namespaces for imports on the extension side - so as long as it is re-exported in the common compat.js file compatibility should be maintained. When the js files get compiled, the import looks like this Also, is it only 3 users per page? That could be quite cumbersome for a large forum, maybe expand to 10 users per page? I would also like to see a search/filter function on the grid. We already have a user search API so it's only a matter of connecting the two. |
Oh, I learn something new every day! That's great news then.
It is 10 and can be changed easily. I had it set to 3 for demonstration purposes because I didn't feel like creating 100s of fake users :P
I would too. @askvortsov1 suggested that this should be done in a separate PR because stuffing all of the changes needed for it would bulk up the PR a bunch. To be honest, a live search feature wouldn't be too tricky and could just use the endpoint without any of the forum search code/components. What do you think of that? |
That's what I was thinking. We don't need any special search components, it should be a filter (by username) rather than a search. That's the key distinction. Any thoughts, @askvortsov1/others? |
Starting in beta 15, the
https://discuss.flarum.org/d/21160-fake-data has been a godsend for testing
I'd say significantly more, maybe 25-50? 10 is not that many with properly sized table rows.
If there's something we can remove from this PR and move into a different one, we should do so because it's already quite large. |
I'll use that, thanks! Riiight after I update it to work with Beta 16+ :P
50 sounds good. Shouldn't be heavy on the API or anything, and shows enough data to be worthwhile.
Good idea -- let's not add more features here, just review-based changes and fixes :) |
I think this is ready for review, minus the issue I identified above. About to rebase onto master, though! |
I forced the checks to re-run as they failed during the PHP selection part originally. It seems that their passing now. |
Unfortunately they aren't |
I don't think it's his fault. Tests on master are failing as well. https://github.com/flarum/core/pull/2626/checks?check_run_id=2015700780 PHP issue? |
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.
Unless a user is deleted (that would throw off pages), I think it might make sense to cache page datas so if someone is switching back and forth, we might not need to reload it.
Also, we might want to support sorting users by username.
I've also been thinking more about extraction, and I feel like having an "AbstractModelTable" would be very powerful: most of the code here (other than the columns, but those would be in each subclass) is applicable to any model.
Awesome work on this addition! A little tidbit regarding the We can probably keep the route name as |
Implemented your suggestions. I think it fits in to the nav a bit better now! :) Do you think we should keep internal references as |
That's a good question 😅 both are good options, but I would seek input from the other core devs on which would be more practical. I like
|
This permission badly needs to be renamed to |
Could we have the profile link icon/button left-aligned like the rest of the rows in the table? I also believe we can simplify it further by allowing the usernames that are returned to be clickable and take said Admin to the user's profile that way. Now for the "Edit User" column, I think renaming it to "Actions" would leave room for additional operations later down the road such as adding a "Delete" button. We could probably take it one step further to match the front end and simply name it "Controls". I don't want us to add too much to this PR as @askvortsov1 already noted as it is quite huge areadly, but this is more food for thought if anything; let me know how y'all feel about these suggestions if anything ;) |
There are so many ways to approach the way the table is presented, such as only adding icons for actions if we wanted to keep it minimal (bless thee mobile users who have to scroll 🙏) @KyrneDev did this with ReFlar's User Management extension if I'm not mistaken. |
Also,
|
Fixes an issue where the table would jump if an email was unhidden that was longer than the placeholder.
We discussed this, and I think we should keep the button. I can still make it unblur on click, if you'd like though. |
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.
So I've been thinking about this, and I think we should be using a table
instead. While I do like grid
it doesn't make much sense to use it here since we want a straightforward table, and it would be more semantically correct to use that, right now we're just trying to recreate a table with grid
and the fact that the HTML code has little to no separation between the key elements of a tabular layout which is can also end up limiting customization ability.
We could leave it as is for now and change it when we tackle the Table component abstraction.
I completely agree. I brought this up when discussing it with Sasha on Discord and I suggested to leave it until we refactor the table into a separate component. For now this is only on the Admin page, so it's not the biggest deal, but we should look into it. When subgrid comes, I propose we switch to that with table |
Oh I must've missed that, agreed, I'll create an issue for it then and we can look into it sometime after stable.
Yeah, that'll probably be a while, we can look into it when it's available for use. |
ITS MERGE TIME! 🔥🔥 |
Fixes #283
Changes proposed in this pull request:
Adds a list of all forum users to the Admin dashboard
ScreenshotGIF!Confirmed
composer test
).Required changes:
To do