-
Notifications
You must be signed in to change notification settings - Fork 8k
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] Fix alerts' blank page in case of invalid query string #145067
[Actionable Observability] Fix alerts' blank page in case of invalid query string #145067
Conversation
…rage key in consumer
appName: string; | ||
setEsQuery: (query: { bool: BoolQuery }) => void; | ||
queries?: Query[]; | ||
} | ||
|
||
export interface AlertSearchBarWithUrlSyncProps extends CommonAlertSearchBarProps { | ||
urlStorageKey: 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.
💬 Allowing consumers to set the storage key.
import { AlertStatus } from '../../../../common/typings'; | ||
|
||
const getAlertStatusQuery = (status: string): Query[] => { | ||
return status ? [{ query: ALERT_STATUS_QUERY[status], language: 'kuery' }] : []; | ||
}; | ||
|
||
export function AlertSearchBar({ |
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.
💬 Renamed it to make it easier to find the usage of this component.
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/actionable-observability (Team: Actionable Observability) |
I used a similar pattern as Kerry used here. The error message is coming from In some other cases, the message is a bit more clear, like this one: I am not aware of any other alternative. I tried to at least have a good title for this error :D |
@@ -9,3 +9,4 @@ export const ALERTS_PAGE_ID = 'alerts-o11y'; | |||
export const ALERTS_SEARCH_BAR_ID = 'alerts-search-bar-o11y'; | |||
export const ALERTS_PER_PAGE = 50; | |||
export const ALERTS_TABLE_ID = 'xpack.observability.alerts.alert.table'; | |||
export const URL_STORAGE_KEY = '_a'; |
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.
Is there a reason to keep URL_STORAGE_KEY
as _a
here and searchBarParams
in rule_details/constants.ts
? The namings do not match.
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 wanted to use a more meaningful name for this storage rather than _a
, so I changed it on the rule details page.
But on the alerts page, I didn't change it since I wasn't sure if changing the URL structure will break anything. We can discuss this use-case within our team and I can update it in the next PR if that makes sense.
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.
Sounds good! 👍
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. Tested locally, works well.
Left a question above.
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.
Looks good!!
Closes #143641 ## Summary As a follow-up to this PR #145067, in this PR I've added tests to make sure the same issue will not happen in the future. ### Checklist - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
…5259) Closes elastic#143641 ## Summary As a follow-up to this PR elastic#145067, in this PR I've added tests to make sure the same issue will not happen in the future. ### Checklist - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
Implements #143641
📝 Summary
Fixes the alerts page crash when a wrong query is entered in the search bar query string.
Note
I am working on tests but I will create a separate PR for that.
🧪 How to test
{
, page should not crash and you should see a toast with a related error message