Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option in metastore settings to stop forcing redirect #4381

Open
wants to merge 20 commits into
base: 2.x
Choose a base branch
from

Conversation

zedmonds96
Copy link
Contributor

@zedmonds96 zedmonds96 commented Jan 14, 2025

Fixes #4326

Describe your changes

Added a configuration option in metastore settings. If checked, the user will be redirected to the datasets view when creating/editing a dataset. If unchecked, the user will remain on the node page for the dataset instead of the redirect.

  • Added configuration key redirect_to_dataset to metastore.settings.yml.
  • Added configuration schema for redirect_to_dataset to metastore.schema.yml.
  • Added redirect_to_datasets checkbox to the metastore settings form in DkanDataSettingsForm.php
  • Restructured the metastore settings form for future maintainability.
  • Modified metastore_admin_form_submit() in metastore_admin.module to get the checkbox value on submission to determine redirect behavior.
  • Added update hook metastore_update_8010() to metastore.install to set the default value of the config.
  • Created functional tests for when the configuration is enabled and disabled in RedirectToDatasetsTest.php

QA Steps

  • Navigate to DKAN -> Metastore Settings.
  • Confirm that the "Redirect to datasets view after form submit" checkbox exists.
  • Verify that it is checked by default.
  • Go to Content -> Add Content -> Create Dataset.
  • Fill in the required fields and submit the form.
  • Expected result: You should be redirected to the datasets view after submission.
  • Return to Metastore Settings.
  • Verify the checkbox is still checked, then uncheck it and save.
  • Edit the dataset you just created, make a small change, and submit again.
  • Expected result: You should stay on the dataset’s node page after submission instead of being redirected.

Checklist before requesting review

If any of these are left unchecked, please provide an explanation

  • I have updated or added tests to cover my code
  • [N/A] I have updated or added documentation

@zedmonds96 zedmonds96 changed the title added settings and schema for new config Add config option in metastore settings to stop forcing redirect Jan 14, 2025
@zedmonds96 zedmonds96 self-assigned this Jan 14, 2025
@zedmonds96 zedmonds96 marked this pull request as ready for review January 15, 2025 15:03
@zedmonds96 zedmonds96 marked this pull request as draft January 15, 2025 15:42
@zedmonds96
Copy link
Contributor Author

Need to add a test for this, moving back to draft.

@zedmonds96 zedmonds96 marked this pull request as ready for review February 7, 2025 16:56
@zedmonds96 zedmonds96 removed their assignment Feb 7, 2025
@zedmonds96
Copy link
Contributor Author

zedmonds96 commented Feb 7, 2025

There is a code climate issue with the metastore settings form having more than 25 lines. It has 29. In my opinion it is readable and well structured, so we should allow it as-is.

Updated the form structure to satisfy codeclimate now and in the future.

@zedmonds96 zedmonds96 self-assigned this Feb 7, 2025
@zedmonds96 zedmonds96 removed their assignment Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make redirect to dataset view optional
1 participant