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 1801584: Fixed Inconsistency in kebab and actions menu for storage cluster #4352
Conversation
gnehapk
commented
Feb 18, 2020
@gnehapk: This pull request references Bugzilla bug 1801584, 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. |
@spadgett Please review. |
/test e2e-gcp-console |
/bugzilla refresh |
@gnehapk: This pull request references Bugzilla bug 1801584, 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 |
@gnehapk: This pull request references Bugzilla bug 1801584, 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. 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. |
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.
Can you give more detail about what was happening previously to cause the bug? It's hard to suggest a good solution since the function doesn't have types.
@@ -64,12 +64,19 @@ const csvName = () => | |||
); | |||
|
|||
const getActions = (selectedObj: any) => { | |||
let group = ''; | |||
|
|||
if (selectedObj.apiVersion.includes('/')) { |
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.
We shouldn't be doing any parsing of the apiVersion
string here. All of that logic is already handled elsewhere.
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.
As the checks have been added here only, hence I have also used the method 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.
You should rename the parameter and the type. It's no longer a k8s object. I'd suggest model: K8sKind
Why does the kind object not have an api version property? It should.
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.
Oh, are we somethings passing a k8s object and sometimes a model? That's not a good pattern. We should always pass the same type to this function and not attempt to do any detection.
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 see for having the CSV action enabled, we need to match kind and apigroup (apigroup because of this).
The getActions(selectedObj)
is called twice: for Kebab actions and menu actions.
For Kebab Actions what we are passing is a k8sResource but for menuActions a string
When rather passing K8sKind object (instead of model ref string) to getActions
call, it can show CSV actions, only if we drill down the right apiversion
to this format "group/version".
One approach i can think of:
groupVersionFor(apiVersionForModel(selectedObj)).group === action.properties.apiGroup
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.
We should always pass the model to this method. We shouldn't sometimes pass the model and sometimes pass an instance. We have the model in both contexts already.
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.
@spadgett thanks for the inputs, any pointers on the models for kebabactions ? The OperandTableRowProps
seems to provide only a k8sresource.
Or one more thing we can do if you consider:
Just passing kind and apigroup in the getActions
function only.
const getActions = ({kind, apiGroup}) => {
....
Thanks!
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 the simplest thing to do is to change getActions
to take a referene
const getActions = (reference: K8sResourceKindReference) => {
and pass it
<ResourceKebab actions={getActions(referenceFor(obj)} kind={referenceFor(obj)} resource={obj} />
and
menuActions={getActions(props.modelRef)}
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.
Indeed 👍
if (selectedObj.apiVersion.includes('/')) { | ||
group = groupVersionFor(selectedObj.apiVersion).group; | ||
} else { | ||
group = selectedObj.apiGroup; |
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 selectedObj
? k8s resources don't have this 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.
I have passed the kindObj<k8sKind>
from here which does not have apiVersion
as a property but have apiGroup
in order to get the group.
@@ -64,12 +64,19 @@ const csvName = () => | |||
); | |||
|
|||
const getActions = (selectedObj: any) => { |
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 new, but we should have a type other than any
here. It's hard to recommend a fix since it's unclear what kind of obj this is.
@spadgett All the actions that are present inside the kebab menu for are not there in the storage cluster details view(by clicking the storage cluster name's link from above) These changes target this bug. Hope this explains. |
@gnehapk: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
/assign @spadgett |
…e cluster instance`
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gnehapk, spadgett 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 |
@gnehapk: All pull requests linked via external trackers have merged. Bugzilla bug 1801584 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. |