Skip to content
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

[Watcher] Remove deprecated savedObjectsClient #154172

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ import { HttpSetup } from '@kbn/core/public';
import { init as initHttpRequests } from './http_requests';
import { mockContextValue } from './app_context.mock';
import { AppContextProvider } from '../../../public/application/app_context';
import { setHttpClient, setSavedObjectsClient } from '../../../public/application/lib/api';

const mockSavedObjectsClient = () => {
return {
find: (_params?: any) => {},
};
};
import { setHttpClient } from '../../../public/application/lib/api';

export const WithAppDependencies =
(Component: any, httpSetup: HttpSetup) => (props: Record<string, unknown>) => {
Expand All @@ -31,7 +25,5 @@ export const WithAppDependencies =
};

export const setupEnvironment = () => {
setSavedObjectsClient(mockSavedObjectsClient() as any);

return initHttpRequests();
};
8 changes: 3 additions & 5 deletions x-pack/plugins/watcher/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { Observable } from 'rxjs';
import { SavedObjectsClientContract, CoreTheme } from '@kbn/core/public';
import { CoreTheme } from '@kbn/core/public';

import { KibanaThemeProvider } from './shared_imports';
import { App, AppDeps } from './app';
import { setHttpClient, setSavedObjectsClient } from './lib/api';
import { setHttpClient } from './lib/api';

interface BootDeps extends AppDeps {
element: HTMLElement;
savedObjects: SavedObjectsClientContract;
I18nContext: any;
theme$: Observable<CoreTheme>;
}

export const renderApp = (bootDeps: BootDeps) => {
const { I18nContext, element, savedObjects, theme$, ...appDeps } = bootDeps;
const { I18nContext, element, theme$, ...appDeps } = bootDeps;

setHttpClient(appDeps.http);
setSavedObjectsClient(savedObjects);

render(
<I18nContext>
Expand Down
10 changes: 1 addition & 9 deletions x-pack/plugins/watcher/public/application/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { HttpSetup, SavedObjectsClientContract } from '@kbn/core/public';
import { HttpSetup } from '@kbn/core/public';

import { Settings } from '../models/settings';
import { Watch } from '../models/watch';
Expand All @@ -27,14 +27,6 @@ export const getHttpClient = () => {
return httpClient;
};

let savedObjectsClient: SavedObjectsClientContract;

export const setSavedObjectsClient = (aSavedObjectsClient: SavedObjectsClientContract) => {
savedObjectsClient = aSavedObjectsClient;
};

export const getSavedObjectsClient = () => savedObjectsClient;

const basePath = ROUTES.API_ROOT;

const loadWatchesDeserializer = ({ watches = [] }: { watches: any[] }) => {
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/watcher/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class WatcherUIPlugin implements Plugin<void, void, Dependencies, any> {
chrome: { docTitle },
i18n: i18nDep,
docLinks,
savedObjects,
application,
executionContext,
} = coreStart;
Expand All @@ -69,7 +68,6 @@ export class WatcherUIPlugin implements Plugin<void, void, Dependencies, any> {
docLinks,
setBreadcrumbs,
theme: charts.theme,
savedObjects: savedObjects.client,
I18nContext: i18nDep.Context,
createTimeBuckets: () => new TimeBuckets(uiSettings, data),
history,
Expand Down