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

Add/42 new product page #34115

Merged
merged 18 commits into from Aug 3, 2022
Merged

Add/42 new product page #34115

merged 18 commits into from Aug 3, 2022

Conversation

octaedro
Copy link
Contributor

@octaedro octaedro commented Jul 28, 2022

All Submissions:

Changes proposed in this Pull Request:

This PR adds the code to:

  • create a new feature flag for the new product management experience (new-product-management-experience).
  • render a blank reactified page when the flag is enabled and the user navigates to Products > Add New.

screenshot-clean local-2022 07 29-10_06_00

  • modify the href for the following buttons

Products > Add New (using the old and the new navigation) and the Add New button under Products > All Products.

screenshot-clean local-2022 07 29-10_05_52

The Add manually in the Add products task.

screenshot-clean local-2022 07 29-10_06_19

Closes this issue (42-gh-woocommerce/mothra-private).

UPDATE

Since there is no button to create a product with another type other than simple, the commit 2953fb1 has been created to add a menu item named Products > Add New (MVP) and remove (temporarily) the URL override of the old buttons.

After having the button mentioned above in place, the commit 2953fb1 should be deleted.

How to test the changes in this Pull Request:

  1. Checkout this branch.
  2. Turn on the feature flag by using the plugin woocommerce-admin-test-helper (link here). You will see the option new-product-management-experience under Tools > WCA Test Helper > Features.
  3. Refresh the page.
  4. Verify that a blank page is shown with the title Add product after pressing the following buttons:
    Products > Add New and the Add New button under Products > All Products and the Add manually in the Add my products task.
  5. Verify the event view_new_product_management_experience is being recorded when viewing the Add product page.
  6. Verify that it works as expected using the new navigation too.
  7. Turn off the feature flag and verify that the Add New button works as expected.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file for each project being changed, ie pnpm changelog add --filter=<project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added focus: react admin plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Jul 28, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 28, 2022

Test Results Summary

Commit SHA: f430d0e

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests11500201170m 49s
E2E Tests185001018617m 35s
To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@octaedro octaedro changed the title Add/new product page Add/42 new product page Jul 28, 2022
@octaedro octaedro requested a review from a team July 29, 2022 15:13
@octaedro octaedro marked this pull request as ready for review July 29, 2022 15:15
@mattsherman
Copy link
Contributor

Turn off the feature flag (here and here) and verify that the Add New product button works as expected.

@octaedro @louwie17 I think that we need to either:

  • Have a way to switch between the old and the new product experience without having to toggle the feature flag (preferred, as this will allow others to easily test the new experience and still use the old experience without having to do anything), or
  • Expose a switch in the UI to toggle the feature flag (similar to how we handle the new navigation feature flag)

We can’t expect people to make code changes to toggle the feature flag, as that makes it way less easy for non-devs to do, and makes it cumbersome for devs.

@octaedro
Copy link
Contributor Author

octaedro commented Aug 2, 2022

Hey @mattsherman,
Sorry for that. The easiest way to toggle the feature flag is by using the plugin woocommerce-admin-test-helper. The toggle button will be visible under Tools > WCA Test Helper > Features.
I just added that to the testing instructions.

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

Overall looks great @octaedro and it tested well.
One big thing is that the feature flag in core.json should be false as otherwise it is enabled for the next release, keeping it enabled in development.json is fine I think.
I did leave some other comments through out.

I also think it's fine we don't have the Feature toggle under advance settings yet, I think we shouldn't add that until we have a working version ( when our 0.5 MVP is done).

@@ -0,0 +1,16 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

The file name should follow the component name, so maybe rename the file to add-product.tsx
Or to be more explicit about being a page, you could call it AddProductPage and add-product-page.tsx?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed this in commit fbc4f44.

@@ -15,6 +15,7 @@
"minified-js": false,
"mobile-app-banner": true,
"navigation": true,
"new-product-management-experience": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to set this to false, as this would mean that once this is merged the next release will have this feature enabled by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch!

@@ -15,6 +15,7 @@
"minified-js": true,
"mobile-app-banner": true,
"navigation": true,
"new-product-management-experience": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Having this as true is fine for now I think, given we have the MVP button anyway.
Once the MVP button is gone, we might want to turn this back to false and have everyone enabled it themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We usually leave the feature flags turned on in dev since it's a work in progress and the dev environment is exactly to work on those things. I'm not opposed to turning the flag off, but if we follow that pattern, I do think that we should turn off all of them in dev.

@@ -1,93 +1,134 @@
/* global woocommerce_admin */
( function( $, woocommerce_admin ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you make any changes in this file? or is it only formatting?
If only formatting I think you are better off reverting this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you make any changes in this file? or is it only formatting?
If only formatting I think you are better off reverting this change.

Nope, it's only formatting. Sounds good to me. I reverted the formatting fix in commit 53fae30

@@ -213,6 +213,17 @@ public static function get_items() {
);
}

$add_product_mbp = array();
Copy link
Contributor

Choose a reason for hiding this comment

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

Kinda curious what mbp stands for? did you mean mvp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good eyes! I fixed the typo in the commit f430d0e.

@octaedro octaedro requested a review from louwie17 August 3, 2022 16:05
Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

Looks great @octaedro, thanks for the updated changes this tested well and the code looks great, nice work!!

@octaedro octaedro merged commit 835f3d5 into trunk Aug 3, 2022
@octaedro octaedro deleted the add/new-product-page branch August 3, 2022 17:42
@github-actions github-actions bot added this to the 6.9.0 milestone Aug 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2022

Hi @octaedro, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants