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

Nav Unification: Display the stats sparkline on WP Admin for Atomic sites #21655

Merged
merged 6 commits into from
Nov 11, 2021

Conversation

mmtr
Copy link
Member

@mmtr mmtr commented Nov 5, 2021

Fixes Automattic/wp-calypso#56542

Changes proposed in this Pull Request:

Displays the stats sparkline in the WP Admin sidebar of Atomic sites, effectively achieving both Calypso/WP Admin and Simple/Atomic parity.

Screen Shot 2021-11-05 at 15 40 12

Note that the Stats module has been updated to allow a new masterbar param in chart URLs, which produces a slightly different version of the chart suitable for the sidebar (see r124501-wpcom).

Jetpack product discussion

N/A.

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

  • Install Jetpack Beta on an Atomic site and activate to the branch of this PR.
  • Go to any WP Admin screen of your Atomic site.
  • Make sure the sparkline chart is displayed right next to the Stats menu.
  • Make sure the chart matches the one displayed on Calypso screens.
  • Turn off the Stats module (you can do this on the Blog RC).
  • Reload the WP Admin screen.
  • Make sure the sparkline chart doesn't show up.

@mmtr mmtr added [Feature] Stats Data Feature that enables users to track their site's traffic and gain insights on popular content. [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Status] Needs Team Review labels Nov 5, 2021
@mmtr mmtr self-assigned this Nov 5, 2021
Copy link

@test-case-reminder test-case-reminder bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some suggested test cases for this PR.

Stats

  • Visit home page, make sure that page view is recorded in stats
  • Visit home page in AMP view
  • Visit post page in non-AMP and AMP view

If you think that suggestions should be improved please edit the configuration file here. You can also modify/add test-suites to be used in the configuration file.

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello mmtr! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D69685-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Nov 5, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: December 7, 2021.
  • Scheduled code freeze: November 30, 2021.

@BogdanUngureanu
Copy link
Contributor

Nice work, Miguel! I've followed the testing instructions and looks like there's a small UI issue in Chrome:
Screenshot 2021-11-05 at 18 26 36
Maybe I'm missing something? 🤔

@mmtr
Copy link
Member Author

mmtr commented Nov 5, 2021

@BogdanUngureanu I cannot replicate that issue. That happens when the masterbar param is missing from the image URL. Have you modified the code by any chance?

This is what I get:
Screen Shot 2021-11-05 at 17 43 14

@mmtr
Copy link
Member Author

mmtr commented Nov 5, 2021

Scratch that, just found out that the admin-bar-hours-scale chart (1x) doesn't support the masterbar param, so I guess you were getting the 1x image while I was getting the 2x image.

I'll remove the fallback to the 1x image, and just use the 2x image, as done for Simple sites:

esc_url( site_url( 'wp-includes/charts/admin-bar-hours-scale-2x.php?masterbar=1&s=' . get_current_blog_id() ) ),

Update: done in 669afa4.

@BogdanUngureanu
Copy link
Contributor

Tests great for me now in WP-Admin, great job Miguel! One question: do you happen to know why we don't display the sparkline in Calypso?

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to take into account sites where the Stats module will be inactive?

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review labels Nov 8, 2021
@mmtr
Copy link
Member Author

mmtr commented Nov 8, 2021

do you happen to know why we don't display the sparkline in Calypso?

I'd swear we were displaying it (you can see some screenshots in Automattic/wp-calypso#56542), so I wonder if that's due to a recent change. I'll investigate.

@mmtr
Copy link
Member Author

mmtr commented Nov 8, 2021

Do we need to take into account sites where the Stats module will be inactive?

Yup! I totally missed that. Handle it in 8efff91

@mmtr mmtr added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Nov 8, 2021
@mmtr
Copy link
Member Author

mmtr commented Nov 9, 2021

do you happen to know why we don't display the sparkline in Calypso?

I'd swear we were displaying it (you can see some screenshots in Automattic/wp-calypso#56542), so I wonder if that's due to a recent change. I'll investigate.

That was it, should've been fixed in Automattic/wp-calypso#57814.

@BogdanUngureanu
Copy link
Contributor

BogdanUngureanu commented Nov 9, 2021

Thanks for the update! I had another look and the Sparkline now appears both in Calypso and WP-Admin! However, I did notice that in Calypso the vertical bar is higher and whiter than in WP-Admin:
Screenshot 2021-11-09 at 12 05 30
Screenshot 2021-11-09 at 12 05 19

LE: Looks like the line is also positioned a bit differently.

@mmtr
Copy link
Member Author

mmtr commented Nov 9, 2021

However, I did notice that in Calypso the vertical bar is higher and whiter than in WP-Admin

I think that's unrelated to this PR, since it's happening on Simple sites as well. I created a separate issue: Automattic/wp-calypso#57820

BogdanUngureanu
BogdanUngureanu previously approved these changes Nov 9, 2021
@mmtr mmtr added this to the jetpack/10.4 milestone Nov 9, 2021
@samiff samiff self-requested a review November 9, 2021 19:11
samiff
samiff previously approved these changes Nov 9, 2021
Copy link
Contributor

@samiff samiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well for me. Also did a quick check on a non-WPcom Atomic site and didn't notice any issues there 👍

@samiff samiff added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 9, 2021
@Copons Copons dismissed stale reviews from samiff and BogdanUngureanu via 70913e0 November 11, 2021 11:04
@jeherve
Copy link
Member

jeherve commented Nov 11, 2021

Could you try to update this branch with latest master to include the changes from #21697? It should hopefully solve the issue with the Gardening action on this PR.
Scratch that, I think that's something we'll need to fix in the monorepo. See #21712.

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Nov 11, 2021
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Nov 11, 2021
@BogdanUngureanu BogdanUngureanu merged commit bbc0207 into master Nov 11, 2021
@BogdanUngureanu BogdanUngureanu deleted the add/nav-unification-stats-sparkline-atomic branch November 11, 2021 12:57
@Copons
Copy link
Contributor

Copons commented Nov 11, 2021

r234861-wpcom

davidlonjon added a commit that referenced this pull request Nov 16, 2021
* master: (22 commits)
  VideoPress: reload block on rating change (#21653)
  Assets: Changelog for package version 1.12.0 (#21744)
  assets: Add `wp_register_script` wrapper (and then use it everywhere) (#21689)
  eslint-config-target-es: Configure mirror repo (#21731)
  Use monorepo `validate-es` script to validate Webpack builds (#21729)
  Backup: Replace daily backup references/upsell links with new real-time products (#21715)
  Likes: reimplement non-admin portions without jQuery (#21726)
  Autoloader: Not activated autoload queue is false (#21517)
  Sync: add a new method, do_only_first_initial_sync (#21676)
  webpack-config: Configure minifier to preserve translator comments (#21667)
  webpack-config: Use `@automattic/babel-plugin-preserve-i18n` (#21700)
  Create eslint-config-target-es JS package (#21660)
  webpack-config: Fork calypso-build's mini-css-with-rtl plugin (#21595)
  Allow /sites/${site}/external-media/copy/pexels to insert post meta data  (#21659)
  jetpack: Don't set Webpack's `output.pathinfo` in production builds (#21727)
  Boost: Implement support for loading stylesheets when JavaScript is disabled in the context Critical CSS being enabled (#21713)
  RNA: export the Connection store (#21388)
  Display notice when user has unactivated product license keys (#21474)
  Gardening: ensure it can use Composer (#21712)
  Nav Unification: Display the stats sparkline on WP Admin for Atomic sites (#21655)
  ...
@anomiex anomiex removed the [Status] Ready to Merge Go ahead, you can push that green button! label Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Feature] Stats Data Feature that enables users to track their site's traffic and gain insights on popular content. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigation: Stats Sparkline does not appear on WP Admin pages for Atomic sites
7 participants