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

My Jetpack: Update data handling - Implement request status in Product Card #22475

Merged
merged 16 commits into from
Jan 25, 2022

Conversation

retrofox
Copy link
Contributor

@retrofox retrofox commented Jan 24, 2022

Fixes #

Changes proposed in this Pull Request:

This PR updates the data handling implementation for the Products;

  • Change the response shape for the /site/products/$product endpoint
  • Update Redux implementation according to it
  • Implement the initial requesting status for the Product card when an action is run

Jetpack product discussion

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

No

Testing instructions:

  • Go to 'My Jetpack dashboard
  • Play with the Backup card. You should see the error when trying to deactivate the product. It's expected since the handler is not implemented yet on the server-side.
  • You can see how the data is propagated using network and redux tool of your dev tools, in the client:
Screen.Recording.2022-01-24.at.7.15.28.PM.mov

You can hardcode the response for both for the activate_product() and detivate_product() methods respectively

$deactivate_product_result = $product;
$deactivate_product_result['status'] = 'active';
return rest_ensure_response( $deactivate_product_result, 200 );
$deactivate_product_result = $product;
$deactivate_product_result['status'] = 'inactive';
return rest_ensure_response( $deactivate_product_result, 200 );

for the detivate_product() method

Screen.Recording.2022-01-24.at.10.01.31.PM.mov

@retrofox retrofox requested a review from a team January 24, 2022 22:23
@retrofox retrofox self-assigned this Jan 24, 2022
@retrofox retrofox added [Package] My Jetpack [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jan 24, 2022
@retrofox retrofox added this to the My Jetpack 1.0 milestone Jan 24, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 24, 2022

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.

@retrofox retrofox force-pushed the update/my-jetpack-product-card-action-state branch from 9c1c8ac to 1a81bbc Compare January 25, 2022 19:13
@retrofox retrofox requested a review from a team January 25, 2022 19:14
Copy link
Contributor

@renatoagds renatoagds left a comment

Choose a reason for hiding this comment

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

LGTM. Just remembered that I'm not the best one to review the PHP side, so could be good for another person looking at it.

@retrofox
Copy link
Contributor Author

retrofox commented Jan 25, 2022

LGTM. Just remembered that I'm not the best one to review the PHP side, so could be good for another person looking at it.

Thanks for your review. I think we are ok since @leogermani took a look, and even more, he added some changes here, too.

@retrofox retrofox added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jan 25, 2022
@retrofox retrofox enabled auto-merge (squash) January 25, 2022 19:28
@retrofox retrofox merged commit fb959d1 into master Jan 25, 2022
@retrofox retrofox deleted the update/my-jetpack-product-card-action-state branch January 25, 2022 19:35
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 25, 2022
@oskosk oskosk modified the milestones: My Jetpack 1.0, My Jetpack MVP Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

My Jetpack: Change /site/products/$product endpoint response shape My Jetpack: polish product card status
4 participants