Problem/Motivation
When you visit /admin/modules/uninstall
and search for a module machine_name, you will not find a result. The problem gets really visible, when you use modules where the module's machine_name differs from the human-readable name.
Examples in Core and Contrib:
- Database Logging (dblog)
- Chaos tools (ctools)
Especially in contrib we see more such examples, where also the module project page presents another name, as the human-readable name (see Chaos tool suite, Configuration Update Manager).
Those inconsistencies let developers (when not using drush) to filter the module list by the module's machine_name. That is working fine at the module list, because the machine_name is part of the description, but not on the uninstall page).
Steps to reproduce the problem
Different behavior between the module list and uninstall module page.
Module list
- Go to
/admin/modules
- Filter for
dblog
- You'll see the "Database Logging" module
Uninstall module
- Go to
/admin/modules/uninstall
- Filter for "dblog"
- You'll see no results
Proposed resolution
Make the filter by module machine_name working in the table at /admin/modules/uninstall
.
Tasks
- Decide, if it is a bug/feature request and/or should be fixed
- DONE. Going to add machine name into a new details element.
Decide, if we should- NO.
Show the module machine_name in the description column, or in it's own column.. Rejected because it takes up too much page space. - NO.
or include it visibility-hidden (if it would be allowed UX-wise) to only make it searchable. Presenting content to screen reader users but not to sighted users isn't inclusive design, rejected on accessibility grounds. - YES. Convert the description into a openable details element and add the machine name into it.
- NO.
- Update the
system-modules-uninstall.html.twig
template.- DONE. Add module machine name to template variables via preprocess hook.
- DONE. Document the machine name variable in template docblock.
- DONE. Convert description to a details element.
- DONE. Add details machine name column to the new details element.
- DONE. Add the show-all-columns feature.
{{ attach_library('core/drupal.tableresponsive') }}
in the form. - DONE. Make the description column responsive, by adding priority-low to match the install page.
- DONE. Copy the template to Claro and adjust css classes to align with Claro install template.
- DONE. Expand the javascript test to use the Claro theme in addition to the default, to test filtering on the new template.
User interface changes
Introduces a new machine name table column on the modules uninstall page. The machine name becomes searchable in the filter.
Make the uninstall table responsive, because the install page is already responsive.
Before
After - original solution
After - final solution
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|
Issue fork drupal-2895388
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
karthikeyan-manivasagam CreditAttribution: karthikeyan-manivasagam as a volunteer commentedFixed
Comment #3
cilefen CreditAttribution: cilefen commentedComment #4
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedThanks for providing the patch @karthikeyan-manivasagam and fixing the issue title @cilefen.
I can confirm, that the patch is fixing the issue using my suggested
.visibility-hidden
approach.In the attached screencast you will be able to see the before and after behavior.
Comment #6
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedComment #7
ifrikThanks this is a good catch that removes some inconsistency in the user experience. With the patch both filter fields on the Modules and the Uninstall page return the same results.
Filter on the Extend page:
Filter on the Uninstall page before:
Filter on the Uninstall with patch:
Comment #8
tstoecklerThis is a really nice feature, thanks everyone for working on it! Kudos for adding the
dir
attribute for non-LTR languages, very nice.Re #7: Did you mean to remove the "Needs usability review" tag? Not sure, so keeping it for now.
I am anything but an accessibility expert, but simply looking at the markup: Won't this simply read the module machine name right after the description for screen-reader users? I.e. "Logs and records system events to the database.dblog". That seems a bit strange, instead I think we should add a (hidden) label for this field. I.e. the markup could be something like this:
As far as I can tell, this would make the output more sensible for screen readers. Although, having written that, we generally try to avoid translating such "chopped-up" strings. I.e. ideally, we would translate
Machine name: @machine-name
in its entirety. That is not really so easy, though, because of the added wrapping markup, but also because thedir="ltr"
makes this somewhat of a special-case.Phew, not really sure. In any case I guess the "needs accessibility review" tag can't hurt here.
Comment #9
ifrikYou were right: no additional UX review needed.
Comment #10
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedAccessibility review of the patch from #2.
I enabled the 4 multilingual modules in core, then filtered by "loc", which matches machine name "locale" of the Interface translation module.
There are some accessibility problems with this.
<details>
.From the issue summary:
Showing the machine name is preferable. I'd say an extra column just for the machine name is the simplest way to do it, rather than putting it in the description column. Updating issue summary with this.
Comment #11
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedThanks all for the thoroughly feedback. I'm taking up the suggestion in #11 and providing the machine name in an own column name.
Comment #12
ifrikHow about adding "priority-medium" as class to the th and td of the machine name column so that it doesn't get in the way on small screens?
Comment #13
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedPatch in #11 - Nice! This is a much more inclusive design.
The patch modifies templates inside the Stable theme. This isn't normally allowed during the D8 minor releases, so I expect we'll have to copy the template from system module to the Seven (and Bartik?) themes, and leave the Stable theme untouched.
Re: 12 - Good idea! Medium priority sounds right. Here's the change request which describes how to add those responsive table classes:
Responsive table classes for modules and themes
Comment #14
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedHmm, I'm not sure if that change reocrd is relevant anymore. The table headers are in the twig file.
TODO:
add the responsive priority-medium class to the machine name column.
don't change Stable theme
copy system module template to Seven + Bartik themes instead
Comment #15
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedIt seems, that it only applys for render arrays. At least in
/core/modules/system/templates/system-modules-details.html.twig
, I saw an example, that directly uses the priority class definition in a twig file.✔ add the responsive priority-medium class to the machine name column.
✔ don't change Stable theme
✔ copy system module template to Seven + Bartik themes instead
Comment #16
tstoecklerTried out the new patch and it works great in all three themes.
I found a number of bugs related to responsive tables and table-striping but none of them are caused by this patch, so will open dedicated issues for those in a minute.
Also attaching screenshots in all three themes.
Not RTBC-ing as this touches a number of areas that I'm not to knowledgable about and I feel like I would going out on three limbs (i.e. accessibility, usability, theme system) at once by pulling the trigger on this one. But I couldn't find anything to complain about.
Comment #17
ifrikFrom a usability point of view: it can be RTBC.
Comment #18
tstoecklerBy the way, opened the following issues that I found reviewing:
Comment #19
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedRe: #16 - good catch on the show-all-columns link.
The install page already has responsive columns. It treats the description column as low priority, so on a phone you just see the checkbox and human-readable module name. To match this, let's make the description column low priority here. I think we can leave the machine name column as medium priority for tablets, as the overall intent of this patch is to help site builders who are familiar with machine names.
The module name variable should be documented in the template's docblock.
Updating issue summary, detailing tasks done/todo, and noting UI changes.
Comment #20
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedfixing broken list nested markup in summary.
Comment #21
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThere are quite a lot of related issues, in particular a bug with the screen reader announcement on the filter. Reviewing these, I think it's safe to keep them as separate issues, and just focus adding the machine name column to the table here. This issue is moving quickly, and the others would still need fixing regardless of the machine name column.
Comment #22
szeidler CreditAttribution: szeidler at Ramsalt Lab commented✔ Document the machine name variable in template docblock.
✔ Add the show-all-columns feature.
{{ attach_library('core/drupal.tableresponsive') }}
in template.I took the proposal up and integrated it into the attached patch. I think consistency with the install page is desirable.
Comment #23
tstoecklerThis is going to need a re-roll after #2923305: Module (un-)install tables have a useless "data-striping" attribute
Comment #24
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedHere's the reroll, so that the patch applies cleanly after #2923305: Module (un-)install tables have a useless "data-striping" attribute
Comment #25
tstoecklerWow, that was quick. Thanks!
Comment #26
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThanks @szeidler. Review of patch #24:
It removes the data-striping attribute from the template in the system module, and the patch applies cleanly.
But there's atill a data-striping attribute in the Seven and Bartik versions, which are new files.
TODO: remove the data-striping attribute from the Seven and Bartik templates.
Comment #27
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedOh :(, you're absolutely right.
Adding a new patch, that includes the removal of the data-stripping on the newly created templates.
Comment #29
ifrikModules can be found machine name, the table is responsive and the points raised in #26 are addressed.
Comment #30
alexpottWe can just do
Instead of duplicating the entire thing.
Also rather then having the machine name comment. Did we considers just using the same format as the install page - i.e putting the machine name in a collapsible thingy along with the other info.
Comment #31
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedThanks for your response, @alexpott.
@andrewmacpherson recommended to add as a column in #10.
Comment #33
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedI updated the patch avoiding the code duplication and using
{% extends %}
instead as suggested in #30.Comment #34
HazaRe-tested latest patch (without code duplication). Still works fine.
Comment #36
alexpottIt feels like the description is a higher priority than the machine name which in many cases is going to be a duplicate of the Name column. Which is one of my concerns about this patch... Views views is not entirely useful. Whilst a column might be the simplest way I still don't understand why we're not following the example of the listing page where you install and including it in the description.
Comment #37
alexpottWe also should have a test asserting that a machine name does appear on the uninstall page.
Comment #38
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedFair point, they will often be similar. I don't think it's a big problem to swap those priorities.
That should be a separate issue I think. Whatever the historical reasons, these pages ended up with a different UI. Adding an extra column here is just a simple way to solve the problem without needing to rethink the design.
FWIW, I don't think the install page is any better. Concealing the machine-name inside a details element means there are sometimes matches with no obvious reason. For example "lo" matches locale machine name, but isn't seen in the human-readable name or description.
Comment #39
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #40
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedAs of #36, I swapped the priorities.
Out of curiosity: As we're not changing the "stable" theme, how would that work in the test?
It would be something like the following in
Drupal\Tests\system\Functional\Module\UninstallTest
Comment #44
tanubansal CreditAttribution: tanubansal at Salsa Digital commentedTested via below mentioned steps and latest patch #40:
Module list
Go to /admin/modules
Filter for dblog
You'll see the "Database Logging" module
Uninstall module
Go to /admin/modules/uninstall
Filter for "dblog"
You'll see no results
Now, uninstall filter does filter by machine name.
This can be moved to RTBC
Comment #45
Abhijith S CreditAttribution: Abhijith S at Zyxware Technologies commentedComment #46
Abhijith S CreditAttribution: Abhijith S as a volunteer and at Zyxware Technologies commentedI have tested using the patch #40.The issue is solved after applying the patch.
Including the screenshot gif : https://www.drupal.org/files/issues/2020-07-28/drupal-uninstall_machine_...
Comment #47
Abhinand Gokhala K CreditAttribution: Abhinand Gokhala K as a volunteer and at Zyxware Technologies commentedHi Tanubansal and Abhijith, Thanks for your time. Abhijith, I have tested the same #40 patch and it is also working from my end. I also didn't find any coding issue in that patch.
Comment #48
Abhinand Gokhala K CreditAttribution: Abhinand Gokhala K as a volunteer and at Zyxware Technologies commentedComment #49
larowlanWe still have the needs tests tag here.
As this is a bug report, we need some test coverage demonstrating the issue, and that the fix resolves the issue.
Comment #50
rajandro CreditAttribution: rajandro as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedI am working on the automated test to cover this scenario.
Comment #51
raman.b CreditAttribution: raman.b at OpenSense Labs commentedAdding test coverage to demonstrate the bug and fix for the issue.
Do we need
system-modules-uninstall.html.twig
for claro?Comment #56
vikashsoni CreditAttribution: vikashsoni as a volunteer and at Zyxware Technologies commentedApplied #15 patch in drupal-9.3.x-dev applied successfully
After patch we able to filter module with machine name at a while of uninstall page
Thanks for the patch
For ref sharing screenshots .....
Comment #57
JeroenTIs there a reason we use extend here? Can't we just delete those templates and the templates defined in the system module will be used?
I also think we should update the templates in stable and stable9.
Comment #58
JeroenTComment #59
bnjmnmRemoving credit for #56 as sufficient screenshots were already provided in #47, and the "after" (were it needed), should show an example of filtering to a list that includes matches, not an empty one.
Comment #62
quietone CreditAttribution: quietone at PreviousNext commentedThis was a bugsmash triage target today. I tested this on Drupal 10.1.x, umami install and reproduced the problem.
The patch needs to be brought up to date. There is a question to answer in #57.
Comment #63
szeidler CreditAttribution: szeidler at Ramsalt Lab commented#57: Adding the extend was based on the feedback in #30, but might need to be reevaluated with the current best practices in Core.
Comment #64
Rishabh Vishwakarma CreditAttribution: Rishabh Vishwakarma at OpenSense Labs for DrupalFit commentedCreated a patch for latest version of Drupal. Please review.
Comment #65
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedNo interdiff, but I have compared patch #64 against #51 and the differences are:
I've not been involved with the actual work on this, so cannot comment on any previous actual chnages, just giving the comparison from last patch.
In response to raman.b in #51 yes we should cater for Claro, given that it is the new default admin theme. Just tested the UI manaully and it works fine already in Claro, but if we are adding a twig template for Olivero we should add one for Claro too.
Comment #66
smustgrave CreditAttribution: smustgrave at Mobomo commentedIf we are going to change the templates we will need a change record for contrib themes.
Comment #67
smustgrave CreditAttribution: smustgrave at Mobomo commentedAdded a change record.
Testing the patch can confirm it is filtering by machine name now
Uploading before/after screenshots to IS
Comment #68
mgiffordThink this falls under 3.2.3.
Comment #69
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedMinor tweaks required for #65 .1 and .4 and Claro template
Comment #70
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUsing MR so that we can more easily see changes without providing interdiff. The first commit is patch #64.
From #57
From #63
So I have removed the Olivero template which appears to be unnecessary. Also fixed trailing space.
Comment #72
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
Testing MR 3273
On Drupal 10.1.x with a standard install
Verified seeing machine_name now.
Go to the uninstall page and searched for menu_link and got "Custom Menu Link" which was expected
Comment #73
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedOne minor inconsistency I noticed (in code, not in functionality) is the way that the
drupal.tableresponsive
library is added. The Install page form already had$form['#attached']['library'][] = 'core/drupal.tableresponsive';
but this was missing from the uninstall form. It does not appear to be needed for manual interactive functioning of the filter, but it is required to allow the javascript tests to react to changing input. It was only when the uninstall form got it's first javascript test (in this issue) that the library was added. However, it was added via{{ attach_library('core/drupal.tableresponsive') }}
in templates/system-modules-uninstall.html.twigSo is there a preference for adding the library via the $form or via the twig template? Even if there is no preference, we should make the two consistent, so that we don't ask this question again. I inadvertantly also added the library to the uninstall $form in this MR (because I was working on #3331975: Uninstall form does not add drupal.tableresponsive library so we at least need to remove one of them as it is unnecessary to do it twice.
Comment #74
alexpottWe need to resolve #73 before committing this.
Comment #75
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThanks @alexpott. I have removed the attach from the twig template, and left it in the $form. This also matches what is in the install form.
Comment #76
smustgrave CreditAttribution: smustgrave at Mobomo commentedRetested following steps from #72
Good job @jonathan1055!
Comment #77
alexpottI've looked at the design of this and I'm not sure what was implemented in #11 is the best we can do. I think we should do what the install form does and add the machine name to the description so that it appears visually (unlike patches before which added it as hidden text).
The machine name is not at all important when uninstalling a module - it's really only useful as something you might know to search for. Yet we're placing in in front of the description which can contain important things like why a module can not be uninstalled.
Compare...
With...
Comment #78
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI agree with @alexpott. Adding the new column just to get the machine name on the page is not the best way to do it. It wastes a lot of screen space, meaning more scrolling, and shows duplicated info for 90% of the modules. This is an admin page, and making admin tasks quick to achieve is a primary goal. It seems from comments #10 and #11 that the decision to make it a new column was done for ease of coding. It's a backwards step in usability and we should be able to improve it to be more like the install page.
In the first instance the machine name can be added into the description cell. In the longer term, we could have a details element, collapsed by default, to match the install page.
Comment #79
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoving to NW for that change then. Makes sense to me.
Comment #80
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHappy to give this a try, unless anyone else wants to do it? No need for more than one person to do duplicate work.
Comment #81
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedArgh, unintentional change (stale-form data?). Back to NW
Comment #82
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFirst draft. Based the details element on the install page. Themeing was OK but not looking quite right, then I realised that Claro has it's own custom twig template for the install page, so I also made one for the uninstall page.
I puposely left the modified twig template indentation wrong on the first commit, so that it is eaaier to see which lines are changed and which have not been altered but merely indented.
If/when this design change is accepted I will update the issue summary.
Comment #83
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThe test failures were because I missed copying
{{ form|without('filters', 'modules', 'uninstall') }}
when creating the Claro template, which meant that the Uninstall button was not in the form. I based it on the install template, which does not have this. Interesting that it was only picked up by HelpTopicSearchTest which checks for uninstalling. Or maybe other tests use the system twig template? The HelpTopic test hasprotected $defaultTheme = 'stark'
so I'm not sure why the Claro template was being used anyway. But lucky that it was, otherwise we would have have green passing tests for a major error in the code.Comment #84
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedAre these test failures random and/or unrelated to the chnages in this MR?
Failure 26 Jan 2023 at 01:46 GMT https://www.drupal.org/pift-ci-job/2576971
Rebase against 10.1.x but no code changes on this MR, we get a different fail
26 Jan 2023 at 11:28 GMT https://www.drupal.org/pift-ci-job/2577847
Branch test at 26 Jan 2023 at 12:42 GMT passes OK.
Comment #85
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI think the failures here are unrelated because there was a branch test at 25 Jan 2023 at 11:48 GMT with the same failure in ests/src/FunctionalJavascript/CKEditor5AllowedTagsTest
https://www.drupal.org/pift-ci-job/2576653
Comment #86
smustgrave CreditAttribution: smustgrave at Mobomo commentedIf they’re ckeditor5 functionalJavascript most likely random.
Comment #87
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedYes, either random or unrelated to this MR, core branch did have a failure ealier. Re-ran after new rebase and all passes here now.
Are we in principle agreed that the expanding details element I added in #82 in response to @alexpott in #77 is the right solution? It works for me, but would be good to get confirmation as many others have looked at this issue before I started on it.
I am going to expand the test coverage for the uninstall page to check the Claro template in addition to the system default, as it was only by luck that the HelpTopic tests used the Claro theme and tested uninstalling, which showed the error in my change.
Comment #88
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI have expanded the test to cover Claro theme in addition to the default. This will fail, demonstrating that the Claro template needs work. Also attempting to run only the 'system' module tests temporarily, for speed and efficiency.
Comment #89
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedAs expected, we now have one test failure:
This shows that the new claro template system-modules-uninstall.html.twig is now being tested when it was not before.
Comment #90
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedTests now pass. Here are few other tweaks to the claro template, to make it align better with both the Claro install template, as I based the original template only on system uninstall. This is now ready for full review again.
Comment #91
smustgrave CreditAttribution: smustgrave at Mobomo commentedFunctional this works like a charm.
Searching for dynamic_page_cache I get nothing
Apply the fix and not I get the module.
Tagging for CR updates as there seems to be additional changes to the system template that others may need to adopt for their custom themes.
Comment #92
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUpdated the issue summary to match the solution.
Comment #93
star-szrI made some updates to the change record but I haven't fully updated it as suggested in #91.
Comment #94
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThanks. The change record still refers to adding a new column, but that is not how the solution is. Since #77 the description is now a details element, collapsed by default, but expandable to show machine name and requirements, similar to what is done on the install page.
Sorry I can't update the change record right now, happy for someone else to do it, or I will next week.
Comment #96
smustgrave CreditAttribution: smustgrave at Mobomo commented@jonathan1055 can you update the MR for 11.x
Comment #98
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThe tests on MR 3273 were OK but now we get one failure
https://git.drupalcode.org/issue/drupal-2895388/-/jobs/564727#L1443
Is this related, or some other problem?
Comment #102
Akhil BabuI have created a new MR against 11.x along with some minor coding standard fixes. Also, upon reviewing the changes,
description table header of
core/modules/system/templates/system-modules-uninstall.html.twig
uses thepriority-medium
class whilecore/themes/claro/templates/admin/system-modules-uninstall.html.twig
usespriority-low
class. Was this intentional, or was it just a mistake?Comment #103
smustgrave CreditAttribution: smustgrave at Mobomo commentedMultiple MRs not sure what's to be reviewed. Should have 1 MR visible or specify which is the one to be reviewed.
Comment #105
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI have hidden MR3273 as that was the original one, on 10.1.x so will not be committed.
@Akhil Babu, can you confim that your first commit on the new MR 6065 for 11.x is exactly the same as was on the 10.2.x MR?
Comment #106
Akhil Babu@jonathan1055 Yes, The first commit in 6065 has all the changes from MR 5496. The next 2 commits are for coding standard fixes.
Comment #107
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThanks @Akhil Babu, it looked like that, but better to ask the person who actually did it.
Your quesion in #102
I recall that it was difficult to decide which template to base the new one. Should the Claro uninstall match the Claro install or the System Uninstall? I used priority-low because Claro install had that. My thinking was that it was more important to be consistent with Claro, rather than between the two uninstall templates. But happy to change it if that was the wrong decision.
Comment #108
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoving to NW for change record updates.
Also believe we need a template for some of the other themes, stable9, maybe starterkit (not 100% on that).