Skip to content

refactor: [M3-7786] - Convert isRestrictedGlobalGrantType to Hook - #10203

Merged
jaalah-akamai merged 4 commits into
linode:developfrom
jaalah-akamai:M3-7786
Feb 20, 2024
Merged

jaalah-akamai merged 4 commits into
linode:developfrom
jaalah-akamai:M3-7786

Conversation

@jaalah-akamai

@jaalah-akamai jaalah-akamai commented Feb 16, 2024 •

Copy link
Copy Markdown
Contributor

Description 📝

By converting isRestrictedGlobalGrantType to a hook we can avoid having to pass in grants and profile and clean up the API.

Changes 🔄

  • Removed isRestrictedGlobalGrantType util
  • Added useRestrictedGlobalGrantCheck hook
    • Added test coverage

Target release date 🗓️

03/04/2024

Preview 📷

Before

const isRestricted = isRestrictedGlobalGrantType({
    globalGrantType: 'add_nodebalancers',
    grants,
    profile,
});

After

const isRestricted = useRestrictedGlobalGrantCheck({
    globalGrantType: 'add_nodebalancers',
});

How to test 🧪

There should be no functional changes, but see testing instructions: #10095

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

@jaalah-akamai jaalah-akamai self-assigned this Feb 16, 2024
@jaalah-akamai
jaalah-akamai requested a review from a team as a code owner February 16, 2024 20:52
@jaalah-akamai
jaalah-akamai requested review from carrillo-erik and jdamore-linode and removed request for a team February 16, 2024 20:52
@jaalah-akamai jaalah-akamai added the Restricted User Access Improve UX surrounding restricted access to features label Feb 16, 2024

@mjac0bs mjac0bs left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Went through #10095's test steps and confirmed the disabled aspects for a restricted user's account were as expected.

Thanks for the test coverage - those initial cases at least look good for now.

Edit: pending typecheck and unit tests are no longer failing in CI - forgot about those. 👀

Screenshot 2024-02-16 at 2 59 55 PM
Screenshot 2024-02-16 at 2 59 47 PM

Comment thread packages/manager/src/hooks/useRestrictedGlobalGrantCheck.test.ts Outdated
Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Coverage Report: ✅
Base Coverage: 81.24%
Current Coverage: 81.26%

@jdamore-linode jdamore-linode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the hook tests! We don't have a ton of tests for hooks, so it's even more helpful to have these as extra examples for devs to refer to

@jaalah-akamai
jaalah-akamai merged commit f5bd65f into linode:develop Feb 20, 2024
@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Feb 20, 2024
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! Restricted User Access Improve UX surrounding restricted access to features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants