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

[RHOAIENG-1101] Cannot remove additional storage from the workbench configuration #3320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpuzz0
Copy link
Contributor

@jpuzz0 jpuzz0 commented Oct 10, 2024

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

Description

Workbench create/edit now has a table view to allow for multiple PVC instances to be created, where currently only 1 row is creatable/editable. The buttons above the table are not actionable yet and are placeholders for now. Some logic has been updated as a part of the submission process to attach multiple volumes (from PVC creations) for the notebook when available.

Default table data on creation
image

Detach modal
image

Empty state when all are detached
image

Edit modal on creation

NOTE: this edit modal is a starting point and meant to be expanded upon with a separate jira; https://issues.redhat.com/browse/RHOAIENG-7681

image

(cc @xianli123)

How Has This Been Tested?

When creating a workbench, verify the set of fields that were previously visible are now replaced with the editable table view. The Edit modal itself is a part of a different story, but one was made here as a starting point, where mainly the mount path and some show/hide of alerts will change (along with some implementation).

Test Impact

Updated mocked cypress tests to simply verify table data for now as a part of creating/editing a workbench. Since this feature has other parts, e2e mock testing will be dependent on their completion.

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress This PR is in WIP state label Oct 10, 2024
Copy link
Contributor

openshift-ci bot commented Oct 10, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign manosnoam for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@jpuzz0 jpuzz0 force-pushed the RHOAIENG-1101 branch 4 times, most recently from 8e91e1d to 86f0874 Compare October 11, 2024 17:40
@jpuzz0 jpuzz0 changed the title WIP [RHOAIENG-1101] Cannot remove additional storage from the workbench configuration [RHOAIENG-1101] Cannot remove additional storage from the workbench configuration Oct 11, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress This PR is in WIP state label Oct 11, 2024
@jpuzz0 jpuzz0 force-pushed the RHOAIENG-1101 branch 4 times, most recently from deb1bc6 to 37e41c9 Compare October 11, 2024 19:06
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 60.36036% with 44 lines in your changes missing coverage. Please review.

Project coverage is 84.63%. Comparing base (6ec1b1b) to head (a1db6ec).

Files with missing lines Patch % Lines
...creens/spawner/storage/ClusterStorageEditModal.tsx 5.26% 18 Missing ⚠️
...ts/screens/spawner/storage/ClusterStorageTable.tsx 65.30% 17 Missing ⚠️
...eens/spawner/storage/ClusterStorageDetachModal.tsx 16.66% 5 Missing ⚠️
...c/pages/projects/screens/spawner/SpawnerFooter.tsx 76.47% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3320      +/-   ##
==========================================
- Coverage   84.79%   84.63%   -0.16%     
==========================================
  Files        1315     1318       +3     
  Lines       29491    29555      +64     
  Branches     8056     8070      +14     
==========================================
+ Hits        25006    25015       +9     
- Misses       4485     4540      +55     
Files with missing lines Coverage Δ
...src/pages/projects/screens/spawner/SpawnerPage.tsx 98.24% <100.00%> (+0.16%) ⬆️
...src/pages/projects/screens/spawner/spawnerUtils.ts 78.80% <100.00%> (-2.51%) ⬇️
...cts/screens/spawner/storage/StorageClassSelect.tsx 90.90% <100.00%> (-2.28%) ⬇️
...ages/projects/screens/spawner/storage/constants.ts 100.00% <100.00%> (ø)
...rc/pages/projects/screens/spawner/storage/utils.ts 96.00% <100.00%> (-0.43%) ⬇️
frontend/src/pages/projects/types.ts 100.00% <ø> (ø)
...c/pages/projects/screens/spawner/SpawnerFooter.tsx 83.46% <76.47%> (-1.23%) ⬇️
...eens/spawner/storage/ClusterStorageDetachModal.tsx 16.66% <16.66%> (ø)
...ts/screens/spawner/storage/ClusterStorageTable.tsx 65.30% <65.30%> (ø)
...creens/spawner/storage/ClusterStorageEditModal.tsx 5.26% <5.26%> (ø)

... and 6 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 6ec1b1b...a1db6ec. Read the comment docs.

@xianli123
Copy link

Thanks @jpuzz0 ! Overall LGTM!
As a tip (it may be outside the scope of https://issues.redhat.com/browse/RHOAIENG-1101), when creating a workbench or storage, the storage size should display "Max XXGi" instead of "XXGi."

@jpuzz0 jpuzz0 force-pushed the RHOAIENG-1101 branch 2 times, most recently from 7ca7481 to 9d1c493 Compare October 14, 2024 14:16
@jpuzz0
Copy link
Contributor Author

jpuzz0 commented Oct 14, 2024

Thanks @jpuzz0 ! Overall LGTM! As a tip (it may be outside the scope of https://issues.redhat.com/browse/RHOAIENG-1101), when creating a workbench or storage, the storage size should display "Max XXGi" instead of "XXGi."

@xianli123 I've made this change. Thanks for calling it out!

@xianli123
Copy link

Thanks @jpuzz0 . Once it's changed, it will look good!

Comment on lines +83 to +97
{
storageType: existingNotebook ? StorageType.EXISTING_PVC : StorageType.NEW_PVC,
creating: {
nameDesc: {
name: k8sNameDescriptionData.data.name || defaultClusterStorage.name,
description: defaultClusterStorage.description,
},
size: defaultClusterStorage.size || defaultNotebookSize,
storageClassName: defaultStorageClassName || defaultClusterStorage.storageClassName,
mountPath: defaultClusterStorage.mountPath,
},
existing: {
storage: getRootVolumeName(existingNotebook),
},
},
Copy link
Member

Choose a reason for hiding this comment

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

so this exisitng data should include all attached PVCs. create some hook that is basically the inverse of useRelatedNotebooks called useRelatedPVCs

Copy link
Member

Choose a reason for hiding this comment

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

this may also have to be restructured then because existing would need to be able to update the mount path

my suggestions is something along the lines of

{
  storageType: existingNotebook ? StorageType.EXISTING_PVC : StorageType.NEW_PVC,
  name: getRootVolumeName(existingNotebook),
  nameDesc: {
     name: existingName || k8sNameDescriptionData.data.name || defaultClusterStorage.name,
     description: existingDescription || defaultClusterStorage.description,
  },
  size: existingSize || defaultClusterStorage.size || defaultNotebookSize,
  storageClassName: existingStorageClassName || defaultStorageClassName || defaultClusterStorage.storageClassName,
  mountPath: existingMountPath || defaultClusterStorage.mountPath,
}

const newStorageFieldInvalid = storageType === StorageType.NEW_PVC && !creating.nameDesc.name;
const existingStorageFieldInvalid = storageType === StorageType.EXISTING_PVC && !existing.storage;
const isStorageDataValid = !newStorageFieldInvalid && !existingStorageFieldInvalid;
const isStorageDataValid = storageData.length > 0;
Copy link
Member

Choose a reason for hiding this comment

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

storage data is not required so this is not needed

@@ -0,0 +1,131 @@
import React from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

this file is just the placeholder until dipanshu merges right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think he can use it and expand upon it though.

Comment on lines +83 to +97
{
storageType: existingNotebook ? StorageType.EXISTING_PVC : StorageType.NEW_PVC,
creating: {
nameDesc: {
name: k8sNameDescriptionData.data.name || defaultClusterStorage.name,
description: defaultClusterStorage.description,
},
size: defaultClusterStorage.size || defaultNotebookSize,
storageClassName: defaultStorageClassName || defaultClusterStorage.storageClassName,
mountPath: defaultClusterStorage.mountPath,
},
existing: {
storage: getRootVolumeName(existingNotebook),
},
},
Copy link
Member

Choose a reason for hiding this comment

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

this may also have to be restructured then because existing would need to be able to update the mount path

my suggestions is something along the lines of

{
  storageType: existingNotebook ? StorageType.EXISTING_PVC : StorageType.NEW_PVC,
  name: getRootVolumeName(existingNotebook),
  nameDesc: {
     name: existingName || k8sNameDescriptionData.data.name || defaultClusterStorage.name,
     description: existingDescription || defaultClusterStorage.description,
  },
  size: existingSize || defaultClusterStorage.size || defaultNotebookSize,
  storageClassName: existingStorageClassName || defaultStorageClassName || defaultClusterStorage.storageClassName,
  mountPath: existingMountPath || defaultClusterStorage.mountPath,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants