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.
Problem/Motivation
I think for some applications, we only want a few resources enabled. See the following example:
Proposed resolution
Add an option to only display enabled resources in the UI.
Comment | File | Size | Author |
---|---|---|---|
#15 | jsonapi_extras-2886887-15.patch | 3.23 KB | logickal |
#13 | Selection_497.png | 60.33 KB | dagmar |
#11 | interdiff-2886887-5-11.txt | 771 bytes | dagmar |
#11 | 2886887-11.patch | 3.24 KB | dagmar |
#7 | resources_fieldsets.png | 83.65 KB | dagmar |
Comments
Comment #2
dagmarHere is the patch.
Comment #3
dagmarComment #4
shadcn CreditAttribution: shadcn at Chapter Three commentedWhat if we moved disabled resources inside a collapsed fieldset? Like Views UI does it.
Comment #5
dagmarGood idea. Here is the patch.
Comment #6
e0ipso@dagmar can you add a screenshot?
Comment #7
dagmarOf course :)
Comment #8
dagmarComment #9
dagmarNew resources (not overridden) are hidden in both fieldsets.
Comment #10
e0ipsoShould they be a separate fieldset instead?
Also, is the search still working as expected?
Comment #11
dagmarYes the search works for both fieldsets.
This solves the problem with not overridden resources.
Comment #12
e0ipsoHow did you solve it? can you post a screenshot?
Comment #13
dagmarHere is the screenshot.
Comment #14
logickal CreditAttribution: logickal at The Weather Company commentedJust chiming in to say that I love this idea, and the screenshots look great. I'm going to try the patch on our stack this evening and test things out.
Comment #15
logickal CreditAttribution: logickal at The Weather Company commentedPatch is throwing:
Notice: Undefined variable: status in Drupal\jsonapi_extras\JsonapiResourceConfigListBuilder->render() (line 92 of modules/contrib/jsonapi_extras/src/JsonapiResourceConfigListBuilder.php).
Sure enough, the filter is looking for $status, but not defined. Attached patch replaces the variable with a string, and the filter functionality works as I would expect it to.
Besides that, this is a great UI improvement!
Comment #18
e0ipsoThanks for the patch! I did not review the code (for API is hard to review). I did some smoke testing instead.
I made 2 commits to give authorship to the both of you. You rock!
Comment #19
dagmarThanks! Should we move this to fixed then?
Comment #20
e0ipso