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

Refactor useDefaultStorageClass hook to use FetchState #3319

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

Gkrumbach07
Copy link
Member

https://issues.redhat.com/browse/RHOAIENG-14219

Description

This PR refactors the useDefaultStorageClass hook to use the useFetchState utility, improving error handling and loading state management. The changes affect several components that use this hook, updating their implementations to handle the new return value format.

Key changes:

  • Rewrote useDefaultStorageClass to use useFetchState
  • Updated components using useDefaultStorageClass to destructure the new return value
  • Added error handling and improved loading state management in SpawnerPage

How Has This Been Tested?

Navigate to the Spawner page and verify that the storage class selection works as expected.

  1. Verify that the ManageStorageModal in the project details page still functions correctly.
  2. Check the StorageClassSelect component to ensure it still displays the correct default storage class.
  3. Test the application's behavior during the loading state of storage classes, ensuring no errors occur and the UI handles the loading state appropriately.
  4. Verify that the SpawnerPage component sets default properly

Test Impact

fixes flaky test

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.76%. Comparing base (25e1a44) to head (6f776e7).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
.../screens/spawner/storage/useDefaultStorageClass.ts 90.90% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3319      +/-   ##
==========================================
- Coverage   84.77%   84.76%   -0.01%     
==========================================
  Files        1309     1309              
  Lines       29292    29310      +18     
  Branches     7955     7977      +22     
==========================================
+ Hits        24831    24844      +13     
- Misses       4461     4466       +5     
Files with missing lines Coverage Δ
.../notebookController/screens/server/SpawnerPage.tsx 65.21% <100.00%> (+0.21%) ⬆️
...ects/screens/detail/storage/ManageStorageModal.tsx 86.04% <100.00%> (ø)
...src/pages/projects/screens/spawner/SpawnerPage.tsx 98.07% <100.00%> (ø)
...cts/screens/spawner/storage/StorageClassSelect.tsx 93.18% <100.00%> (ø)
.../screens/spawner/storage/useDefaultStorageClass.ts 91.30% <90.90%> (-2.45%) ⬇️

... and 29 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25e1a44...6f776e7. Read the comment docs.

@pnaik1
Copy link
Contributor

pnaik1 commented Oct 10, 2024

/lgtm
tested in the cluster

@Gkrumbach07
Copy link
Member Author

/approve

Copy link
Contributor

openshift-ci bot commented Oct 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gkrumbach07

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 355fbf7 into opendatahub-io:main Oct 10, 2024
8 checks passed
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.

2 participants