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-8187] - Add useRegionQuery and cleanup bucket landing page #10801

Merged
merged 12 commits into from
Aug 22, 2024

Conversation

jaalah-akamai
Copy link
Contributor

@jaalah-akamai jaalah-akamai commented Aug 19, 2024

Dependency

Description 📝

We need to add a new useRegionQuery hook to allow querying for a single region in the details drawer. Additionally, we should clean up the BucketDetailsDrawer props and deprecate some queries and functions related to OBJ Legacy and Multi-Cluster.

Changes 🔄

  • Implement useRegionQuery hook to get a single region by id
  • Clean up BucketDetailsDrawer
    • Added unit tests for legacy code. We'll cover other paths in an E2E since that requires mocking flags/account capabilities
  • Deprecated some OBJ Legacy and Multicluster functions and queries

Target release date 🗓️

N/A

Preview 📷

No visual changes

How to test 🧪

Prerequisites

  • Test flow by toggling off all OBJ flags (multi-cluster / gen2)
  • Test flow by toggling them on

Verification steps

  • Bucket details drawer should remain unchanged from prod

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

const [isLoading, setIsLoading] = React.useState<boolean>(false);
const [error, setError] = React.useState<APIError[] | undefined>(undefined);
const [
bucketDetailDrawerOpen,
setBucketDetailDrawerOpen,
] = React.useState<boolean>(false);
const [bucketForDetails, setBucketForDetails] = React.useState<
const [selectedBucket, setSelectedBucket] = React.useState<
ObjectStorageBucket | undefined
>(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.

Combined setBucketToRemove and setBucketForDetails into a single useState setSelectedBucket

enabled: Boolean(regionId),
});
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surprised we never had a query like this yet!

Copy link
Contributor

@harsh-akamai harsh-akamai left a comment

Choose a reason for hiding this comment

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

PR looks good 👍

@jaalah-akamai jaalah-akamai marked this pull request as ready for review August 21, 2024 00:41
@jaalah-akamai jaalah-akamai requested a review from a team as a code owner August 21, 2024 00:41
@jaalah-akamai jaalah-akamai requested review from mjac0bs and coliu-akamai and removed request for a team August 21, 2024 00:41
onClose: () => void;
open: boolean;
size?: null | number;
Copy link
Contributor Author

@jaalah-akamai jaalah-akamai Aug 21, 2024

Choose a reason for hiding this comment

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

Keeping props simple by passing the whole bucket down

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

Not seeing the dividers on the Bucket Details drawer in comparison to prod/this pr.

Ty for the additional documentation + tests! 😄

image

}));

// Mock the queries
vi.mock('src/queries/profile/profile', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, what's the difference between mocking queries like this and using server.use/http.get? Are there dis/advantages to each?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using Vitest, you don't have to worry about loading states. You can test the component in all it's states and have more control over the data passed in. The downside it's a bit more fragile than the MSW approach where the that tests things in a more E2E type of way, however you have to account for loading states by using waitFor in certain cases. Historically it has caused flakyness for us in CI when running multiple tests. Both approaches are valid and you can choose whichever makes sense.

Copy link

github-actions bot commented Aug 21, 2024

Coverage Report:
Base Coverage: 82.63%
Current Coverage: 82.63%

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

retested flows, things look good + bucket details drawers matches prod now! ✅

@jaalah-akamai jaalah-akamai merged commit 8812d33 into linode:develop Aug 22, 2024
18 of 19 checks passed
coliu-akamai added a commit to coliu-akamai/manager that referenced this pull request Aug 22, 2024
…age (linode#10801)

Co-authored-by: Jaalah Ramos <[email protected]>
Co-authored-by: Connie Liu <[email protected]>
Co-authored-by: Banks Nussman <[email protected]>
coliu-akamai added a commit to coliu-akamai/manager that referenced this pull request Aug 22, 2024
…age (linode#10801)

Co-authored-by: Jaalah Ramos <[email protected]>
Co-authored-by: Connie Liu <[email protected]>
Co-authored-by: Banks Nussman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants