Problem/Motivation

/admin/config/development/configuration displays a list of changed and updated config. Many times when the configuration is handled by a repository it is more appropriate to download one config change to the repository than the entire config (such as when a config change has been made on the devel instance needs to deploy to the whole stack. Individual config can be downloaded/uploaded at /admin/config/development/configuration/single/export and /admin/config/development/configuration/single/import, but there is no link from the synchronize page to these pages. It would aid this workflow to be able to link directly to the configuration item from the synchronization screen.

Proposed resolution

Change the button on /admin/config/development/configuration that says "view differences" to a drop-button with options to "View Differences", "Export this config", "Import to this config" with the items linking to the appropriate entry on the export/import page. This will require the following changes

  • Change "View Differences" button to drop-button
    • "View Differences" target remains as is
    • "Export this config" target is /admin/config/development/configuration/single/export?config_type={{type}}&config_name={{name}}
    • "Import to this config" target is /admin/config/development/configuration/single/import?config_type={{type}}&config_name={{name}}
  • Modify /admin/config/development/configuration/single/export and /admin/config/development/configuration/single/import to allow parameters for content_type and content_name

Remaining tasks

User interface changes

  • Change the "View Differences" button on /admin/config/development/configuration to a drop-button with the above options
  • Add ability to select config to export/import based on url parameters.

Release notes snippet

Link directly from Configuration Synchronization page to individual import/export.

Issue fork drupal-3399927

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

kwfinken created an issue. See original summary.

anoopjohn’s picture

This would be a great feature to have. Especially with projects that are under active development / enhancements / customization, there would be a lot of time savings for its developers.

riyas_nr’s picture

StatusFileSize
new4.88 KB

I have created a patch that adds the following link to the 'View Differences' drop-down button on the /admin/config/development/configuration page:

  • "'Export this config' with a target URL of /admin/config/development/configuration/single/export/{{type}}/{{name}}

I have omitted the 'Import this config' link because there is no option for single config selection on the import page.

riyas_nr’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests, +Needs subsystem maintainer review

Kind of change will require test coverage.

Probably also submaintainer sign off.

riyas_nr’s picture

I have added test coverage for the changes. The merge request is ready for review now.

riyas_nr’s picture

Status: Needs work » Needs review

Prashant.c made their first commit to this issue’s fork.

smustgrave’s picture

Status: Needs review » Needs work

Test failure.

riyas_nr’s picture

Status: Needs work » Needs review

Corrected the issue where the configuration type entity did not exist.

abhijith s’s picture

Status: Needs review » Needs work
StatusFileSize
new7.06 MB

Applied MR !5953 on D11.x.

The Export this config button is working fine which is redirecting to export config page with parameters os selected config entity.

However the Import to this config link is not implemented.

prashant.c’s picture

1. Introducing a new link labeled "Import this configuration."
2. Clicking on the link will redirect the user to "/admin/config/development/configuration/single/import/[config_type]/[config_name]."
3. The "Paste your configuration here" textarea will be automatically populated with the original configurations.
4. Press the "Import" button to initiate the import of the default configurations.

However, there are still pending tasks, including code review, code cleanup, and testing.

riyas_nr’s picture

Status: Needs work » Needs review
  1. Fixed phpcs issue regarding unused use statement.
  2. For removed configs, single "Import this config" link leads to 'false' text in the import text area because the config doesn't exist. Added config exists check on the singe import page.
  3. Added test coverage for 'Import this config' link.
smustgrave’s picture

Status: Needs review » Needs work

MR seems to have failures. There are some backwards compatibility concerns as that path will now be broken. May need to cover that.

riyas_nr’s picture

Status: Needs work » Needs review

Refactored the code and removed 'Import this config' link for configs under Removed section.

guptahemant’s picture

Status: Needs review » Needs work

Hi @riyas_nr

Did a code review and included few more suggestions.

riyas_nr’s picture

  1. Added below parameters as optional.
    1. $sync_storage in constructor of \Drupal\config\Form\ConfigSingleImportForm
    2. $entity_type_manager in constructor of \Drupal\config\Form\ConfigSync
  2. Updated deprecation warning for both parameters.
  3. Added change records for above parameters.
riyas_nr’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Left more comments.

riyas_nr’s picture

Status: Needs work » Needs review
  1. Added typehints for method parameters and properties
  2. Changed method name updateImport to getStagedConfigByName()
  3. Changed access modifier of helper functions to protected
  4. Moved optional parameters to end of the constructor arguments
smustgrave’s picture

@alexpott are we good to remove subsystem review?

smustgrave’s picture

Status: Needs review » Needs work

Tried testing this one out.

On the configuration sync page I am seeing the dropdown for export/import

Export seems to work correctly

But import whenI click it I get redirected to the import form. Dropdown is empty and text area is also empty. Seems odd that the dropdown for config was empty at least.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.