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

Storage class dropdown select #3212

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

Gkrumbach07
Copy link
Member

Closes: RHOAIENG-1109

Description

This is a continuation of @dpanshug PR

  • added default selection
  • added default label
  • corrected autofill for default
  • added alerts for select

Added new field to select storage class to create pvc.

Screenshot 2024-09-13 at 2 17 21 PM
Screenshot 2024-09-13 at 2 17 07 PM
Screenshot 2024-09-13 at 2 17 00 PM

How Has This Been Tested?

Create a new cluster storage and you check list of storage classes in the field.
Create new workbench and select storage class in cluster storage.

Test Impact

added test for default being set

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
    @xianli123

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 89.69072% with 10 lines in your changes missing coverage. Please review.

Project coverage is 85.43%. Comparing base (7964daa) to head (8fcdf1a).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ects/screens/detail/storage/ManageStorageModal.tsx 76.47% 4 Missing ⚠️
...cts/screens/spawner/storage/StorageClassSelect.tsx 90.00% 4 Missing ⚠️
...src/pages/projects/screens/spawner/SpawnerPage.tsx 83.33% 1 Missing ⚠️
.../screens/spawner/storage/useDefaultStorageClass.ts 93.33% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3212      +/-   ##
==========================================
+ Coverage   85.34%   85.43%   +0.08%     
==========================================
  Files        1275     1277       +2     
  Lines       28010    28080      +70     
  Branches     7449     7487      +38     
==========================================
+ Hits        23905    23990      +85     
+ Misses       4105     4090      -15     
Files with missing lines Coverage Δ
frontend/src/api/k8s/pvcs.ts 100.00% <100.00%> (ø)
...c/pages/projects/screens/spawner/SpawnerFooter.tsx 77.31% <100.00%> (-0.56%) ⬇️
...tend/src/pages/projects/screens/spawner/service.ts 68.88% <100.00%> (ø)
...src/pages/projects/screens/spawner/spawnerUtils.ts 81.30% <100.00%> (+0.08%) ⬆️
...creens/spawner/storage/CreateNewStorageSection.tsx 100.00% <100.00%> (ø)
...creens/spawner/storage/usePreferredStorageClass.ts 77.77% <100.00%> (+11.11%) ⬆️
...rc/pages/projects/screens/spawner/storage/utils.ts 100.00% <100.00%> (ø)
frontend/src/pages/projects/types.ts 100.00% <ø> (ø)
...src/pages/projects/screens/spawner/SpawnerPage.tsx 98.07% <83.33%> (-1.93%) ⬇️
.../screens/spawner/storage/useDefaultStorageClass.ts 93.33% <93.33%> (ø)
... and 2 more

... and 23 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 7964daa...8fcdf1a. Read the comment docs.

@xianli123
Copy link

xianli123 commented Sep 14, 2024

Thanks @Gkrumbach07 @dpanshug .
Is it feasible to show the storage class in the dropdown (as shown in the screenshot below) when the class is deprecated? I also attached the second screenshot as a reference.

We might show 2 states in this case:

  1. When the class is disabled in RHOAI, we can show the class name and disable the dropdown.
  2. When the class is deleted from OpenShift, we can make it as what the 1st screenshot shows.
    Does it make sense?

[1st screenshot]
image

[2nd screenshot]
Screenshot 2024-09-14 at 09 56 26

frontend/src/pages/storageClasses/utils.ts Outdated Show resolved Hide resolved
<SplitItem>
{config?.isDefault && (
<Label isCompact color="green">
Default class
Copy link
Contributor

Choose a reason for hiding this comment

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

@xianli123 I'm noticing this reads Default class here for a Select that has a label giving context of Storage class, and in the storage classes table, a row with the "default" openshift label only reads Default. Should they not be the same?

image

Choose a reason for hiding this comment

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

Hi @jpuzz0.They are different.

  • In the class table, the default label next to the class means that this class is the default class in OpenShift.
  • The Default class here for a 'Select' in storage creation form means that this class is the default class in RHOAI.
    Initially, RHOAI uses Openshift's default class as its default class. If the RHOAI admin chooses another enabled class as the RHOAI default class, the new RHOAI default class will be used when the new storage is created.
    Is it clear?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, thanks for clarifying! Should this label have a tooltip letting the user know this is the RHOAI default and not the Openshift default?

@jpuzz0
Copy link
Contributor

jpuzz0 commented Sep 16, 2024

Looks like when I try clicking on a storage class name in the dropdown it is not set in the form:

Screen.Recording.2024-09-16.at.10.27.19.AM.mov

Also, it appears even though the field is marked as required, I'm able to submit the workbench create form without a value specified.

@Gkrumbach07
Copy link
Member Author

Screenshot 2024-09-16 at 12 16 08 PM

@xianli123 I fixed it so now deprecated also shows the name

dpanshug and others added 2 commits September 16, 2024 14:54
…tVolumesForNotebook function

fix tests

fix disabled checks

pr fixes to state

added tests

linter fix
@jpuzz0
Copy link
Contributor

jpuzz0 commented Sep 17, 2024

image

I think this might be incorrectly showing a warning message in this form where nothing has been selected for the storage class dropdown.

@jpuzz0
Copy link
Contributor

jpuzz0 commented Sep 17, 2024

image I think this might be incorrectly showing a warning message in this form where nothing has been selected for the storage class dropdown.

I'm still seeing this after the recent commit meant to fix the issue:
image

popperProps={{ appendTo: menuAppendTo }}
/>
<FormHelperText>
{selectedStorageClassConfig && !selectedStorageClassConfig.isEnabled ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

If a storage class config is not enabled, its considered deprecated? Are we sure this is the condition meant to use to indicate when a storage class is deprecated?

Copy link
Member Author

Choose a reason for hiding this comment

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

not enabled is deprecated, thats what was in the mocks

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't consider this blocking since this is how the mocks describe it, but @xianli123 Is "Deprecated" the appropriate term to use here? Can't the user just turn around and enable the storage class from the storage classes table? I guess my question is why not just consider it "Disabled"?

Copy link
Member Author

Choose a reason for hiding this comment

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

lets merge it now bc this pr blocks purva's, and we can circle back to it

Choose a reason for hiding this comment

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

Hi @Gkrumbach07 @jpuzz0 Let me explain how to get the 'deprecated' class:

  1. RHOAI admin enabled a class e.g. 'Class1'.
  2. Users used the 'Class1' to create storage e.g. 'Storage1'.
  3. RHOAI admin disabled 'Class1'.
  4. Users will see 'Class1' is deprecated when checking 'Storage1'.

In a word, if the class is never enabled, it should not be a deprecated class, because users cannot select it. If the class has been enabled and used by some storage, after disabling the class, the class will be marked as 'Deprecated' in the storage that is using this newly disabled class.
Does it make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

@xianli123 Thanks for explaining!

@Gkrumbach07 Are we checking to make sure the user created storage using the enabled class? Seems that is a prerequisite on top of the disabled state to mark the class as deprecated.

@Gkrumbach07
Copy link
Member Author

@jpuzz0 I found the issue. when no default is set, i default select the first class, but that class was disabled, so it updated it so now i pick from only enabled classes

@Gkrumbach07
Copy link
Member Author

/approve

Copy link
Contributor

openshift-ci bot commented Sep 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gkrumbach07, jpuzz0

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 b5351a7 into opendatahub-io:main Sep 17, 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.

4 participants