Skip to content

Conversation

@mdperez86
Copy link
Contributor

@mdperez86 mdperez86 commented Oct 20, 2022

All Submissions:

Changes proposed in this Pull Request:

Closes #35139.

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Go to Add new product page or Edit product page
  2. The action buttons should be shown in the header and not at the bottom of the form
  3. You should see the action buttons only in those pages

image

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 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.

@mdperez86 mdperez86 self-assigned this Oct 20, 2022
@mdperez86 mdperez86 requested a review from a team October 20, 2022 15:49
@github-actions github-actions bot added focus: react admin plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Oct 20, 2022
@mdperez86 mdperez86 marked this pull request as ready for review October 20, 2022 16:14
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2022

Test Results Summary

Commit SHA: 4eb8f8a

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests19600201980m 42s
E2E Tests186003018911m 33s

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.

Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

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

Excellent work, Maikel! Code looks great and action buttons are testing well.

Left one comment about possibly updating the regex check, but otherwise LGTM 💯

const isProductPage = () => {
return (
query.page === 'wc-admin' &&
/^(\/add-product|\/product)/gi.test( query.path )
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use a check to see if that path is strictly equal to product or add-product instead of regex? If we were to add a new page with a path of product-settings, for example, this would give us a false positive and remove the activity panel items.

Copy link
Contributor Author

@mdperez86 mdperez86 Oct 20, 2022

Choose a reason for hiding this comment

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

Awesome!!! what do you think if we check for /add-product and /product/ segments strictly?

/^\/(add-product|product\/.+)$/gi.test( query.path )

Since the edit product page path is something like /product/{id} that's why I used a regex.

@mdperez86 mdperez86 requested a review from joshuatf October 20, 2022 18:41
@mdperez86 mdperez86 force-pushed the add/35139-header-action-button branch from dc63b3c to 4eb8f8a Compare October 20, 2022 18:54
Copy link
Contributor

@joshuatf joshuatf 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! Thanks for the improvements and added tests, @mdperez86! LGTM 🚢

{ input: '', output: [ '' ] },
{ input: 'product', output: [ 'product' ] },
{ input: 'product/', output: [ 'product' ] },
{ input: '/product', output: [ 'product' ] },
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding these tests around different formats for the path 💯

@mdperez86 mdperez86 merged commit 114be56 into trunk Oct 20, 2022
@mdperez86 mdperez86 deleted the add/35139-header-action-button branch October 20, 2022 20:15
@github-actions github-actions bot added this to the 7.2.0 milestone Oct 20, 2022
@github-actions
Copy link
Contributor

Hi @mdperez86, 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.

Move product action buttons to header menu

3 participants