-
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.
[AO] Refactor observability alert search bar (#147461)
## 📝 Summary In the previous [PR](#146401), I've added a provider to pass Kibana dependencies to the observability alert search bar component. Since then, I had a lot of discussions about whether it makes sense to have a context for the dependencies of this component or not. Since we haven't decided yet whether this pattern should be adopted or not and there are suggestions about having one provider for the alert-related components, I refactored it to pass the dependency via props instead. ## 🧪 How to test Add this component to [APM](https://github.com/elastic/kibana/blob/main/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx): ``` // Add import { ObservabilityAlertSearchBar } from '@kbn/observability-plugin/public'; export const useToasts = () => useKibana<ApmPluginStartDeps>().services.notifications!.toasts; // Update const { triggersActionsUi: { getAlertsStateTable: AlertsStateTable, getAlertsSearchBar: AlertsSearchBar, alertsTableConfigurationRegistry, }, data: { query: { timefilter: { timefilter: timeFilterService }, }, }, } = services; // Replace // <AlertsTableStatusFilter // status={alertStatusFilter} // onChange={setAlertStatusFilter} // /> <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'} services={{ timeFilterService, AlertsSearchBar, useToasts }} /> ```
- Loading branch information
1 parent
61defdf
commit 23ca495
Showing
6 changed files
with
27 additions
and
80 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
45 changes: 0 additions & 45 deletions
45
x-pack/plugins/observability/public/components/shared/alert_search_bar/services.tsx
This file was deleted.
Oops, something went wrong.
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