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

upcoming: [M3-7691] - Create PG in Linode Create Flow #10273

Merged
merged 17 commits into from
Mar 20, 2024

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Mar 11, 2024

Description πŸ“

This PR bring the PG create drawer to the Linode creation flows, within the DetailsPanel

Changes πŸ”„

  • Move PlacementGroupDetailPanel to its own component and add tests
  • Implement PG create flow/drawer
  • Improve naming conventions
  • Improve error handling
  • Improve PG related data sets (mocks and factories)
  • Move logic away from LinodeCreate and keep it contained (CC create refactor - @bnussman-akamai)

Preview πŸ“·

Screenshot 2024-03-13 at 12 55 16

How to test πŸ§ͺ

NOTE: due to MSW limitations, creating a new PG won't place it in the Detail PG select

Prerequisites

  • Have both the "Placement Group" flag and MSW turned on

Verification steps

  • Navigate to http://localhost:3000/linodes/create
  • Test with the following regions:
    • Atlanta: (no existing PG) - can create new PG, can add linode to PG once created (with real API)
      • can't really test payload till real API is wired
    • Chicago: (no capability) can't create new PG, can't add linode to PG
    • Newark: can create new PG, can add linode to PG
      • (confirm placement_group: { id: 1 } in the POST linode/instances payload)
    • Toronto: (no room left on PG) - can create new PG, PG option disabled
    • Fremont: (reach PG capacity for region) - create button disabled, can select PG and add linode to PG
      • (confirm placement_group: { id: 2 } in the POST linode/instances payload)

These are the scenarios I have added coverage in the unit as well

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

@abailly-akamai abailly-akamai self-assigned this Mar 11, 2024
@abailly-akamai abailly-akamai changed the title upcoming: [M3-7691] - Creat PG in Linode Create Flow upcoming: [M3-7691] - Create PG in Linode Create Flow Mar 11, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

massaging our mock data sets so we get a diverse pool of regions

placementGroupsSelectProps={{
...placementGroupsSelectProps,
}}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to a dedicated component

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! πŸ™

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved as much logic as possible away from LinodeCreate and moved it to the PlacementGroupDetailPanel

@@ -615,6 +615,7 @@ class LinodeCreateContainer extends React.PureComponent<CombinedProps, State> {
);
this.setState({
disabledClasses,
placementGroupSelection: undefined,
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 need to reset the placementGroup selection when the region changes. This is an omission from the previous implementation

region: 'us-west',
},
]}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

due to factory data changes

fontSize: '0.875rem',
mt: -0.75,
p: 0,
})}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to use a regular button and style it cause i wanted to use the built in tooltip

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair, but now it feels different than the Create VPC and Create Firewall. Could we use a LinkButton and just wrap it a <Tooltip /> or change the others to be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by "it feels different"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While looking the same, the problem is a bit more complex, so I created a ticket to handle LinkButton to be based on our Button rather than a native button that won't take custom props (LinkButton is based on StyledLinkButton which renders a native button)... we'll clean that up

Copy link
Contributor

Choose a reason for hiding this comment

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

"it feels different" as in there is a ripple effect when you press the button and there is no underline when you hover over the text

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotcha - that's fair: M3-7892

arguably, we'll want the actual Button styles, since underlines are usually reserved for links

I'll try to prioritize this for before Placement Groups go out

Copy link
Contributor

Choose a reason for hiding this comment

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

we'll want the actual Button styles, since underlines are usually reserved for links

I think I agree! Thanks for ticketing it!

@abailly-akamai abailly-akamai marked this pull request as ready for review March 13, 2024 17:16
@abailly-akamai abailly-akamai requested a review from a team as a code owner March 13, 2024 17:16
@abailly-akamai abailly-akamai requested review from dwiley-akamai, hana-linode and carrillo-erik and removed request for a team March 13, 2024 17:16
Copy link

github-actions bot commented Mar 13, 2024

Coverage Report: βœ…
Base Coverage: 81.45%
Current Coverage: 81.5%

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.

  • Atlanta: (no existing PG) - can create new PG, can add linode to PG once created (with real API)
    • can't really test payload till real API is wired
    • confirmed success toast appears when the PG creation form is submitted βœ…
  • Chicago: (no capability) can't create new PG, can't add linode to PG βœ…
  • Newark: can create new PG, can add linode to PG
    • (confirm placement_group: { id: 1 } in the POST linode/instances payload) βœ…
  • Toronto: (no room left on PG) - can create new PG, can't add linode to PG, inline error when selecting PG, error when submitting the Linode create form βœ…
  • Fremont: (reach PG capacity for region) - create button disabled, can select PG and add linode to PG βœ…
    • (confirm placement_group: { id: 2 } in the POST linode/instances payload) βœ…

placementGroupsSelectProps={{
...placementGroupsSelectProps,
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! πŸ™

fontSize: '0.875rem',
mt: -0.75,
p: 0,
})}
Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair, but now it feels different than the Create VPC and Create Firewall. Could we use a LinkButton and just wrap it a <Tooltip /> or change the others to be consistent?

Copy link
Contributor

@hana-linode hana-linode left a comment

Choose a reason for hiding this comment

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

Cancelling the drawer does not reset the state

Screen.Recording.2024-03-19.at.11.15.35.AM.mov

fontSize: '0.875rem',
mt: -0.75,
p: 0,
})}
Copy link
Contributor

Choose a reason for hiding this comment

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

"it feels different" as in there is a ripple effect when you press the button and there is no underline when you hover over the text

@abailly-akamai
Copy link
Contributor Author

thanks @hana-linode - all addressed

@carrillo-erik
Copy link
Contributor

carrillo-erik commented Mar 20, 2024

Very nice work. Solid refactors and I'm in agreement with the updated naming conventions you made. Looks like there's some failures with linodes/rebuild-linode.spec.ts but other than that, looks good to me.

Copy link
Contributor

@hana-linode hana-linode left a comment

Choose a reason for hiding this comment

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

Great work!

@hana-linode hana-linode added the Approved Multiple approvals and ready to merge! label Mar 20, 2024
@abailly-akamai abailly-akamai merged commit bd8054f into linode:develop Mar 20, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Placement Groups
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants