-
Notifications
You must be signed in to change notification settings - Fork 667
Adds Local Volume Set Creation Form and enables LSO Plugin #5014
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
Adds Local Volume Set Creation Form and enables LSO Plugin #5014
Conversation
|
@afreen23 Can you please attach the screenshots too |
019839b to
50115c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to keep the plain objects for future fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const CreateLocalVolumeSet: React.FC = withHandlePromise((props: CreateLocalVolumeSetProps) => { | |
| const CreateLocalVolumeSet: React.FC = withHandlePromise<CreateLocalVolumeSetProps>((props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pointless if you're already showing the error in the ActionBar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I think just catch(() -> null) here would be suffice for linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not a required field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as per uxd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are radio groups. Only one of them will be selected at a time.
The value is not significant here.
showNodesList state takes care of toggling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const nodeTaints = node?.spec?.taints?.length ?? 0; | |
| const nodeTaints = node.spec?.taints?.length ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| componentProps: { data: NodeKind[]; filters: { name: string } }; | |
| componentProps: { data: NodeKind[]; filters: { name: string, labels: { all: string[] } } }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K8sResourceCommon might handle a few of these fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add sorts for all these fields as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It as per UXD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuvalgalanti why are we only allowing users to sort on the basis of Name? IMO we should sort on CPU and Memory too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| selected: !!rows?.[uid]?.selected, | |
| selected: rows?.[uid]?.selected, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are radio groups. Only one of them will be selected at a time.
The value is not significant here.
showNodesList state takes care of toggling
39c2e2f to
f8bd0d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .catch(() => null); |
No need for the catch statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is enforced by linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not. handlePromise handles the catch part for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely handlePromise sets state and error message on catching error but it also returns a promise. Linters are dumb they dont know that, hence I need to put a dummy catch.
This will not break anything in our case because we have error handled in state.
| handlePromise: <T>(promise: Promise<T>) => Promise<T>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| kind="Node" | |
| kind={NodeKind.kind} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button's really don't need data-test-id since we have a common class for Primary used throughout the console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added as per your suggestion on chat, will remove again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| filters: { name: string }; |
You are not using it here. The type is incomplete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| deviceTypes: ('RawDisk' | 'Partition')[]; | |
| deviceTypes: ('RawDisk' | 'Partition')[]; |
Please use enum instead of String Literals it's easier to use and understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this magic string RawDisk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hard coded intentionally. The support is for RawDisk only.
Hence, the request data just needs that. No other values are applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer it if it came via an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using enums for these values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SSD: { | |
| title: 'SSD / NVMe', | |
| property: 'Non Rotational', | |
| }, | |
| HDD: { | |
| title: 'HDD', | |
| property: 'Rotational', | |
| }, | |
| }; | |
| const VOLUME_MODE = { | |
| Block: { | |
| title: 'Block', | |
| }, | |
| Filesystem: { | |
| title: 'Filesystem', | |
| }, | |
| }; | |
| enum VolumeType { | |
| SSD = 'SSD', | |
| HDD = 'HDD' | |
| } | |
| [VolumeType.SSD]: { | |
| title: 'SSD / NVMe', | |
| property: 'Non Rotational', | |
| }, | |
| [VolumeType.HDD]: { | |
| title: 'HDD', | |
| property: 'Rotational', | |
| }, | |
| }; | |
| enum VolumeMode { | |
| BLOCK = 'Block', | |
| FS = 'FileSystem' | |
| }; | |
| const VOLUME_MODE = { | |
| [VolumeMode.Block]: { | |
| title: 'Block', | |
| }, | |
| [VolumeMode.FS]: { | |
| title: 'Filesystem', | |
| }, | |
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely, I can consider but a bit different .
Thanks!
f8bd0d2 to
da9f1ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| handlePromise(k8sCreate(LocalVolumeSetModel, requestData)) | |
| .then((resource) => history.push(resourceObjPath(resource, referenceFor(resource)))) | |
| .catch(() => null); | |
| return handlePromise(k8sCreate(LocalVolumeSetModel, requestData)) | |
| .then((resource) => history.push(resourceObjPath(resource, referenceFor(resource)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just disable the rule that enforces you to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const [allSelected, setAllSelected] = React.useState(null); | |
| const [allSelected, setAllSelected] = React.useState<boolean>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use OnSelect already defined in @patternfly/react-table
| onSelect?: ( | |
| onSelect?: OnSelect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure , I forgot to replace it here.
Thanks!
|
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put a data-test-id on the toggler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would show some errors in the console. onChange send two params whereas setStorageClass only accepts one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure 👍
- Local Volume Set is the new CR to be introduced in Local Stoarge Operator. - Local Volume Set will allow to filter a set of storage volumes, group them and create a dedicated storage class to consume storage for them.
da9f1ae to
0c2991b
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afreen23, bipuladh, rawagner The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Designs: https://marvelapp.com/8752a03/screen/67632184