Problem/Motivation

The configuration form 'Export -> Single item' has no default item for simple configuration. This leads to a confusing experience:

Proposed resolution

Add the empty value '- Select -' for simple configuration as well:

Remaining tasks

Address comments #14 and #27

User interface changes

Export single simple configuration name has an empty value by default '- Select -'

API changes

None

Data model changes

None

CommentFileSizeAuthor
#48 2622468-48.patch2.79 KBkostyashupenko
#47 2622468-nr-bot.txt2.02 KBneeds-review-queue-bot
#45 interdiff_40-45.txt4.79 KBLeticia Gauna
#45 2622468-45.patch2.82 KBLeticia Gauna
#40 2622468-40.patch2.78 KBranjith_kumar_k_u
#40 interdiff_36-40.txt3.62 KBranjith_kumar_k_u
#40 2622468-40-tests-only.patch1.39 KBranjith_kumar_k_u
#38 interddiff-26-36.txt4.45 KBLeticia Gauna
#37 Single export _ After Patch.mp4534.06 KBomkar_yewale
#37 Single export _ Before Patch.mp4501.95 KBomkar_yewale
#36 After-patch-2622468-36.gif691.15 KBLeticia Gauna
#36 2622468-36.patch1.4 KBLeticia Gauna
#31 After patch.png73.29 KBBushra Shaikh
#31 Before patch.png110.57 KBBushra Shaikh
Screen Recording ...mov68 bytesambikahirode
#26 2622468-26.patch3.73 KBsmustgrave
#26 interdiff-21-26.txt721 bytessmustgrave
#21 2622468-21.patch3.73 KBsmustgrave
#21 2622468-21-tests-only.patch993 bytessmustgrave
#12 2622468_10-12_interdiff.txt2 KBPancho
#12 drupal-simple_configuration_empty_value-2622468-12.patch2.75 KBPancho
#11 single-config-export-select.gif272.03 KBidebr
#10 drupal-simple_configuration_empty_value-2622468-10.patch931 bytesPancho
#2 drupal-simple_configuration_empty_value-2622468-2.patch943 bytesidebr
config-no-empty-value-after.gif39.94 KBidebr
config-no-empty-value-before.gif29.79 KBidebr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
FileSize
943 bytes

Attached patch implements the proposed resolution.

swentel’s picture

makes much sense, the only 'annoying' part is that if you would select '- Select - ' again, you get 'false', not sure if we should protect against that.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Pancho’s picture

Rerolled against 8.6.x.
Minor, but IMO clearly an omission and RTBC if tests passing.

idebr’s picture

Version: 8.6.x-dev » 8.7.x-dev
Issue summary: View changes
Status: Needs review » Needs work
FileSize
272.03 KB

I did a manual test and found an issue when switching back to the '- Select' state: the textarea shows `false` and the description below shows `Filename: .yml`. I expected the textarea and its description to be empty, similar to the state when loading the page:

Pancho’s picture

Version: 8.7.x-dev » 8.6.x-dev
Status: Needs work » Needs review
FileSize
2.75 KB
2 KB

Thanks for bringing this up. Actually, even without the patch, this happens when switching back to "- Select -".
Enclosed patch fixes that as well. Do we need a test?

idebr’s picture

Status: Needs review » Reviewed & tested by the community

Not sure if we need a test, considering the change is fairly trivial. Let's leave it up to the maintainers.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

It's a bug, I think it should have a test.

It's not clear if #3 was addressed.

+++ b/core/modules/config/src/Form/ConfigSingleExportForm.php
@@ -160,9 +168,6 @@ public function updateExport($form, FormStateInterface $form_state) {
-    $names = [
-      '' => $this->t('- Select -'),
-    ];

@@ -194,7 +199,7 @@ protected function findConfiguration($config_type) {
-    return $names;
+    return ['' => $this->t('- Select -')] + $names;

The need for this change is not clear.
Also, there is a possibility that $names will not have been defined and this will trigger a warning.


Note that the first set of changes is confusing to read because of the change to use local variables. None of the code is actually changing there; it is being wrapped in a !empty() check.

tim.plunkett’s picture

Component: configuration system » config.module

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

The last submitted patch, 21: 2622468-21-tests-only.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 21: 2622468-21.patch, failed testing. View results

andypost’s picture

smustgrave’s picture

This is more of a UI issue then an error thrown. If you go to the export single item page the dropdown is selected the first item but the config is not loaded by default.

smustgrave’s picture

Status: Needs work » Needs review
FileSize
721 bytes
3.73 KB
tim.plunkett’s picture

  1. +++ b/core/modules/config/src/Form/ConfigSingleExportForm.php
    @@ -144,18 +144,26 @@ public function updateConfigurationType($form, FormStateInterface $form_state) {
    +    if (!empty($config_name)) {
    ...
         else {
    +      $form['export']['#value'] = '';
    +      $form['export']['#description'] = '';
    

    80% of this patch is switching to local variables and indenting. These are the new actual lines.
    (no feedback, just pointing it out to other reviewers)

  2. +++ b/core/modules/config/src/Form/ConfigSingleExportForm.php
    @@ -163,9 +171,6 @@ public function updateExport($form, FormStateInterface $form_state) {
    -    $names = [
    -      '' => $this->t('- Select -'),
    -    ];
         // For a given entity type, load all entities.
         if ($config_type && $config_type !== 'system.simple') {
           $entity_storage = $this->entityTypeManager->getStorage($config_type);
    @@ -197,7 +202,7 @@ protected function findConfiguration($config_type) {
    
    @@ -197,7 +202,7 @@ protected function findConfiguration($config_type) {
             }
           }
         }
    -    return $names;
    +    return ['_none_' => $this->t('- Select -')] + $names;
    

    Why is this moved to the bottom? The change from `''` to `'_none_'` could be done where it was before, no?

  3. +++ b/core/modules/config/tests/src/Functional/ConfigExportUITest.php
    @@ -92,6 +92,12 @@ public function testExport() {
    +    $option_node = $this->assertSession()->optionExists("config_name", '_none_');
    

    If this test was changed to assert that optionExists('config_name', '');, wouldn't that pass already? (also no need for double quotes here)
    The test coverage should help expose the bug.

smustgrave’s picture

@tim.plunkett originally was just a reroll. Picking up tickets that needed tests.

regarding #27.2 it looked like it was cleaner code to me. Changed to _none_ though because setting to nothing was difficult to pickup in the tests. Which answers #27.3

Bushra Shaikh’s picture

Assigned: Unassigned » Bushra Shaikh
Bushra Shaikh’s picture

Assigned: Bushra Shaikh » Unassigned
FileSize
110.57 KB
73.29 KB

Verified and tested patch#26 on drupal 9.5.x-dev. Patch applied successfully.

Testing Steps:

  1. Install drupal 9.5.x-dev version.
  2. Go to admin/config/development/configuration/single/export.
  3. Observe Export single simple configuration name has no empty value.
  4. Apply patch.
  5. Clear cache and reload the page.

Testing result:
I observed that when switching back to the '- Select' state: the text area shows `false` and the description below shows `Filename: _none_.yml`.

Needs review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

2 reviews so going to say RTBC

quietone’s picture

Status: Reviewed & tested by the community » Needs work

It would be nice to have this changed.

Code reviews were done in #14 and #27 which have not been addressed. Setting to Needs Work for those to be done.

The testing done in #29 onwards on this patch seems pre-mature when there are changes to the patch to be made. Remember to read the comments before working on an issue.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Issue tags: +Bug Smash Initiative

Still true, updated the remaining tasks.

Leticia Gauna’s picture

Hello,

I made a new patch and in this case I am correcting both problems:

  • The initial problem of the issue: adding for export single simple configuration name the empty value
  • The problem that when we switching back to the '- Select-' state the text area shows 'false' value

I added a gif where you can check that is working.

If there's anything I can improve just let me know!

Thanks

omkar_yewale’s picture

I have verified and tested patch #36 on Drupal 9.5 and it working fine.
Both of the issues were addressed.
@Leticia Gauna provide an interdiff file.

Leticia Gauna’s picture

Status: Needs work » Needs review
FileSize
4.45 KB

Sorry delay @omkar_yewale!

Here is the interdiff file, the patch is in the comment #36 https://www.drupal.org/project/drupal/issues/2622468#comment-15027683

Thanks

smustgrave’s picture

Version: 9.5.x-dev » 11.x-dev
Status: Needs review » Needs work
Issue tags: +Needs tests

Will need a simple assertion to show the bug is fixed please.

ranjith_kumar_k_u’s picture

ranjith_kumar_k_u’s picture

Status: Needs work » Needs review
smustgrave’s picture

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

Confirmed applying patch #40 that going to the configuration export page the first option is -Select-

smustgrave’s picture

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/config/src/Form/ConfigSingleExportForm.php
@@ -154,8 +154,8 @@ public function updateExport($form, FormStateInterface $form_state) {
+    $form['export']['#value'] = !$this->configStorage->read($name) ? NULL : Yaml::encode($this->configStorage->read($name));
+    $form['export']['#description'] = !$this->configStorage->read($name) ? NULL : $this->t('Filename: %name', ['%name' => $name . '.yml']);

we're calling $this->configStorage->read($name) 3 times here now

How about we do something like this instead

$exists = $this->configStorage->exists($name)

And then use that for our logic instead

Other than that, this looks great - thanks!

Leticia Gauna’s picture

Hey - Here is the patch with test and larowlan suggestion!

Leticia Gauna’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
2.02 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

kostyashupenko’s picture

Status: Needs work » Needs review
FileSize
2.79 KB

Removed extra + symbols from previous patch.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Seems point #44 has been addressed.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 48: 2622468-48.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Seems to be unrelated failure.

lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 288f761 and pushed to 11.x. Thanks!

  • lauriii committed 288f761c on 11.x
    Issue #2622468 by smustgrave, Leticia Gauna, ranjith_kumar_k_u, Pancho,...

Status: Fixed » Closed (fixed)

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