mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Data Discovery] Remove SO client usages (#224495)
## Summary While checking out our remaining browser SO client usages, I realized it would be _really_ easy to get rid of them. This PR does that. Resolves #224357. ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b929ec2efc
commit
21a288a097
6 changed files with 18 additions and 38 deletions
|
@ -12,7 +12,8 @@
|
|||
"discover",
|
||||
"embeddable",
|
||||
"kibanaUtils",
|
||||
"data"
|
||||
"data",
|
||||
"savedSearch"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ import { Route, Router, Routes } from '@kbn/shared-ux-router';
|
|||
import { I18nProvider } from '@kbn/i18n-react';
|
||||
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
|
||||
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
||||
import { SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/public';
|
||||
import type { SOWithMetadata } from '@kbn/content-management-utils';
|
||||
import type { SavedSearchAttributes } from '@kbn/saved-search-plugin/common';
|
||||
import image from './discover_customization_examples.png';
|
||||
|
||||
export interface DiscoverCustomizationExamplesSetupPlugins {
|
||||
|
@ -35,6 +38,7 @@ export interface DiscoverCustomizationExamplesSetupPlugins {
|
|||
export interface DiscoverCustomizationExamplesStartPlugins {
|
||||
discover: DiscoverStart;
|
||||
data: DataPublicPluginStart;
|
||||
savedSearch: SavedSearchPublicPluginStart;
|
||||
}
|
||||
|
||||
const PLUGIN_ID = 'discoverCustomizationExamples';
|
||||
|
@ -112,15 +116,13 @@ export class DiscoverCustomizationExamplesPlugin implements Plugin {
|
|||
const togglePopover = () => setIsPopoverOpen((open) => !open);
|
||||
const closePopover = () => setIsPopoverOpen(false);
|
||||
const [savedSearches, setSavedSearches] = useState<
|
||||
Array<SimpleSavedObject<{ title: string }>>
|
||||
Array<SOWithMetadata<SavedSearchAttributes>>
|
||||
>([]);
|
||||
|
||||
useEffect(() => {
|
||||
core.savedObjects.client
|
||||
.find<{ title: string }>({ type: 'search' })
|
||||
.then((response) => {
|
||||
setSavedSearches(response.savedObjects);
|
||||
});
|
||||
plugins.savedSearch.getAll().then((response) => {
|
||||
setSavedSearches(response);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const currentSavedSearch = useObservable(
|
||||
|
@ -154,7 +156,7 @@ export class DiscoverCustomizationExamplesPlugin implements Plugin {
|
|||
id: 0,
|
||||
title: 'Saved logs views',
|
||||
items: savedSearches.map((savedSearch) => ({
|
||||
name: savedSearch.get('title'),
|
||||
name: savedSearch.attributes.title,
|
||||
onClick: () => stateContainer.actions.onOpenSavedSearch(savedSearch.id),
|
||||
icon: savedSearch.id === currentSavedSearch.id ? 'check' : 'empty',
|
||||
'data-test-subj': `logsViewSelectorOption-${savedSearch.attributes.title.replace(
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
"@kbn/i18n-react",
|
||||
"@kbn/react-kibana-context-theme",
|
||||
"@kbn/data-plugin",
|
||||
"@kbn/saved-search-plugin",
|
||||
"@kbn/content-management-utils",
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue