Sponsored Content
The Wayback Machine - https://web.archive.org/web/20210817033025/https://github.com/google/site-kit-wp/issues/2001
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

Show error on single URL details view if no entity is matched #2001

Closed
felixarntz opened this issue Sep 10, 2020 · 7 comments
Closed

Show error on single URL details view if no entity is matched #2001

felixarntz opened this issue Sep 10, 2020 · 7 comments

Comments

@felixarntz
Copy link
Member

@felixarntz felixarntz commented Sep 10, 2020 •

Before we implemented proper entity detection in Site Kit (see #174), the single URL details view worked for any URL part of the site, or even URLs not part of the site for certain services that don't incorporate permission management (such as PageSpeed Insights).

However, now the single URL details view relies on entity detection to find out more information of the "entity" based on the given URL. This means that, if a single URL details view is accessed, it can and should only provide meaningful results if an entity is detected.

This issue should modify the single URL details view accordingly so that, if no current entity is available, a corresponding message is displayed, instead of still attempting to show data (for the new widgets, doing so would fall back to showing site-wide data, which would be just as irrelevant on that screen).


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • On the single URL details view, if there is no current entity (e.g. if the getCurrentEntityURL selector of the core/site store returns null), the screen should show a corresponding message instead of all the regular UI:
    • The "Detailed Page Stats" heading and the back link should be kept.
    • The date range selector should not be there.
    • The white box that would normally have the page title and URL should include the following message: It looks like the URL %s is not part of this site, therefore there is no data available to display. (%s should be the URL taken from the permaLink query parameter)
    • Everything below that box should not be displayed.

Implementation Brief

  • Extract the inner Entity-dependent elements from DashboardDetailsApp into a new DashboardDetailsEntityView component in assets/js/components/dashboard-details/
    • Starting from the div containing <DateRangeSelector />
    • Ending with <DashboardDetailsModules />, inclusive
  • Add a new DashboardDetailsEntityNotFoundView component as a variant (but not copy of) of DashboardDetailsEntityView
    • renders with the following title/url portion
      <div className="
      mdc-layout-grid__cell
      mdc-layout-grid__cell--span-12
      ">
      <Layout>
      <div className="mdc-layout-grid">
      <div className="mdc-layout-grid__inner">
      <div className="
      mdc-layout-grid__cell
      mdc-layout-grid__cell--span-12
      ">
      <h3 className="
      googlesitekit-heading-3
      googlesitekit-dashboard-single-url__title
      ">
      { decodeHtmlEntity( currentEntityTitle ) }
      </h3>
      <Link href={ currentEntityURL } inherit external>
      { currentEntityURL }
      </Link>
      </div>
      </div>
      </div>
      </Layout>
      </div>
      • The h3 and Link components should be replaced by the message in the AC rendered as plain text (i.e. <p>):
        It looks like the URL %s is not part of this site [...]
      • The URL in this block should be sourced from the full URL passed in the permaLink query parameter of global.location.href
  • Update DashboardDetailsApp to conditionally render the appropriate component based on the value of getCurrentEntityURL
    • This URL is provided from the server response so there is no resolver to wait for – it will be available immediately
    • If null, render the DashboardDetailsEntityNotFoundView
    • Otherwise, render the DashboardDetailsEntityView

Tests

  • Add storybook stories for the dashboard details view to render DashboardDetailsApp with stories for both
    • A found Entity
    • A not-found Entity
  • No Jest, E2E changes
  • No VRT changes expected

There are no stories for this view yet, so create a stories/dashboard-details.stories.js module for them

QA Brief

  • Go to the following page: /wp-admin/admin.php?page=googlesitekit-dashboard&permaLink=%2F404-page
  • Make sure that you see everything that is listed in the AC

Changelog entry

  • Show an error message if the URL for the single URL detail view cannot be identified as part of the site.
@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Sep 23, 2020

@felixarntz perhaps the message shouldn't contain the URL itself as it is linked below (assuming the message goes where the title was).

Do you think the message should be rendered as an ErrorText? It probably shouldn't use an h3. If not the error text, then perhaps just a <p>?

@felixarntz
Copy link
Member Author

@felixarntz felixarntz commented Sep 24, 2020 •

@aaemnnosttv I think we should entirely replace the h3 and the Link with the error message. Using ErrorText sounds good to me. The URL wouldn't then show elsewhere, so it can be included in the message.

@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Sep 24, 2020
@eclarke1 eclarke1 removed the Next Up label Sep 28, 2020
@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Oct 2, 2020

@felixarntz on second thought, I think the ErrorText may be a bit too "severe" for this case. This should be an edge case which is likely expected if details were requested for an "unresolvable" URL. This is essentially an internal 404 which reminds me of Google's 404 page which is cute 😄

image

I'm not saying we should steal this exactly, but a few ideas we could borrow:

  • Not using an error appearance – it's not a big deal
  • Only showing the path of the URL – keeps the message shorter by removing the bits which will always be the same (we already do this on dashboard widgets)
  • Using the robot image would be awesome... 😄

What do you think?

@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Oct 2, 2020
@felixarntz
Copy link
Member Author

@felixarntz felixarntz commented Oct 2, 2020

@aaemnnosttv That's fair, let's not use error appearance. I still think we should show the full URL because someone could manually add a permaLink parameter for a completely unrelated website, so then the full URL matters.

For the robot image, probably no because it would require some extra whatever license hassle, so 🤷‍♂️ 😆

@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Oct 2, 2020
@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Oct 2, 2020

@felixarntz IB updated 👍

@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Oct 2, 2020
@felixarntz
Copy link
Member Author

@felixarntz felixarntz commented Oct 2, 2020

IB ✅

@felixarntz felixarntz removed their assignment Oct 2, 2020
@eugene-manuilov eugene-manuilov self-assigned this Oct 5, 2020
@eugene-manuilov eugene-manuilov removed their assignment Oct 5, 2020
@aaemnnosttv aaemnnosttv self-assigned this Oct 6, 2020
@cole10up
Copy link
Collaborator

@cole10up cole10up commented Oct 9, 2020

Tested

Installed, activated and setup SK. Navigated to /wp-admin/admin.php?page=googlesitekit-dashboard&permaLink=%2F404-page

Checked the AC and confirmed content and functionality.
image

Back button functions properly, checked on mobile and other window sizes and browsers.

Passed QA ✅

@felixarntz felixarntz closed this Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants