Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow up to issue #1851086: Replace admin/people with a View
Add exposed filters for username, email and number of items per page
Comment | File | Size | Author |
---|---|---|---|
#58 | drupal_2020167_58.patch | 591 bytes | Xano |
#57 | drupal_2020167_57.patch | 0 bytes | Xano |
#48 | user-2020167-47-FAIL.patch | 5.73 KB | tim.plunkett |
#48 | user-2020167-47-PASS.patch | 5.75 KB | tim.plunkett |
#48 | interdiff.txt | 1.21 KB | tim.plunkett |
Comments
Comment #1
irinaz CreditAttribution: irinaz commentedComment #2
xjmI personally find this to be a really overwhelming set of handlers, though the username and email fields are definitely something I want 80% of the time I go to this page. Let's drop the items per page, at least.
Comment #3
xjmComment #4
xjmComment #5
yoroy CreditAttribution: yoroy commentedWhy two seperate text fields? Can it be one where I enter either user name or email? Does 'Active' map to status? Then it should say Status.
I'm not familiar with these filters, I wonder how useful the Permissions one is.
Comment #6
klonosI agree that items per page does not belong there as a filter. If we want that behavior, then we better provide this as a generic, reusable one available in all listings: #2020449: Provide a generic/reusable widget for configuring the number of displayed items per page in admin views listings.
I also agree with merging the name and email in a single text field. BTW, why the "User Name Contains" label while email is simply "E-mail" and why use title case?
If "Active" was chosen because the drop-down is a yes/no one, then #1998192: Allow the boolean labels of exposed filters to be configurable ;)
Comment #7
dawehnerViews can merge multiple exposed filters into one and search on all of them, but the question is whether this confuses the people. I haven't seen this pattern anywhere in views yet.
Comment #8
yoroy CreditAttribution: yoroy commentedGoogle uses a single text field to search the entire interwebs :-) Having more than 1 field for entering a search term is overall the less familiar pattern and more likely to confuse than a single point of entry. At the very least it slows people down a bit because they have to choose between the two.
Comment #9
xjmYeah, I think "Name or e-mail contains" would be fine as one field.
Comment #10
tim.plunkettI'm pretty sure we have the ability to combine two exposed text filters into one.
But I don't think it allows more than 2, which might be frustrating.
Just a heads up. (@dawehner correct me if I'm wrong).
Comment #11
dawehnerWhat do you think. This is views, so it's flexible.
Comment #12
damiankloip CreditAttribution: damiankloip commentedYeah, we def have the Combine filter. IIRC you can select more than 2 aswell, as it just iterates over the selected fields.
Comment #13
xjmThis is #11:
Comment #14
xjmI think this field is a great improvement.
We probably need to do some work with the arrangement of the fields, since there's sort of a chaos of buttons. The + Add user button sort of gets muddled in, especially in overlay, and it's not clear what the difference is between the filter set and the action dropdown. I think all that's out of scope here, though, so retitling for our specific goal in this issue.
Comment #15
xjm@tim.plunkett linked me #1475204: [META] Provide a generic search/filter UI interface pattern for listing pages.
Comment #16
mikeker CreditAttribution: mikeker commented@#14: I've added a header to the view to help separate the Add User button from the filter options. I used the text from the D7 admin/people page but am open to other suggestions.
It would be ideal if we could put the filters into a
frameset
(like D7 does), but Views doesn't currently have any option for wrapping the exposed form in an element. For that matter, there isn't the option to control the label (above/inline/hidden) which some might expect given the Field UI.See also #1812048: Build the exposed form using form API functions which is hoping to rewrite the exposed form rendering code to use FAPI. I need to get some screenshots for that issue before it can move forward... Hopefully later today. That would make it easy to add label placement options to Views for a start.
Comment #17
dawehnerIsn't that quite a lot of space until you come to the actual filtering?
I think we should better use the custom text which does not require you to specify an input format.
Comment #19
mikeker CreditAttribution: mikeker commentedAgreed, we should use an unrestricted text field rather than one tied to a text format which may change to disallow the tag we're using. The attached patch fixes that.
Do you mean that we should use something other than an
h4
? I would've picked anh2
orh3
(which have even more spacing!) as that is more standard, but that was disallowed by the basic_html format. I'm not sure I understand your meaning...(edit: interdiff is between this and the previous patch, not this and #11)
Comment #20
mikeker CreditAttribution: mikeker commentedggrrr...
Comment #21
damiankloip CreditAttribution: damiankloip commentedTo me it seems like this whole header should just be removed :/ I think it clutters up the UI and it seems pretty obvious that the exposed filters are for...filtering. If anything there is a case to add additional markup options for exposed forms, to wrap them but this title, I'm not getting.
Just remove this key entirely.
Also, from experience with admin_views I think it also makes sense to use the remember option to these? Either way, it's worth a discussion I think :)
Comment #22
dawehnerLet's discuss the title in a follow up and write some tests for the filtering.
Comment #23
tim.plunkettThis is extremely nitpicking, but i think /admin/people?combine=yourname is a bit weird, do we want to change the querystring identifier?
Comment #24
dawehnerLet's use 'user' instead, as suggested by tim.
Comment #25
tim.plunkettGreat, thanks @dawehner! It's great to have knocked this out so quickly.
Comment #26
xjmThanks @mikeker -- I think we can address the issue of fixing the header in a followup; it's out of scope for this fix since the problem already exists before this patch.
Comment #27
xjmFiled #2023683: Improve the layout and usability of the admin/people exposed filters and actions.
Comment #28
xjmUhoh, it's broken.
STR:
admin/people
.I tested a few ways and it seems to be matching only the email, not the name. So we need to fix that, and we need more test coverage for it. Not sure if it's a problem with the implementation or with the field mergy thingy in Views itself.
Comment #29
klonosGave #24 a quick spin at simplytest.me and found it not quite working as expected:
- Navigated to /admin/people
- Entered "test" in the name/e-mail field
- Hit the "Filter" button
admin (user 1) got returned as a valid result while the list should be empty.
Comment #30
klonos...just saw xjm's #28. So perhaps the filter does the opposite and is a "does not contain" field actually.
Comment #31
klonos...speaking of which, does anybody else think that we should provide a means for people to invert the filter(s) (for example allowing admins to filter people that are not of a specific role or that do not have a certain permission)? This could either be done by pairing the drop-downs with an extra "is/is not" drop-down or by using a "invert filter" button.
Comment #32
mikeker CreditAttribution: mikeker commentedCurious if the tests included in a given patch are run as part of the tests of that patch? Because the test dawehner added should've caught this...
Anyhow, looks like the user:name filter got dropped from the combined filter at some point. (*#&^@&$ multi-select HTML elements).
Comment #33
xjmIf so, it does only for the name. Email addresses match.
#31 is out of scope here; maybe file a separate issue if you'd like to explore it? I'm not sure we want to add that additional complexity, but we can discuss it.
Comment #34
tim.plunkettWe just changed the exposed filter identifier from 'combine' to 'user', are you sure it was a clean install and whatnot?
I just retested this, it matches both username and email address.
Tentatively re-RTBCing.
Comment #35
xjmThanks @mikeker! NR for the bot, but we still need more extensive test coverage.
Comment #36
mikeker CreditAttribution: mikeker commentedxjm @26: No problem. Let's get the bulk of this in and then fiddle around the edges later... Besides, I've been thinking of a long list of exposed form improvements I'd like to make! :)
Comment #37
mikeker CreditAttribution: mikeker commentedOops... xjm is too quick.
Comment #38
xjm@tim.plunkett, it was on simplytest.me, so yes, it was a clean install.
Comment #39
tim.plunkettMajor cross post.
The interdiff in #32 makes sense, but I guess i'm just matching on mail, not on name (I have admin@example.com as my mail)
Comment #40
xjmI guess I should have provided better STR. ;)
Comment #41
mikeker CreditAttribution: mikeker commentedI just took a look at the existing tests and we hit everything except the Active filter. I'll look into adding that to the coverage.
Comment #42
tim.plunkett@mikeker as you pointed out in #32, name was left out of the combine filter. So how did the tests for name pass?
Comment #43
mikeker CreditAttribution: mikeker commented@tim.plunkett, that was the root of my question: are the tests that are added in a given patch run against that patch by the testbot? Or does the testbot only run the currently committed tests?
I don't have enough experience with core dev to answer that... I appreciate any insights.
Comment #44
tim.plunkettOh, the patch is applied to core and then the tests are run.
Comment #45
mikeker CreditAttribution: mikeker commented@tim.plunkett: thanks for the clarification. I assumed that was the case, but wasn't sure why the earlier patch passed the testbot... Digging deeper, it seems there's a problem with
WebTestBase->drupalCreateUser()
-- it uses the username as the basis for the email address:Pretty much the same thing as happened in #39!
Anyhow, attached is an updated patch that includes tests for the active filter (the only filter left that we don't already test).
Comment #46
mikeker CreditAttribution: mikeker commentedCrap. Wrong patch...
(Interdiff is still the same).
Comment #47
mikeker CreditAttribution: mikeker commentedAh jeez... It's time for bed....
Comment #48
tim.plunkettOkay! That makes sense now.
Comment #49
dawehneroh.
Perfect
Comment #50
dawehnerRemoved tag
Comment #51
klonosStupid me! admin default email in simplytest.me installations is in the form of [random_string]@simplytest.me. Of course it would match "test" as field input.
Comment #52
klonos...btw #1998192: Allow the boolean labels of exposed filters to be configurable is now in so we could change the Active Yes/No drop-down to Status Active/Blocked. Before #14 this issue's title was "Improve admin/people view". So, do we do that here or do you want me to file a separate issue for that?
Comment #53
klonos#2024371: Provide means to invert filters in admin listings (admin/people admin/content etc)
Comment #54
xjmConfirmed that it works now. Yay! This is why we put views in core, people. :D
Comment #55
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks!
Comment #56
xjmhttps://twitter.com/xjmdrupal/status/347799142183075840 :)
Comment #57
XanoTHANK YOU!
A minor language issue: "Name or e-mail contains". An e-mail is a message. We are talking about email addresses here. Also, the style guide says to write "email" without the hyphen. My suggestion: "Name or email address contains"
Comment #58
XanoOops.
Comment #59
tim.plunkettThere are 257 usages of e-mail in core (compared to 741 of email), open a follow-up. Thanks!
Comment #60
xjmOur content style guide specifies "e-mail," so actually don't file a followup. ;) https://drupal.org/style-guide/content
Comment #61
klonosI've also filed #2024893: Change status filter on admin/people to 'active'/'blocked' for #52.
Comment #62.0
(not verified) CreditAttribution: commentedUpdated issue summary.