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

Bug 1870331: Not allow to change size for OCS based resource #6683

Merged
merged 1 commit into from Sep 24, 2020

Conversation

a2batic
Copy link
Contributor

@a2batic a2batic commented Sep 18, 2020

  • Not allow the user to enter smaller size to create a resource
    Screenshot from 2020-09-24 15-01-54
    Screenshot from 2020-09-24 15-02-15
    Screenshot from 2020-09-24 15-02-24

Signed-off-by: Kanika Murarka kmurarka@redhat.com

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. label Sep 18, 2020
@openshift-ci-robot
Copy link
Contributor

@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1870331: Not allow to change size for OCS based resource

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.

@openshift-ci-robot openshift-ci-robot added bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. component/core Related to console core functionality labels Sep 18, 2020
@openshift-ci-robot
Copy link
Contributor

@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1870331: Not allow to change size for OCS based resource

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
Copy link
Contributor Author

a2batic commented Sep 18, 2020

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

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
Copy link
Contributor Author

a2batic commented Sep 18, 2020

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@a2batic: This pull request references Bugzilla bug 1870331, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "OCS 4.6.0" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

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
Copy link
Contributor Author

a2batic commented Sep 18, 2020

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@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
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Sep 18, 2020
@openshift-ci-robot
Copy link
Contributor

@a2batic: This pull request references Bugzilla bug 1870331, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1870331: Not allow to change size for OCS based resource

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.

Comment on lines 125 to 137
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;
};
Copy link
Contributor

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.

Copy link
Contributor

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 :)

Comment on lines 168 to 170
<span className="help-block co-clone-pvc-modal__helpblock">
{!validSize ? 'Size should be equal or higher than default size' : <br />}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<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>}

Copy link
Contributor

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

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 20, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2020
<RequestSizeInput
name="requestSize"
testID="input-request-size"
onChange={requestedSizeInputChange}
defaultRequestSizeUnit={requestedUnit}
defaultRequestSizeValue={requestedSize}
dropdownUnits={dropdownUnits}
isInputDisabled={isCephProvisioner(scResource?.provisioner)}
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sizeInBytes < defaultInBytes ? setValidSize(false) : setValidSize(true);
const isValid = sizeInBytes < defaultInBytes;
setValidSize(isValid);

OR

Suggested change
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);
Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const defaultInBytes = convertToBaseValue(resource?.status?.restoreSize);
const snapshotSizeInBytes = convertToBaseValue(resource?.status?.restoreSize);

@openshift-ci-robot
Copy link
Contributor

@a2batic: This pull request references Bugzilla bug 1870331, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1870331: Not allow to change size for OCS based resource

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.

@rawagner
Copy link
Contributor

/approve

/assign @cloudbehl

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 24, 2020
required
/>
) : (
<div className="skeleton-text" />
Copy link
Contributor

@afreen23 afreen23 Sep 24, 2020

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 ?

Copy link
Contributor Author

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" />
Copy link
Contributor

@afreen23 afreen23 Sep 24, 2020

Choose a reason for hiding this comment

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

same as above

@afreen23
Copy link
Contributor

/approve

Copy link
Contributor

@cloudbehl cloudbehl left a 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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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>
@cloudbehl
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

@a2batic: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp-console 225f043 link /test e2e-gcp-console

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.

@a2batic
Copy link
Contributor Author

a2batic commented Sep 24, 2020

/test e2e-gcp-console

@openshift-merge-robot openshift-merge-robot merged commit 2db0996 into openshift:master Sep 24, 2020
@openshift-ci-robot
Copy link
Contributor

@a2batic: All pull requests linked via external trackers have merged:

Bugzilla bug 1870331 has been moved to the MODIFIED state.

In response to this:

Bug 1870331: Not allow to change size for OCS based resource

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.

@spadgett spadgett added this to the v4.6 milestone Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants