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

339 dashboard use request to get the actual scores #21852

Open
wants to merge 2 commits into
base: 529-create-api-endpoint-for-readability-scores
Choose a base branch
from

Conversation

igorschoester
Copy link
Member

@igorschoester igorschoester commented Nov 21, 2024

Context

Summary

This PR can be summarized in the following changelog entry:

  • Implements the fetching of the scores.

Relevant technical choices:

Implement score endpoints and errors

  • refactored seo & readability scores to one component with an "AnalysisType"
  • refactored the useFetch and spread to some more files
  • by default parse the 408 status to a TimeoutError so it matches with the signal' timeout
  • created a wrapper fro the margin, saves adding it in each layer inside
  • fix our wrong assumption of term request using the name (string) and use the id (number) instead
  • use prop drilling to keep the API visible for this iteration

Supply frontend with endpoints and nonce

  • the UI needs to fetch the scores for SEO and readability
  • those routes are protected by a nonce we need to provide
  • introduce endpoint interface -- apply that to the seo scores and readability scores
  • refactor the routes slightly to add the namespace
  • lazier approach with the nonce

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Go to the dashboard
  • Verify you get actual scores
  • Play around with the filters and keep verifying the scores
  • Check out the network tab
  • To mimic a timeout or other errors you can edit the /src/dashboard/user-interface/scores/scores-route-trait.php file. Adjusting the status code of the response in the get_scores method (currently found here)
  • Changing to 408 should result in getting the timeout error
    • see design
    • text at the time of the PR: A timeout occurred, possibly due to a large number of posts or terms. In case you need further help, please take a look at our Support page.
  • Also check that the Support page takes you to our support page in the Yoast admin
  • Changing to any other 4xx or 5xx should result in the other error. Here you could also influence the network throttling in your browser console
    • text at the time of the PR: Something went wrong. In case you need further help, please take a look at our Support page.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/reserved-tasks/issues/339

* refactored seo & readability scores to one component with an "AnalysisType"
* refactored the useFetch and spread to some more files
* by default parse the 408 status to a TimeoutError so it matches with the signal' timeout
* created a wrapper fro the margin, saves adding it in each layer inside
* fix our wrong assumption of term request using the name (string) and use the id (number) instead
* use prop drilling to keep the API visible for this iteration
@igorschoester igorschoester added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Nov 21, 2024
@igorschoester igorschoester added this to the feature/dash-phase-1 milestone Nov 21, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11dcf1f4d34adc21bedc7d763259534a4003fb50

Details

  • 0 of 334 (0.0%) changed or added relevant lines in 34 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-2.9%) to 54.208%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/dashboard/components/dashboard.js 0 1 0.0%
packages/js/src/dashboard/scores/components/content-status-description.js 0 1 0.0%
packages/js/src/dashboard/fetch/timeout-error.js 0 2 0.0%
packages/js/src/dashboard/scores/components/term-filter.js 0 2 0.0%
packages/js/src/general/initialize.js 0 2 0.0%
src/dashboard/domain/scores/readability-scores/abstract-readability-score.php 0 2 0.0%
src/dashboard/domain/scores/seo-scores/abstract-seo-score.php 0 2 0.0%
src/dashboard/domain/taxonomies/taxonomy.php 0 2 0.0%
src/dashboard/user-interface/scores/readability-scores-route.php 0 2 0.0%
src/dashboard/user-interface/scores/seo-scores-route.php 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
packages/js/src/dashboard/scores/components/term-filter.js 1 0.0%
packages/js/src/general/initialize.js 1 0.0%
Totals Coverage Status
Change from base Build 74d330cc7e1393f5f95b4f316783c13de9df323b: -2.9%
Covered Lines: 29764
Relevant Lines: 55244

💛 - Coveralls

@thijsoo thijsoo changed the base branch from feature/dash-phase-1 to 529-create-api-endpoint-for-readability-scores November 21, 2024 13:06
@igorschoester igorschoester force-pushed the 339-dashboard-use-request-to-get-the-actual-scores branch from 3090a21 to 163dffb Compare November 21, 2024 14:36
* the UI needs to fetch the scores for SEO and readability
* those routes are protected by a nonce we need to provide
* introduce endpoint interface -- apply that to the seo scores and readability scores
* refactor the routes slightly to add the namespace
* lazier approach with the nonce
@igorschoester igorschoester force-pushed the 339-dashboard-use-request-to-get-the-actual-scores branch from 163dffb to e5c18f0 Compare November 21, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants