-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Actionable Observability] Expose ObservabilityAlertSearchBar from Ob…
…servability plugin (#146401) Resolves #146286 ## 📝 Summary In this PR, I exposed ObservabilityAlertSearchBar from the Observability plugin to be used in other plugins such as APM. I've added `ObservabilityAlertSearchBarProvider` in order for other plugins to provide Kibana dependencies to the shared component. ## 🧪 How to test For testing the implementation, I imported this component in the APM plugin and used it in the alerts tab, you can do the same locally by following these steps: 1. Import `ObservabilityAlertSearchBar` in [APM](https://github.com/elastic/kibana/blob/main/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx) and define related hook: ``` import { ObservabilityAlertSearchBar, ObservabilityAlertSearchBarProvider, } from '@kbn/observability-plugin/public'; export const useToasts = () => useKibana<ApmPluginStartDeps>().services.notifications!.toasts; ``` 2. Replace [AlertsTableStatusFilter](https://github.com/elastic/kibana/blob/main/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx#L74) with the `ObservabilityAlertSearchBar` component: ``` <ObservabilityAlertSearchBarProvider {...services} useToasts={useToasts} > <ObservabilityAlertSearchBar appName={'apmApp'} kuery={''} onRangeFromChange={(input) => console.log(input)} onRangeToChange={(input) => console.log(input)} onKueryChange={(input) => console.log(input)} onStatusChange={(input) => console.log(input)} onEsQueryChange={(input) => console.log(input)} rangeTo={'now'} rangeFrom={'now-15m'} status={'all'} /> </ObservabilityAlertSearchBarProvider> ``` You should see the new search bar in APM alerts tab: ![image](https://user-images.githubusercontent.com/12370520/204302146-c0ff4658-67ab-4639-a955-b75a647f57da.png)
- Loading branch information
1 parent
98412f7
commit 9b828e3
Showing
13 changed files
with
263 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.