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 1823253: Fix Textfilter issue in Filter Toolbar #5022
Bug 1823253: Fix Textfilter issue in Filter Toolbar #5022
Conversation
@bipuladh: This pull request references Bugzilla bug 1823253, 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. |
/kind bug |
@bipuladh Just tested this and I am still getting runtime errors if I pass a filter parameter in the url: http://localhost:9000/k8s/cluster/config.openshift.io~v1~OperatorHub/cluster/sources?name=test Or if I try and filter on labels |
4a436d7
to
ccdc1fc
Compare
@TheRealJon Updated the PR. However, the fix was not straightforward since the structure of the payload used in catalog-source( |
2f76489
to
e0a1d0d
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 think an easier solution for the name filter problem would be to just change the default name filter in public/components/factory/table-filters.ts
to something like this:
name: (filter, obj) => fuzzyCaseInsensitive(filter, obj?.metadata?.name ?? obj?.name),
There are a few other custom name filters defined in table filters because of a similar issue where the name property isn't in metadata. Maybe we can add a TODO or FIXME comment to those to say that the default name filter will work for these resources after this update.
frontend/packages/operator-lifecycle-manager/src/components/catalog-source.tsx
Outdated
Show resolved
Hide resolved
This suggestion would allow us to remove the usage of |
Yeah, I don't think that this suggestion would be a catch-all fix, but I think it would be good to have it handle the two most common scenarios (obj.name and obj.metadata.name). That might make it possible to remove at least 3 custom table filters. (catalog-source-name, alert-rule-name, and silence-name) |
86b9fce
to
8c16e68
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.
Just want to update the getLabelsAsString function to take labels instead of the whole obj.
8c16e68
to
205626a
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.
/approve
/lgtm |
/assign @spadgett |
/hold |
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 seems like the wrong approach to me. We shouldn't have magical fallbacks when the resource is not a k8s resource. We should instead provide a way to pass custom functions to the list page for getting the name or label when the resource doesn't have a metadata
stanza.
We might just disable the name/label filters on this page. You should never have that many catalog sources. I'm not sure they're really helpful.
Sorry I realize you're getting different feedback on the PR, but I disagree a bit with @TheRealJon here. If it's not a k8s resource, I'd rather be explicit and fix it generally so we can handle any resource shape. But again we might just remove the filters from this page as the easy fix. |
Another approach would be to pass through the path to the labels or name as a prop with defaults like we do for |
@spadgett
We chose 3 since |
We could disable the label filter. But |
Sorry, I'm strongly against (1) and (3). The right way to fix this is to either make the filter function customizable or to pass the fields paths through as optional properties. |
Put another way, the filter toolbar should have no knowledge of the special object created by the catalog source list. This creates tight coupling between these components. Filter toolbar should only know about k8s objects. |
@spadgett @bipuladh I would rather see the customizable filter function than passing an extra path argument, but I'll defer to @spadgett here. The original changes just didn't seem quite right to me, so I was trying to work through some alternative approaches. But I see your point about tight coupling between the filter toolbar and list page item data structure. |
205626a
to
c94ae5f
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.
As long as @spadgett is good with removing the label filter on this page, that's fine with me.
/lgtm
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bipuladh, spadgett, TheRealJon 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 |
/hold cancel |
@bipuladh: All pull requests linked via external trackers have merged: openshift/console#5022. Bugzilla bug 1823253 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. |
textFilter
was not passed toapplyFilter
.