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

[3.x] Grid filtering via URL parameters -- Usergroup ACL #16089

Merged

Conversation

smg6511
Copy link
Collaborator

@smg6511 smg6511 commented Mar 11, 2022

What does it do?

This is a global application of the "remembering filter properties" work that @Ruslan-Aleev has been working on. It offers two new methods in the base grid class as well as two new utility methods to handle the the synchronization of grid filtering properties between the grid store and the URL; the feature additionally tracks the main and nested tabs via a listener on the base tabs class.

A couple other small changes to note:

  1. A fix was applied to the GetAreas class so that it outputs a unique, alpha ordered (case insensitive) list with the correct settings counts. The "None" label now shows up as well (previously the entry for an unspecified area was checked for via null instead of empty, which is why only the count currently shows).
  2. The settings grid is now not locked into 'core' being preselected. Now the initial view shows every setting for which the user has permission to see. Because of this, a user can also simply select an area (without regard for the namespace) an get all settings within that area. (The back end query is untouched, it's just a front end tweak that allows this.)

Why is it needed?

@Ruslan-Aleev requested my help a while back to make his feature more globally-applicable and to also bring in the ability to remember the correct tab. Utilizing class inheritance, this approach also will cut down on a lot of code for the filterable grids overall as, aside from a couple special cases where one filter depends on the value of another (such as grids with namespace and area filters), all filter application and clearing methods within individual grids can be removed.

How to test

The current set of changes covers the ACL Usergroup editing area (which is the most complex, having the nested vertical tabs in the Access Permissions tab).

  1. Play with filtering the grids in each area (there are a total of 7 in this section).
  2. Also, copy and paste a few of the generated URLs into a new window to verify that you arrive at the correct grid with filtering applied.
  3. Note that the Settings grid now functions properly when typing into the dropdown filters and tabbing through rather than explicitly making selections via the trigger.
  4. To avoid collisions and incompatible filtering parameters, each time a tab is changed the grid filtering from the previous tab is cleared. Verify that this works as expected.

Related issue(s)/PR(s)

Relates to all of the "remembering filter properties" PRs.

@smg6511 smg6511 requested review from opengeek and Mark-H as code owners March 11, 2022 21:21
@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Mar 11, 2022
@smg6511
Copy link
Collaborator Author

smg6511 commented Mar 11, 2022

Sorry guys; one thing I noticed after opening this was that commit from @Ruslan-Aleev is in here (re template TVs). I'd initially pulled down #16063 as a starting point. I didn't mean for that to be a part of what I was submitting, so just cherry pick the commits I made (4 at this point).

@theboxer @Jako @Ibochkarev - Since you guys have been commenting on Ruslan's work on this feature, I added you all to the review list to get this on your radar.

@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch 2 times, most recently from 5cc7234 to fd33f34 Compare April 7, 2022 05:27
@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch 2 times, most recently from 7fef6aa to 7b737c8 Compare April 20, 2022 16:40
@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch from 7b737c8 to e9f1104 Compare April 26, 2022 19:50
@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch from e9f1104 to 4f0358d Compare July 17, 2022 04:50
@Ibochkarev Ibochkarev added the pr/review-needed Pull request requires review and testing. label Aug 10, 2022
@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch from 4f0358d to bbe2b5f Compare September 17, 2022 04:50
Copy link
Collaborator

@Ruslan-Aleev Ruslan-Aleev left a comment

Choose a reason for hiding this comment

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

Very useful improvements!
If in the future saving tabs and url filters will be extended to all sections (without duplicating unnecessary code), then it will be absolutely great!

url_filters

@smg6511
Copy link
Collaborator Author

smg6511 commented Oct 17, 2022

Thanks for reviewing this @Ruslan-Aleev! I actually have almost all of the grids done and should be able to post a follow-up PR not too long after this one gets implemented.

@smg6511
Copy link
Collaborator Author

smg6511 commented Nov 3, 2022

@JoshuaLuckers @theboxer @Jako @Ibochkarev - Anyone willing to give this a look? Need one more reviewer to move this along ;-)

@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch from bbe2b5f to 02b86b9 Compare November 4, 2022 05:13
@smg6511 smg6511 force-pushed the 3.x-global-filter-persistence--acl-usergroup branch from 02b86b9 to f3751fc Compare December 24, 2022 05:32
@codecov-commenter
Copy link

codecov-commenter commented Dec 24, 2022

Codecov Report

Base: 16.91% // Head: 17.84% // Increases project coverage by +0.92% 🎉

Coverage data is based on head (f3751fc) compared to base (680df53).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##                3.x   #16089      +/-   ##
============================================
+ Coverage     16.91%   17.84%   +0.92%     
+ Complexity    10447    10440       -7     
============================================
  Files           561      561              
  Lines         38028    39049    +1021     
============================================
+ Hits           6433     6967     +534     
- Misses        31595    32082     +487     
Impacted Files Coverage Δ
...rocessors/Element/Template/TemplateVar/GetList.php 0.00% <0.00%> (ø)
...Revolution/Processors/System/Settings/GetAreas.php 0.00% <0.00%> (ø)
core/src/Revolution/modDocument.php 50.00% <0.00%> (-12.50%) ⬇️
core/src/Revolution/Processors/Element/Get.php 50.00% <0.00%> (-5.00%) ⬇️
core/src/Revolution/Processors/Context/GetList.php 75.00% <0.00%> (-5.00%) ⬇️
core/src/Revolution/Processors/Element/GetList.php 78.57% <0.00%> (-4.77%) ⬇️
core/src/Revolution/Processors/Element/Update.php 63.04% <0.00%> (-4.40%) ⬇️
...olution/Processors/Element/PropertySet/GetList.php 48.78% <0.00%> (-4.00%) ⬇️
...ssors/Security/User/GetRecentlyEditedResources.php 27.14% <0.00%> (-3.51%) ⬇️
...e/src/Revolution/Processors/System/ConfigCheck.php 76.22% <0.00%> (-2.67%) ⬇️
... and 109 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Ibochkarev Ibochkarev added this to the v3.0.3 milestone Dec 24, 2022
@JoshuaLuckers
Copy link
Contributor

Seems to work like expected, but I would love to see it remember the selected "vtab" as well. Now it only works if you select a filter

@smg6511
Copy link
Collaborator Author

smg6511 commented Dec 26, 2022

Seems to work like expected, but I would love to see it remember the selected "vtab" as well. Now it only works if you select a filter

That could be done, but I should probably circle back around to that after getting this iteration of the change merged. Aside from the Resource TVs panel, I believe there are only two places where vertical tabs are used (ACLs and during package installation), and the ACLs area is the only place where "bookmarking" the vtab could be useful.

@smg6511 smg6511 added pr/ready-for-merging Pull request reviewed and tested and ready for merging. and removed pr/review-needed Pull request requires review and testing. labels Dec 29, 2022
Jim Graham and others added 5 commits January 16, 2023 08:25
Fix issue with a non-named area being blank in the list. Also fine-tuned the building of the list array so that duplicate areas show only one list entry along with the correct count of setting entries. Lastly, fixed the sorting of the list to make it based on the label and not the actual value.
@opengeek opengeek force-pushed the 3.x-global-filter-persistence--acl-usergroup branch from f3751fc to 44ebbd1 Compare January 16, 2023 15:27
@opengeek opengeek merged commit 13a40a2 into modxcms:3.x Jan 16, 2023
smg6511 pushed a commit to smg6511/revolution that referenced this pull request Jan 17, 2023
Various tweaks to bring changes from this PR in line with the recently-merged modxcms#16089
smg6511 pushed a commit to smg6511/revolution that referenced this pull request Jan 21, 2023
A new listener method added in modxcms#16089 was interfering with package installation and upgrades.
@opengeek
Copy link
Member

Wait, was this an alternative to all of the PRs Ruslan has scheduled for 3.1.0? @smg6511

@smg6511
Copy link
Collaborator Author

smg6511 commented Jan 23, 2023

@opengeek - Yes, that's correct. As mentioned in the description above, Ruslan asked if I could create a more global application of this feature. This PR doesn't cover all of the grids, but I have follow up work covering most of the grids (which I'll submit in small batches [or single ones if you like]) that's been waiting for this initial PR's merging.

@opengeek
Copy link
Member

This should have been on the 3.1.0 milestone. Ugh.

opengeek pushed a commit to smg6511/revolution that referenced this pull request Jan 26, 2023
A new listener method added in modxcms#16089 was interfering with package installation and upgrades.
opengeek added a commit that referenced this pull request Jan 26, 2023
* Fix tab tracking error in package manager

A new listener method added in #16089 was interfering with package installation and upgrades.

* Remove eslint comment

I only meant to disable linting on the file while I was working on it. This re-enables it.

* grunt build

Co-authored-by: Jason Coward <jason@opengeek.com>
Jako added a commit to Jako/revolution that referenced this pull request Mar 11, 2023
If toolbar elements i.e. have to be hidden in a class that extends MODx.grid.SettingsGrid, Ext.getCmp needs an ID to access the toolbar element.

In modxcms#16089 the ID was removed. This PR fixes that but with an ID that is set variable with the Ext.id of the current MODx.grid.SettingsGrid. So multiple MODx.grid.SettingsGrid won't interfere with each other because of using the same ID multiple.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA confirmed for contributors to this PR. pr/ready-for-merging Pull request reviewed and tested and ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants