Skip to content

Conversation

@afreen23
Copy link

@afreen23 afreen23 commented Apr 16, 2020

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Apr 16, 2020
@openshift-ci-robot
Copy link
Contributor

@afreen23: This pull request references Bugzilla bug 1811003, 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.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)
Details

In response to this:

Bug 1811003: Make storage class dropdown required

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 the component/ceph Related to ceph-storage-plugin label Apr 16, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 16, 2020
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need catch block here. handlePromise does handle that.

Copy link
Author

@afreen23 afreen23 Apr 16, 2020

Choose a reason for hiding this comment

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

Because handlePromise returns a promise and it needs to be either returned or caught.
I removed return as you can compare so I need to put catch.

Copy link
Contributor

@bipuladh bipuladh Apr 16, 2020

Choose a reason for hiding this comment

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

It does not have to be. (remove the return). We can let it be

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a new style I am introducing in the console. There is a precedent for it.

Copy link
Author

@afreen23 afreen23 Apr 16, 2020

Choose a reason for hiding this comment

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

When the error happens , the browser logs following error, as the returned error is not caught anywhere
Thats why I changed and just added catch. return can be omitted.
Screenshot from 2020-04-16 19-25-43

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
throw new Error('No storage class is selected');
throw new Error('No storageclass selected');

Copy link
Contributor

Choose a reason for hiding this comment

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

I found this better.

@afreen23 afreen23 force-pushed the make-sc-dropdown-required branch from 5df89b0 to 1b2122a Compare April 16, 2020 10:36
@cloudbehl
Copy link
Contributor

@afreen23 we need it for the add capacity flow as well.

@afreen23 afreen23 force-pushed the make-sc-dropdown-required branch 2 times, most recently from e99ab89 to d906718 Compare April 16, 2020 13:49
@openshift-ci-robot
Copy link
Contributor

@afreen23: This pull request references Bugzilla bug 1811003, which is valid.

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

In response to this:

Bug 1811003: Make storage class dropdown required

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 -83 to -84
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is still required if something else fails.

Copy link
Author

Choose a reason for hiding this comment

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

This is all handled by withHandlePromise HOC.

Copy link
Author

Choose a reason for hiding this comment

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

You are right, I got confused with other component.
Added back.

Comment on lines 84 to 92
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
handlePromise(makeOCSRequest(selectedNodes, storageClass, osdSize))
.then(() => {
history.push(
`/k8s/ns/${ns}/clusterserviceversions/${appName}/${referenceForModel(
OCSServiceModel,
)}/${getName(ocsRequestData)}`,
);
})
.catch(() => null);
// eslint-disable-next-line promise/catch-or-return
handlePromise(makeOCSRequest(selectedNodes, storageClass, osdSize))
.then(() => {
history.push(
`/k8s/ns/${ns}/clusterserviceversions/${appName}/${referenceForModel(
OCSServiceModel,
)}/${getName(ocsRequestData)}`,
);
});

Comment on lines 76 to 92
Copy link
Contributor

Choose a reason for hiding this comment

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

This code looks wrong to me. handlePromise does not expose setError or setProgress to the user. There is a bigger issue here.
/hold

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's where the bug is. So handlePromise will return props.errorMessage and props.isLoading. These values are different from the state values declared in the line you pointed me to. Hence the handling done by handlePromise is not used here.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are not manually setting the progress like the code that you just deleted. Hence loading state and error will not be correctly reflected for ALL cases. Technically the deleted code is incorrect as it does not use handlePromise in the correct manner, but mixing the right way and the wrong way causes issues.

Copy link
Author

Choose a reason for hiding this comment

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

Okay then @cloudbehl point makes sense, sorry I missed that in haste.
https://github.com/openshift/console/pull/5071/files#r409588659

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 16, 2020
@afreen23 afreen23 force-pushed the make-sc-dropdown-required branch from d906718 to 87b6c02 Compare April 16, 2020 20:29
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
.handlePromise(k8sPatch(OCSServiceModel, ocsConfig, [patch]))
.k8sPatch(OCSServiceModel, ocsConfig, [patch]))

No need to use handlePromise since the props provided by it is not used anywhere in the code.

@afreen23 afreen23 force-pushed the make-sc-dropdown-required branch from 87b6c02 to b13121a Compare April 16, 2020 21:10
@afreen23
Copy link
Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 16, 2020
@bipuladh
Copy link
Contributor

/lgtm
Looks great!

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afreen23, bipuladh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@bipuladh
Copy link
Contributor

/retest

@openshift-merge-robot openshift-merge-robot merged commit 5f713fd into openshift:master Apr 17, 2020
@openshift-ci-robot
Copy link
Contributor

@afreen23: All pull requests linked via external trackers have merged: openshift/console#5071. Bugzilla bug 1811003 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1811003: Make storage class dropdown required

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.5 milestone Apr 20, 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/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/ceph Related to ceph-storage-plugin lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants