Skip to content

Conversation

@joelclimbsthings
Copy link
Contributor

@joelclimbsthings joelclimbsthings commented Apr 13, 2022

All Submissions:

Changes proposed in this Pull Request:

Adding a badge to the home-screen item on the admin menu to indicate how many setup tasks remain.

Notes:

  • I also added the badge to the new woo navigation Home item, although I noticed some buggy behavior. Given the state of the woo navigation project I wasn't sure whether to pursue it further in the context of this PR, so I left it as is for now.
  • The admin menu is only updated on a page refresh, so if a task completes with this it won't updated the badge. Updating this on the legacy admin menu will likely be somewhat hacky, but I'm glad to do this if we deem it necessary.

image

Closes #32160 .

How to test the changes in this Pull Request:

  1. Checkout this branch on a fresh site.
  2. Note that this should work with either task list experiment or without entirely.
  3. Notice that no badge is displayed before completing any tasks (Unless one is auto-completed, which is true for at least one of the experiments)
  4. Complete the setup wizard, and notice that the badge is now displayed indicated remaining tasks
  5. Complete a couple other tasks, notice that the badge is updated properly. (don't complete all of them)
  6. Hide the task list, and notice that the badge disappears
  7. Display the task list again through Help -> Setup Wizard -> Task List -> Enable
  8. Notice badge reappears
  9. Complete the setup task list.
  10. Notice the badge now disappears again.

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 by running pnpm nx affected --target=changelog?

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 Apr 13, 2022
return;
}

foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is using basically the same logic and styles as the preexisting orders badge, but I'm receptive to a more elegant way if one exists.

@joelclimbsthings joelclimbsthings requested a review from a team April 14, 2022 21:54
@octaedro octaedro requested review from octaedro and removed request for a team April 21, 2022 14:57
@octaedro
Copy link
Contributor

Good job @joelclimbsthings! The code looks good and it's working as expected but I'm not sure about the current behavior.

There are a few tasks that don't refresh the page after finishing them and the badge doesn't update, creating some confusion.

screenshot-strict-finch jurassic ninja-2022 04 21-14_37_58

Is it possible to update the remaining tasks badge on the fly?
Another option that I can imagine is to force a page refresh after finishing each step. I would add a check to confirm that the experiment is turned on to narrow down that behavior just to the experiment.

@octaedro
Copy link
Contributor

Just in case, referring to step 3 in the testing instructions; if I skip the OBW (without finishing any tasks) I see the badge displaying the remaining tasks. Is that expected?

screenshot-payable-dingo jurassic ninja-2022 04 21-12_19_37

@joelclimbsthings
Copy link
Contributor Author

Thanks for the review @octaedro !

There are a few tasks that don't refresh the page after finishing them and the badge doesn't update, creating some confusion.

Yeah, I actually mentioned this in my "Notes" above. We can definitely do this, although it would just be altering the markup via JS, so feels a bit hacky. That said I still may be in favor of it.

Also, we'd want to ensure that's it's only executed when a task doesn't result in a page refresh, and I'm not sure offhand if there's a good preexisting place to do that, or if we'd have to do something tricky.

Just in case, referring to step 3 in the testing instructions; if I skip the OBW (without finishing any tasks) I see the badge displaying the remaining tasks. Is that expected?

Actually not sure on this one. The original issue doesn't mention that as an exception, but we'd have to ask @jarekmorawski to clarify.

@octaedro
Copy link
Contributor

Thank you @joelclimbsthings for your answer.

Yeah, I actually mentioned this in my "Notes" above. We can definitely do this, although it would just be altering the markup via JS, so feels a bit hacky. That said I still may be in favor of it.

Since this is something with high visibility, I would be cautious about possible inconsistencies because they could be seen as bugs by the user that doesn't refresh the page. Is there a chance for us to improve that?

// CCing @pmcpinto and @jarekmorawski , to have more insights about the expected behavior here.

@joelclimbsthings joelclimbsthings force-pushed the add/32160-add-reminder-badge branch from 7a75a79 to cc09e94 Compare April 25, 2022 21:31
@joelclimbsthings
Copy link
Contributor Author

Thanks @octaedro , I've gone ahead and tentatively added the dynamic update in 48bccc1. I've also updated the feature flag logic to work with the setup task list experiments, and rebased the branch on the current state of trunk.

@joelclimbsthings joelclimbsthings self-assigned this Apr 25, 2022
@pmcpinto
Copy link

There are a few tasks that don't refresh the page after finishing them and the badge doesn't update, creating some confusion.

Considering this, I wonder I we should show just "1" in the badge instead of the number of incomplete tasks. @jarekmorawski @verofasulo what do you think?

@jarekmorawski
Copy link

Considering this, I wonder I we should show just "1" in the badge instead of the number of incomplete tasks. @jarekmorawski @verofasulo what do you think?

"1" can be misleading since it's not entirely clear what it'd mean. How about an asterisk or a simple red dot? Anything to indicate there are things in there that require people's attention. 🤔

image

Copy link
Contributor

@octaedro octaedro left a comment

Choose a reason for hiding this comment

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

Thank you @joelclimbsthings for adding the dynamic update. The changes look good, I just left a couple of small comments.

@joelclimbsthings
Copy link
Contributor Author

Hey @octaedro , I've resolved the issues you brought up, and also took the liberty of tweaking the condition controlling the reminder bar since it was out of date.

@joelclimbsthings joelclimbsthings requested a review from a team May 10, 2022 16:07
@joelclimbsthings joelclimbsthings force-pushed the add/32160-add-reminder-badge branch from ed51f31 to 8e04383 Compare May 11, 2022 23:23
Copy link
Contributor

@jacob-sewell jacob-sewell left a comment

Choose a reason for hiding this comment

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

The only hiccup I had was that hiding the task list didn't result in the badge disappearing until after a refresh.

@joelclimbsthings
Copy link
Contributor Author

Thanks!

The only hiccup I had was that hiding the task list didn't result in the badge disappearing until after a refresh.

Nice catch. Since the remedy would be fairly inelegant and hacky, and it's a fairly rare event, I'm opting for leaving it as is for now. We can revisit if needed.

@joelclimbsthings joelclimbsthings merged commit cb80769 into trunk May 12, 2022
@joelclimbsthings joelclimbsthings deleted the add/32160-add-reminder-badge branch May 12, 2022 19:29
@github-actions github-actions bot added this to the 6.6.0 milestone May 12, 2022
@github-actions
Copy link
Contributor

Hi @joelclimbsthings, 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

@tammullen
Copy link
Contributor

Just noting this PR was merged with a failing k6 test due to the badge addition causing the k6 test assertion (which used the home menu item) to fail.

PR to update the assertion here #33044

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.

Setup experiment: setup reminder badge

7 participants