removing references to saved object client in lens and graph (#158645)

This commit is contained in:
Peter Pisljar 2023-06-01 15:55:01 +02:00 committed by GitHub
parent f5d37e75fa
commit 648c669034
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 18 additions and 49 deletions

View file

@ -21,7 +21,7 @@ import { GraphWorkspaceSavedObject } from '../../types';
* @param source - serialized version of this object what will be indexed into elasticsearch.
* @param savedObject - VisSavedObject
* @param options - options to pass to the saved object create method
* @param services - provides Kibana services savedObjectsClient and overlays
* @param services - provides Kibana services contentClient and overlays
* @returns {Promise} - A promise that is resolved with the objects id if the object is
* successfully indexed. If the overwrite confirmation was rejected, an error is thrown with
* a confirmRejected = true parameter so that case can be handled differently than

View file

@ -113,7 +113,6 @@ export function DimensionEditor(props: DimensionEditorProps) {
data: props.data,
fieldFormats: props.fieldFormats,
uiSettings: props.uiSettings,
savedObjectsClient: props.savedObjectsClient,
http: props.http,
storage: props.storage,
unifiedSearch: props.unifiedSearch,

View file

@ -25,13 +25,7 @@ import {
FormBasedDimensionEditorProps,
} from './dimension_panel';
import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test-jest-helpers';
import {
IUiSettingsClient,
SavedObjectsClientContract,
HttpSetup,
CoreStart,
NotificationsStart,
} from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup, CoreStart, NotificationsStart } from '@kbn/core/public';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { useExistingFieldsReader } from '@kbn/unified-field-list-plugin/public/hooks/use_existing_fields';
import { generateId } from '../../../id_generator';
@ -228,7 +222,6 @@ describe('FormBasedDimensionEditor', () => {
filterOperations: () => true,
storage: {} as IStorageWrapper,
uiSettings: {} as IUiSettingsClient,
savedObjectsClient: {} as SavedObjectsClientContract,
http: {} as HttpSetup,
fieldFormats: fieldFormatsServiceMock.createStartContract(),
unifiedSearch: unifiedSearchPluginMock.createStartContract(),

View file

@ -6,12 +6,7 @@
*/
import React, { memo } from 'react';
import type {
IUiSettingsClient,
SavedObjectsClientContract,
HttpSetup,
NotificationsStart,
} from '@kbn/core/public';
import type { IUiSettingsClient, HttpSetup, NotificationsStart } from '@kbn/core/public';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { LayerTypes } from '@kbn/expression-xy-plugin/public';
@ -34,7 +29,6 @@ export type FormBasedDimensionEditorProps =
DatasourceDimensionEditorProps<FormBasedPrivateState> & {
uiSettings: IUiSettingsClient;
storage: IStorageWrapper;
savedObjectsClient: SavedObjectsClientContract;
layerId: string;
http: HttpSetup;
data: DataPublicPluginStart;

View file

@ -13,7 +13,7 @@ import { mountWithIntl as mount } from '@kbn/test-jest-helpers';
import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import type { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { OperationMetadata } from '../../../types';
@ -73,7 +73,6 @@ describe('reference editor', () => {
dateRange: { fromDate: 'now-1d', toDate: 'now' },
storage: {} as IStorageWrapper,
uiSettings: {} as IUiSettingsClient,
savedObjectsClient: {} as SavedObjectsClientContract,
http: {} as HttpSetup,
data: {} as DataPublicPluginStart,
fieldFormats: fieldFormatsServiceMock.createStartContract(),

View file

@ -10,7 +10,7 @@ import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiFormRowProps, EuiSpacer, EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import type { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
@ -98,7 +98,6 @@ export interface ReferenceEditorProps {
// Services
uiSettings: IUiSettingsClient;
storage: IStorageWrapper;
savedObjectsClient: SavedObjectsClientContract;
http: HttpSetup;
data: DataPublicPluginStart;
fieldFormats: FieldFormatsStart;

View file

@ -578,7 +578,6 @@ export function getFormBasedDatasource({
uiSettings={uiSettings}
storage={storage}
fieldFormats={fieldFormats}
savedObjectsClient={core.savedObjects.client}
http={core.http}
data={data}
unifiedSearch={unifiedSearch}

View file

@ -13,7 +13,7 @@ import { EuiSwitch } from '@elastic/eui';
import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks';
import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import type { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { UI_SETTINGS } from '@kbn/data-plugin/public';
import { dataPluginMock, getCalculateAutoTimeExpression } from '@kbn/data-plugin/public/mocks';
@ -98,7 +98,6 @@ const defaultOptions = {
layerId: '1',
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: {
fromDate: 'now-1y',
toDate: 'now',

View file

@ -10,7 +10,7 @@ import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks';
import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import type { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks';
@ -25,7 +25,6 @@ const uiSettingsMock = {} as IUiSettingsClient;
const defaultProps = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: { fromDate: 'now-1d', toDate: 'now' },
data: dataPluginMock.createStartContract(),
fieldFormats: fieldFormatsServiceMock.createStartContract(),

View file

@ -5,12 +5,7 @@
* 2.0.
*/
import {
IUiSettingsClient,
SavedObjectsClientContract,
HttpSetup,
CoreStart,
} from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup, CoreStart } from '@kbn/core/public';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import type {
ExpressionAstExpressionBuilder,
@ -189,7 +184,6 @@ export interface ParamEditorProps<
indexPattern: IndexPattern;
uiSettings: IUiSettingsClient;
storage: IStorageWrapper;
savedObjectsClient: SavedObjectsClientContract;
http: HttpSetup;
dateRange: DateRange;
data: DataPublicPluginStart;

View file

@ -10,7 +10,7 @@ import { shallow, ShallowWrapper } from 'enzyme';
import { EuiComboBox, EuiFormRow } from '@elastic/eui';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks';
import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks';
@ -27,7 +27,6 @@ const uiSettingsMock = {} as IUiSettingsClient;
const defaultProps = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: { fromDate: 'now-1d', toDate: 'now' },
fieldFormats: fieldFormatsServiceMock.createStartContract(),
unifiedSearch: unifiedSearchPluginMock.createStartContract(),

View file

@ -8,7 +8,7 @@
import React, { ChangeEvent } from 'react';
import { act } from 'react-dom/test-utils';
import { EuiRange } from '@elastic/eui';
import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { EuiFormRow } from '@elastic/eui';
import { shallow, mount } from 'enzyme';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
@ -45,7 +45,6 @@ const uiSettingsMock = {} as IUiSettingsClient;
const defaultProps = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: { fromDate: 'now-1d', toDate: 'now' },
data: dataPluginMock.createStartContract(),
fieldFormats: fieldFormatsServiceMock.createStartContract(),
@ -220,19 +219,19 @@ describe('percentile', () => {
],
// filtered
[
`aggFilteredMetric id="2" enabled=true schema="metric"
`aggFilteredMetric id="2" enabled=true schema="metric"
customBucket={aggFilter id="2-filter" enabled=true schema="bucket" filter={kql q="geo.dest: \\"GA\\" "}}
customMetric={aggSinglePercentile id="2" enabled=true schema="metric" field="foo" percentile=10}`,
`aggFilteredMetric id="3" enabled=true schema="metric"
`aggFilteredMetric id="3" enabled=true schema="metric"
customBucket={aggFilter id="2-filter" enabled=true schema="bucket" filter={kql q="geo.dest: \\"GA\\" "}}
customMetric={aggSinglePercentile id="2" enabled=true schema="metric" field="foo" percentile=10}`,
],
// different filter
[
`aggFilteredMetric id="4" enabled=true schema="metric"
`aggFilteredMetric id="4" enabled=true schema="metric"
customBucket={aggFilter id="2-filter" enabled=true schema="bucket" filter={kql q="geo.dest: \\"AL\\" "}}
customMetric={aggSinglePercentile id="2" enabled=true schema="metric" field="foo" percentile=10}`,
`aggFilteredMetric id="5" enabled=true schema="metric"
`aggFilteredMetric id="5" enabled=true schema="metric"
customBucket={aggFilter id="2-filter" enabled=true schema="bucket" filter={kql q="geo.dest: \\"AL\\" "}}
customMetric={aggSinglePercentile id="2" enabled=true schema="metric" field="foo" percentile=10}`,
],

View file

@ -8,7 +8,7 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { EuiFieldNumber } from '@elastic/eui';
import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { EuiFormRow } from '@elastic/eui';
import { shallow, mount } from 'enzyme';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
@ -37,7 +37,6 @@ const uiSettingsMock = {} as IUiSettingsClient;
const defaultProps = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: { fromDate: 'now-1d', toDate: 'now' },
data: dataPluginMock.createStartContract(),
fieldFormats: fieldFormatsServiceMock.createStartContract(),

View file

@ -9,7 +9,7 @@ import React from 'react';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import { EuiFieldNumber, EuiRange, EuiButtonEmpty, EuiLink, EuiText } from '@elastic/eui';
import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks';
@ -85,7 +85,6 @@ const sourceField = 'MyField';
const defaultOptions = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: {
fromDate: 'now-1y',
toDate: 'now',

View file

@ -8,7 +8,7 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { EuiFieldNumber } from '@elastic/eui';
import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { shallow, mount } from 'enzyme';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
@ -40,7 +40,6 @@ const dateRange = {
const defaultProps = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: { fromDate: 'now-1d', toDate: 'now' },
data: dataPluginMock.createStartContract(),
fieldFormats: fieldFormatsServiceMock.createStartContract(),

View file

@ -9,7 +9,7 @@ import React from 'react';
import { act } from 'react-dom/test-utils';
import { shallow, mount } from 'enzyme';
import { EuiButtonGroup, EuiComboBox, EuiFieldNumber, EuiSelect, EuiSwitch } from '@elastic/eui';
import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public';
import type { IUiSettingsClient, HttpSetup } from '@kbn/core/public';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
@ -88,7 +88,6 @@ const uiSettingsMock = {} as IUiSettingsClient;
const defaultProps = {
storage: {} as IStorageWrapper,
uiSettings: uiSettingsMock,
savedObjectsClient: {} as SavedObjectsClientContract,
dateRange: { fromDate: 'now-1d', toDate: 'now' },
data: dataPluginMock.createStartContract(),
fieldFormats: fieldFormatsServiceMock.createStartContract(),