-
Notifications
You must be signed in to change notification settings - Fork 670
Show only the allowed storage interfaces on Disk-modal #3973
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
Conversation
- unify and enhance template selections for validation and create requests - use GiB instead of GB for memory to allign with validations - show validation intervals
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: irosenzw The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c389565 to
1015dc9
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.
shouldn't it be fromJS(payload.value), ?
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.
No, because the payload isn't an immutable object but a TemplateValidations[] object.
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.
not needing const state = getState(); in this function is strange ...
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.
+1
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 do not think it is needed to store validations in the redux.
There are problems with this approach:
- redux should not store duplicate data
- this function is missing all the dependencies for this to work correctly
- this might be another place for performance issues in the future
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.
@suomiy , I don't understand this comment at all. Can you elaborate ?
why the validations consider duplicate data ?
what are the dependencies I missed?
what performance issues you are referring to? can you give an example ?
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.
@suomiy, how do you suggest to get the validations to the disk-modal without using Redux store ?
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.
@suomiy , I don't understand this comment at all. Can you elaborate ?
why the validations considerduplicate data?
because they are already stored in the template
what are the dependencies I missed?
what performance issues you are referring to? can you give an example ?
usertemplate and templates and that is why it could be a performance issue (we could still use it if we decide to, but it is better to be careful)
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.
@suomiy, how do you suggest to get the validations to the disk-modal without using Redux store ?
from the templates
Fixes: CNV-2914 - Enforce the validations from common and user templates so the user can choose only from the allowed values in the Disk-modal at the storage tab. - Add the validations to the store. - Implement enum validation methods. Depends on: openshift#3909 Signed-off-by: Ido Rosenzwig irosenzw@redhat.com
1015dc9 to
1b7ce12
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 do not think it is needed to store validations in the redux.
There are problems with this approach:
- redux should not store duplicate data
- this function is missing all the dependencies for this to work correctly
- this might be another place for performance issues in the future
| ); | ||
| case InternalActionType.SetTemplateValidations: | ||
| return state.setIn( | ||
| [dialogID, 'commonData', 'dataIDReferences', 'templateValidations'], |
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.
just a note: dataIDReferences is for storing references of already present data in the redux store only. Not the original data.
| if (templates.size > 0 && os && workload) { | ||
| // templates are sorted by relevance if only flavor is missing | ||
| return getValidationsFromTemplates([templates.first()]); | ||
| return getValidationsFromTemplates(templates.toArray()); |
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 don't see a reason why this is necessary. Please update to the newest version
| }, | ||
| ]; | ||
|
|
||
| const getAllowedBusses = (): Set<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.
should not be needed, there should be just one templateValidation at this point.
| const vmLikeFinal = getLoadedData(vmLikeEntityLoading, vmLikeEntity); // default old snapshot before loading a new one | ||
| const vm = asVM(vmLikeFinal); | ||
|
|
||
| const allowedBusses = getOperatingSystem(vmLikeEntity).startsWith('win') |
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 think we should rather allow all buses in the VM detail disk modal, than to hardcode some
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 for the modal in the Disk details page.
If a user uses a windows OS it shouldn't have the option to pick scsi bus - just virtio or sata
| {DiskBus.getAll().map((b) => ( | ||
| <FormSelectOption key={b.getValue()} value={b.getValue()} label={b.toString()} /> | ||
| ))} | ||
| {!allowedBusses || allowedBusses.size === 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.
this does not make semantically sense. either we say
- allowedBusses will default to all when null
- or they will reflect the real meaning at all times - actual allowed busses
| )) | ||
| : DiskBus.getAll().map( | ||
| (b) => | ||
| Array.from(allowedBusses).includes(b.getValue()) && ( |
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.
set has especially method has for this task, so there is no need for array creation
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.
also there should not be code duplication for FormSelectOption creation
| // Empty array means all values are allowed | ||
|
|
||
| // Get all the validations which has the 'values' key and aren't optional | ||
| const relevantValidations = this.getRelevantValidations(jsonPath).filter( |
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.
latest change moves the filter to getRelevantValidations
| return { min, max, isMinInclusive, isMaxInclusive, isValid }; | ||
| }; | ||
|
|
||
| getAllowedBusses = (): Set<string> => this.getAllowedEnumValues(ValidationJSONPath.BUS); |
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.
does not take into account the name of the rule - e.g. windows-virtio-bus, windows-disk-bus which has a meaning with consequences
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 don't understand what you wanted to say in this comment
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.
ok, let's not do that and just enforce the rules
|
@irosenzw: PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Fixes: CNV-2914
so the user can choose only from the allowed values in the Disk-modal
at the storage tab.
Depends on: #3909
Signed-off-by: Ido Rosenzwig irosenzw@redhat.com