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

change: [M3-8659] - Incorporate Product Family Groups in Side Nav #11080

Merged
merged 29 commits into from
Oct 30, 2024

Conversation

hana-akamai
Copy link
Contributor

@hana-akamai hana-akamai commented Oct 9, 2024

Description 📝

More products are getting added to Cloud Manager, so we need to make sure our side navigation menu can accommodate them.

This PR introduces collapsible Product families into the side nav to allow more products to be shown while also giving users the ability to hide/show relevant families. Additionally, individual product icons have been removed in favor of Product family icons

Note: The Monitor product family icon is still in discussion. Create menu dropdown will be updated in M3-8728.

Changes 🔄

  • Product nav links have been moved inside an accordion except for Managed
    • The default state for the accordions is expanded
    • Collapsed accordions are saved to preferences so state is maintained
  • Individual product icons have been removed, only product families will have icons
    • Empty state landing pages have been updated accordingly
  • When the side menu is collapsed, only product family icons are displayed
    • Hovering over the side menu while it is in the collapsed state will expand the menu with all the items
  • The active product family icon will be green

Code clean up:

  • Removed old unused prefetch code 🧹
  • Migrated styles to Styled components
  • Moved PrimaryLink to its own component

Preview 📷

Before After
image
Screen.Recording.2024-10-28.at.1.38.17.PM.mov

How to test 🧪

Verification steps

(How to verify changes)

  • Pull this PR locally and check different states of the side nav menu
  • To test Managed, you can use the MSW to set Managed to enabled

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@hana-akamai hana-akamai added the UX/UI Changes for UI/UX to review label Oct 9, 2024
@hana-akamai hana-akamai self-assigned this Oct 9, 2024
@hana-akamai hana-akamai marked this pull request as ready for review October 9, 2024 21:07
@hana-akamai hana-akamai requested a review from a team as a code owner October 9, 2024 21:07
@hana-akamai hana-akamai requested review from dwiley-akamai and coliu-akamai and removed request for a team October 9, 2024 21:07
@hana-akamai hana-akamai requested a review from a team as a code owner October 16, 2024 16:13
@hana-akamai hana-akamai requested review from cliu-akamai and removed request for a team October 16, 2024 16:13
@jdamore-linode
Copy link
Contributor

@hana-akamai Happy to address the test failures! I'm guessing we'll need to make changes to some of our utils and a bunch of the tests, so I'll try to take a closer look soon!

@hana-akamai
Copy link
Contributor Author

@jdamore-linode this is still a WIP so things are probably going to change, I'll let you know when this is ready for review!

Copy link

github-actions bot commented Oct 24, 2024

Coverage Report:
Base Coverage: 87.15%
Current Coverage: 87.23%

@@ -0,0 +1,71 @@
import { BetaChip } from '@linode/ui';
Copy link
Contributor Author

@hana-akamai hana-akamai Oct 28, 2024

Choose a reason for hiding this comment

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

This file was more or less moved from PrimaryNav

Comment on lines +240 to +255
let updatedCollapsedAccordions;
if (collapsedAccordions.includes(index)) {
updatedCollapsedAccordions = collapsedAccordions.filter(
(accIndex) => accIndex !== index
);
updatePreferences({
collapsedSideNavProductFamilies: updatedCollapsedAccordions,
});
setCollapsedAccordions(updatedCollapsedAccordions);
} else {
updatedCollapsedAccordions = [...collapsedAccordions, index];
updatePreferences({
collapsedSideNavProductFamilies: updatedCollapsedAccordions,
});
setCollapsedAccordions(updatedCollapsedAccordions);
}
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 ugly, but I figured it was better than using a useEffect to update preferences

}

// Wrapper around PrimaryLink that includes the usePrefetchHook.
export const PrefetchPrimaryLink = React.memo(
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 removed the prefetching code since it's no longer being used

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 the workarounds here! Going forward I think we'll eventually have to refactor or extend ui.nav's helpers to account for product families in the nav bar:

  • Situations where a nav item has the same title as a product family (like in this case with "Monitor")
  • Resilience against cases where a nav item can't be found because its product family is collapsed

Happy to have these tests passing with cy.get in the meantime, thanks again! I'll take a closer look at this and open a ticket for a long term solution soon!

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

This was looking really good!

create-volume.smoke.spec.ts does seem to be failing consistently (CI and locally for me) - might be something going on there, unless this test started being recently flaky outside of this PR - I just hadn't noticed much of that.

@jdamore-linode
Copy link
Contributor

jdamore-linode commented Oct 29, 2024

| create-volume.smoke.spec.ts does seem to be failing consistently

Ah, good catch @mjac0bs!

@hana-akamai this is just because the test is trying to click the "Storage" tab on the Linode details page, but the new "Storage" nav heading is tripping up the test. Super easy fix to replace the cy.findByText('Storage') calls in create-volume.spec.ts on lines 155 and 288 with:

cy.get('main').within(() => {
    cy.findByText('Storage').should('be.visible').click();
});

Edit: and confirmed that the other 2 CI failures can be disregarded 👍

@hana-akamai
Copy link
Contributor Author

Thanks @jdamore-linode! Is the cy.get('main').within(() => {... syntax preferred over using data-testid?

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Overall functionality looks good - product family icons are highlighted when on that page, expanded and collapsed state works as expected, transitions look good (one note about the Akamai logo), and the empty state page icons all match up.

Approving pending that one test Joe noted and ideally an adjustment to the logo transition. Thanks for the changes and the follow up ticket for the icons.

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

This looks great!

Collapsed/expanded sections + collapsed/expanded menu persist across refreshes ✅
Highlighted product family icon based on page you are currently on in Cloud ✅
Code review ✅

@jdamore-linode
Copy link
Contributor

Thanks @jdamore-linode! Is the cy.get('main').within(() => {... syntax preferred over using data-testid?

@hana-akamai For that test, Cypress is trying to click the "Storage" tab on the Linode details page instead of a nav item, but the new Storage product family heading is causing the test to trip up since it only expects to find one instance of the text "Storage". I used cy.get('main').within(() => {...}) there just because it was a quick and easy way to limit Cypress's selection to the main part of the app (i.e. excluding the nav sidebar altogether) which sidesteps the issue, but if that "Storage" tab does have a test ID, selecting it that way would be totally valid too 👍

@hana-akamai hana-akamai merged commit 6c80781 into linode:develop Oct 30, 2024
22 of 23 checks passed
Copy link

cypress bot commented Oct 30, 2024

Cloud Manager E2E    Run #6759

Run Properties:  status check failed Failed #6759  •  git commit 6c80781ec8: change: [M3-8659] - Incorporate Product Family Groups in Side Nav (#11080)
Project Cloud Manager E2E
Branch Review develop
Run status status check failed Failed #6759
Run duration 28m 56s
Commit git commit 6c80781ec8: change: [M3-8659] - Incorporate Product Family Groups in Side Nav (#11080)
Committer Hana Xu
View all properties for this run ↗︎

Test results
Tests that failed  Failures 2
Tests that were flaky  Flaky 4
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 443
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/core/databases/resize-database.spec.ts • 2 failed tests

View Output Video

Test Artifacts
Resizing existing clusters > Resizes a g6-standard-6 MySQL v8.x 3-node cluster > Can resize active database clusters Screenshots Video
Resizing existing clusters > Resizes a g6-dedicated-16 MySQL v5.x 3-node cluster > Can resize active database clusters Screenshots Video
Flakiness  linodes/resize-linode.spec.ts • 1 flaky test

View Output Video

Test Artifacts
resize linode > resizes a linode by increasing size: warm migration Screenshots Video
Flakiness  linodes/linode-config.spec.ts • 2 flaky tests

View Output Video

Test Artifacts
Linode Config management > End-to-End > Boots a config Screenshots Video
Linode Config management > End-to-End > Clones a config Screenshots Video
Flakiness  objectStorage/object-storage.e2e.spec.ts • 1 flaky test

View Output Video

Test Artifacts
object storage end-to-end tests > can upload, access, and delete objects Screenshots Video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UX/UI Changes for UI/UX to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants