-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Actionable Observability] Refactor alert search bar #143840
[Actionable Observability] Refactor alert search bar #143840
Conversation
Pinging @elastic/actionable-observability (Team: Actionable Observability) |
const setAlertStatusFilter = useCallback( | ||
(id: string, query: string) => { | ||
setAlertFilterStatus(id as AlertStatusFilterButton); | ||
// Updating the KQL query bar alongside with user inputs is tricky. | ||
// To avoid issue, this function always remove the AlertFilter and add it | ||
// at the end of the query, each time the filter is added/updated/removed (Show All) | ||
// NOTE: This (query appending) will be changed entirely: https://github.com/elastic/kibana/issues/116135 | ||
let output; | ||
if (kuery === '') { | ||
output = query; | ||
} else { | ||
const queryWithoutAlertFilter = kuery.replace(ALERT_STATUS_REGEX, ''); | ||
output = `${queryWithoutAlertFilter} and ${query}`; | ||
} | ||
onQueryChange({ | ||
dateRange: { from: rangeFrom, to: rangeTo }, | ||
// Clean up the kuery from unwanted trailing/ahead ANDs after appending and removing filters. | ||
query: output.replace(/^\s*and\s*|\s*and\s*$/gm, ''), | ||
}); |
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.
👍🏻 so much cleaner
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.
Design 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, good job @maryam-saeidi!
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 👏
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Unknown metric groupsAPI count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Closes #142713
Summary
The following changes were applied to the search bar as a prerequisite to sharing this component via the triggers_action_ui plugin:
SearchBar
provided by unified search (as suggested in [RAC] [Observability] Integrate the alerts search bar with the filter, query and time manager #116135)How to test