-
Notifications
You must be signed in to change notification settings - Fork 0
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
Do not show the Add to Filters action button if the filter exists #285
Conversation
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 one comment which greatly impacts the feature, so can't approve yet. The approach makes sense though!
We might have to make the logic to check if the filter exists a bit smarter, for example if the existing filter operator is =
or =~
say filter exists, otherwise check if key and value match.
@@ -61,3 +66,8 @@ export const addToFilters = (variable: AdHocFiltersVariable, label: string, valu | |||
], | |||
}); | |||
}; | |||
|
|||
export const filterExistsForKey = (model: AdHocFiltersVariable, key: string) => { |
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're only checking if the label/key matches, which means that we can't build queries like { foo != "abc" && foo != "xyz" }
. We don't have include/exclude buttons for now but we might add them soon and the ability to exclude multiple values for the same attribute may be useful.
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, update to follow
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.
@ifrost I cleaned this up a bit in my exemplars PR which will only wrap it in quotes when absolutely needed. The reason is that Tempo is aware of the type of the values, so the value |
Fixes #123