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
Bug 1870331: Not allow to change size for OCS based resource #6683
Conversation
@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:
Comment In response to this:
Instructions 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. |
@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:
Comment In response to this:
Instructions 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. |
/bugzilla refresh |
@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:
Comment In response to this:
Instructions 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. |
/bugzilla refresh |
@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:
Comment In response to this:
Instructions 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. |
/bugzilla refresh |
@a2batic: This pull request references Bugzilla bug 1870331, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions 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. |
@a2batic: This pull request references Bugzilla bug 1870331, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions 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. |
const filterUnits = () => { | ||
let filteredDropdown = {}; | ||
_.each(dropdownUnits, () => { | ||
if (defaultSize[1] === 'Mi') { | ||
filteredDropdown = { Mi: dropdownUnits.Mi }; | ||
} | ||
if (defaultSize[1] === 'Gi' || defaultSize[1] === 'Mi') { | ||
filteredDropdown = { ...filteredDropdown, Gi: dropdownUnits.Gi }; | ||
} | ||
}); | ||
filteredDropdown = { ...filteredDropdown, Ti: dropdownUnits.Ti }; | ||
return filteredDropdown; | ||
}; |
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.
May be you would like to define this at one place instead of recreating the function twice.
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.
Do we need to iterate over dropdownUnits
when the check is on defaultSize[1]
?
May be I am missing something :)
<span className="help-block co-clone-pvc-modal__helpblock"> | ||
{!validSize ? 'Size should be equal or higher than default size' : <br />} | ||
</span> |
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.
<span className="help-block co-clone-pvc-modal__helpblock"> | |
{!validSize ? 'Size should be equal or higher than default size' : <br />} | |
</span> | |
{validSize && <span className="help-block co-clone-pvc-modal__helpblock"> | |
'Size should be equal or higher than default size' | |
</span>} |
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.
Did you consider using FormGroup properties for validation ?
helperText
and validated
<RequestSizeInput | ||
name="requestSize" | ||
testID="input-request-size" | ||
onChange={requestedSizeInputChange} | ||
defaultRequestSizeUnit={requestedUnit} | ||
defaultRequestSizeValue={requestedSize} | ||
dropdownUnits={dropdownUnits} | ||
isInputDisabled={isCephProvisioner(scResource?.provisioner)} |
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 should wait for scResource to load, otherwise on slower connections you may end up with Size input enabled for some time.
@@ -62,6 +77,9 @@ const ClonePVCModal = withHandlePromise((props: ClonePVCModalProps) => { | |||
const requestedSizeInputChange = ({ value, unit }) => { | |||
setRequestedSize(value); | |||
setRequestedUnit(unit); | |||
const sizeInBytes = convertToBaseValue(value + unit); | |||
const defaultInBytes = convertToBaseValue(getRequestedPVCSize(resource)); | |||
sizeInBytes < defaultInBytes ? setValidSize(false) : setValidSize(true); |
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.
sizeInBytes < defaultInBytes ? setValidSize(false) : setValidSize(true); | |
const isValid = sizeInBytes < defaultInBytes; | |
setValidSize(isValid); |
OR
sizeInBytes < defaultInBytes ? setValidSize(false) : setValidSize(true); | |
setValidSize(sizeInBytes < defaultInBytes); |
@@ -74,6 +76,9 @@ const RestorePVCModal = withHandlePromise<RestorePVCModalProps>( | |||
const requestedSizeInputChange = ({ value, unit }) => { | |||
setRequestedSize(value); | |||
setRequestedUnit(unit); | |||
const sizeInBytes = convertToBaseValue(value + unit); | |||
const defaultInBytes = convertToBaseValue(resource?.status?.restoreSize); | |||
sizeInBytes < defaultInBytes ? setValidSize(false) : setValidSize(true); |
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
isRequired | ||
fieldId="clone-pvc-modal__size" | ||
className="co-clone-pvc-modal__ocs-size" | ||
helperTextInvalid="Size should be equal or higher than default size" |
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.
helperTextInvalid="Size should be equal or higher than default size" | |
helperTextInvalid="Size should be equal or higher than the requested size of PVC " |
@@ -62,6 +77,9 @@ const ClonePVCModal = withHandlePromise((props: ClonePVCModalProps) => { | |||
const requestedSizeInputChange = ({ value, unit }) => { | |||
setRequestedSize(value); | |||
setRequestedUnit(unit); | |||
const sizeInBytes = convertToBaseValue(value + unit); |
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 sizeInBytes = convertToBaseValue(value + unit); | |
const cloneSizeInBytes = convertToBaseValue(value + unit); |
@@ -62,6 +77,9 @@ const ClonePVCModal = withHandlePromise((props: ClonePVCModalProps) => { | |||
const requestedSizeInputChange = ({ value, unit }) => { | |||
setRequestedSize(value); | |||
setRequestedUnit(unit); | |||
const sizeInBytes = convertToBaseValue(value + unit); | |||
const defaultInBytes = convertToBaseValue(getRequestedPVCSize(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.
const defaultInBytes = convertToBaseValue(getRequestedPVCSize(resource)); | |
const PVCSizeInBytes = convertToBaseValue(getRequestedPVCSize(resource)); |
@@ -74,6 +76,9 @@ const RestorePVCModal = withHandlePromise<RestorePVCModalProps>( | |||
const requestedSizeInputChange = ({ value, unit }) => { | |||
setRequestedSize(value); | |||
setRequestedUnit(unit); | |||
const sizeInBytes = convertToBaseValue(value + unit); |
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 sizeInBytes = convertToBaseValue(value + unit); | |
const RestoreSizeInBytes = convertToBaseValue(value + unit); |
@@ -74,6 +76,9 @@ const RestorePVCModal = withHandlePromise<RestorePVCModalProps>( | |||
const requestedSizeInputChange = ({ value, unit }) => { | |||
setRequestedSize(value); | |||
setRequestedUnit(unit); | |||
const sizeInBytes = convertToBaseValue(value + unit); | |||
const defaultInBytes = convertToBaseValue(resource?.status?.restoreSize); |
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 defaultInBytes = convertToBaseValue(resource?.status?.restoreSize); | |
const snapshotSizeInBytes = convertToBaseValue(resource?.status?.restoreSize); |
@a2batic: This pull request references Bugzilla bug 1870331, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions 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. |
/approve /assign @cloudbehl |
required | ||
/> | ||
) : ( | ||
<div className="skeleton-text" /> |
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 if you have error ? It will be always showing loading state ?
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.
Good point, its better to disable size input in that case.
required | ||
/> | ||
) : ( | ||
<div className="skeleton-text" /> |
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
/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.
nit:
isRequired | ||
fieldId="clone-pvc-modal__size" | ||
className="co-clone-pvc-modal__ocs-size" | ||
helperTextInvalid="Size should be equal or higher than the requested size of PVC" |
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.
helperTextInvalid="Size should be equal or higher than the requested size of PVC" | |
helperTextInvalid="Size should be equal or greater than the requested size of PVC" |
@@ -165,16 +170,26 @@ const RestorePVCModal = withHandlePromise<RestorePVCModalProps>( | |||
label="Size" | |||
isRequired | |||
fieldId="pvc-size" | |||
className="co-restore-pvc-modal__input" | |||
className="co-restore-pvc-modal__input co-restore-pvc-modal__ocs-size" | |||
helperTextInvalid="Size should be equal or higher than the restore size of snapshot" |
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.
helperTextInvalid="Size should be equal or higher than the restore size of snapshot" | |
helperTextInvalid="Size should be equal or greater than the restore size of snapshot" |
Signed-off-by: Kanika Murarka <kmurarka@redhat.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a2batic, afreen23, cloudbehl, rawagner 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 |
@a2batic: The following test failed, say
Full PR test history. Your PR dashboard. Instructions 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. I understand the commands that are listed here. |
/test e2e-gcp-console |
@a2batic: All pull requests linked via external trackers have merged: Bugzilla bug 1870331 has been moved to the MODIFIED state. In response to this:
Instructions 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. |
Signed-off-by: Kanika Murarka kmurarka@redhat.com