Problem/Motivation

On the Single config export form at /admin/config/development/configuration/single/export, when looking at the Block list of Configuration options, it's sorted alphabetically by label, with the machine name in parenthesis after. For example: Help (claro_help)

Normally when you're exporting config, you know what the machine name is, but not necessarily the label. This makes it extremely difficult to find the config you need, when the list is hundreds or thousands of options long.

However, if you simply switch the order to be machine name, then label, eg. claro_help (Help) then it's easy to find the config you want.

I added a patch to core/modules/config/src/Form/ConfigSingleExportForm.php that swaps the order in the dropdown.

Steps to reproduce

  1. Log in and go to /admin/config/development/configuration/single/export
  2. Under Configuration type select Block.
  3. Open the Configuration name dropdown
  4. See the order is based on label, not machine name.

Proposed resolution

Switch the order so the machine name comes first in the label. Then it will be sorted alphabetically before display.

Remaining tasks

None.

User interface changes

Changes the order of the options in the Configuration name dropdown.

Before:
Export UI before change

After:
After UI before change

API changes

None.

Data model changes

None.

Release notes snippet

None.

Issue fork drupal-3399152

Command icon 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

SamLerner created an issue. See original summary.

mile23’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Think such a change will require test coverage.

Would recommend an MR as patches are phased out and don't auto run the tests anymore. I'll trigger though.

samlerner’s picture

Yes, I was admittedly being lazy by attaching a patch. :) but now I'll make an MR so I can add tests.

samlerner’s picture

Status: Needs work » Needs review

Created an MR with the change to the dropdown, and a test to verify that the options are being sorted alphabetically. Hiding the patch file.

smustgrave’s picture

Status: Needs review » Needs work

Ran the test-only feature in gitlab but the test did not fail. See https://git.drupalcode.org/issue/drupal-3399152/-/jobs/296610 so leaving that tag.

Also seems some existing tests have failed.

samlerner’s picture

There was another functional test that was checking config name labels, and it needed the id/label reversed. Updated that test and pushed up the changes, looks like everything's passing now.

samlerner’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests

Test-only feature is failed.

But there is an open thread from @zniki.ru

samlerner’s picture

I figured out the test block creation part by using BlockContentSaveTest::createBlockContent() as an example. Once I then figured out I needed to use $this->drupalPlaceBlock inside my setUp() method, I was good to go.

samlerner’s picture

Status: Needs work » Needs review
nikolay shapovalov’s picture

Status: Needs review » Needs work

@SamLerner thanks for updating the test scenario. MR looks good, I add some comments, please check and provide feedback.

sourabhjain made their first commit to this issue’s fork.

samlerner’s picture

Status: Needs work » Needs review
nikolay shapovalov’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for MR update. Looks good. RTBC.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs screenshots, +Usability, +Needs subsystem maintainer review

I'm not totally sure about this change, so tagging for subsystem maintainer review. Additionally, since this is intended as a usability improvement, it should have embedded before and after screenshots in the issue summary.

Posted a few points on the MR as well. Thanks!

samlerner’s picture

Issue summary: View changes
StatusFileSize
new139.3 KB
new139.94 KB
samlerner’s picture

Status: Needs work » Needs review

Made all the code updates and attached before/after screenshots.

nitin shrivastava’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new114.25 KB
new185.17 KB

@SamLerner MR#19 has been successfully applied, and now the dropdown will open in the 'config export' based on the machine name.

Before Patch

Example

After Patch

Example

samlerner’s picture

Is there anything else needed for this issue?

xjm’s picture

Status: Reviewed & tested by the community » Needs review

The issue still needs subsystem maintainer signoff for the user expectations of this developer-facing form. @alexpott or @tim.plunkett are maintainers of relevant related subsystems.

dishakatariya’s picture

StatusFileSize
new372.68 KB

Hi, Verified and tested (#20) by taking pull from the latest branch 3399152-change-sort-order on 11.x version. The changes were made are looking fine to me.
Followed the below steps:
1. Log in and go to /admin/config/development/configuration/single/export
2. Under Configuration type select Block.
3. Open the Configuration name dropdown
4. See the order is based on label, not machine name.
Attaching screenshot for reference.
Thanks

dishakatariya’s picture

StatusFileSize
new376.71 KB
alexpott’s picture

This seems like a better way of presenting this information. Nice one.

samlerner’s picture

Thanks! I find it extremely useful because when I'm going to export single configs, I usually know the machine name, as that's what's displayed on the Config Synchronization page at /admin/config/development/configuration. Trying to sort through hundreds of configs by label was pretty time-consuming.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs screenshots +Needs Review Queue Initiative

Thanks @alexpott!

Removing screenshots tag as they appear in the issue summary.

Confirmed applying the MR I'm seeing the configuration sorted by machine name.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4b3313c and pushed to 11.x. Thanks!

  • alexpott committed 4b3313c3 on 11.x
    Issue #3399152 by SamLerner, smustgrave, sourabhjain, DishaKatariya,...
wim leers’s picture

Nice improvement! 😊

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.