site-kit-wp: Update the ReportError component to show the get help link
Feature Description
We need to add the “Get Help” link to the ReportError component to let users to get to the appropriate documentation page for the given error.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The
ReportErrorcomponent should be updated to display the “Get Help” link as shown on the Figma mock next to the retry button, if the retry button is displayed at all.
- Clicking on the Get Help link should redirect the user to the appropriate page on the documentation site.
- The UI of the
ReportErrorcomponent should not change, this is out of scope for this ticket, the only thing that is required is to add the “get help” link with a small extra textRetry didn't work?in a similar way that it is done on the Figma mock. - If the “Retry” button does not apply to the
ReportError, only the “Get help” link should be displayed instead (still with the same regular link appearance, but without the “Retry didn’t work?” prefix).
Implementation Brief
In assets/js/components/notifications/CTA.js:
- Add an optional prop
children. - Render the
childrenproperty at the end of the.googlesitekit-ctadiv.
In assets/js/components/ReportError.js:
- Update the
CTAelement rendering to use the children approach to render the retry button appended withRetry didn’t work?text andGet helplink. If there is no retryable errors, then just display theGet helplink in children.- Remove
ctaTypeandctaLabelprops from theCTAcomponent - Move the
onClickproperty from theCTAcomponent to the retry button defined in children. - Fix the styles of the button and text alignment (only) to match the Figma design.
- Remove
- To get an URL for the “get help” link, pass the first item of the
retryableErrorsarray togetErrorTroubleshootingLinkURL()selector ofCORE_SITEstore.
Test Coverage
- In
assets/js/components/ReportError.test.js, add a test case that verifies the get help link is available in the document. - In
assets/js/components/ReportError.stories.js, verify the existing stories that render theRetrybutton has the get help link.
QA Brief
- Check the ReportError stories to see the newly added Get Help links.
- Check Variants with both Retryable and Not-retryable errors.
- To test it on a real site:
- Add the following PHP snippet on a mu-plugin or function.php.
- Visit the Dashboard to see the Errors.
- There should be get help link.
add_filter(
'rest_pre_dispatch',
function( $res, $_s, $req ) {
if ( $req->get_route() == '/google-site-kit/v1/modules/analytics/data/report' ) {
return new WP_Error( 'rest_bad_request', 'Intentionally broken for testing.', array( 'status' => 400 ) );
}
return $res;
},
10,
3
);
Changelog entry
- Add “get help” links to error messages.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (4 by maintainers)
@mohitwp I have updated the QA Brief. Cheers cc @wpdarren
@wpdarren check AC it says that UI changes are out of scope for this ticket. Just new link should be added.
@kuasha420 could you please provide a more detailed QAB and maybe a snippet that can be added to the
functions.phpfile to break some report requests?@eugene-manuilov Looks good, could you add something though to clarify that the UI from Figma should not really be implemented though? It’s only about adding the extra link in a similar way that it is done there, but in our current error UI.