Skip to content

Commit d69711a

Browse files
committed
chore: 🤖 catch up with master
2 parents 99a07e0 + 75384e1 commit d69711a

File tree

117 files changed

+3202
-2331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+3202
-2331
lines changed

‎src/legacy/core_plugins/data/public/legacy.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,13 @@
3535
*/
3636

3737
import { npSetup, npStart } from 'ui/new_platform';
38-
import { LegacyDependenciesPlugin } from './shim/legacy_dependencies_plugin';
3938
import { plugin } from '.';
4039

4140
const dataPlugin = plugin();
42-
const legacyPlugin = new LegacyDependenciesPlugin();
4341

44-
export const setup = dataPlugin.setup(npSetup.core, {
45-
__LEGACY: legacyPlugin.setup(),
46-
});
42+
export const setup = dataPlugin.setup(npSetup.core);
4743

4844
export const start = dataPlugin.start(npStart.core, {
4945
data: npStart.plugins.data,
5046
uiActions: npSetup.plugins.uiActions,
51-
__LEGACY: legacyPlugin.start(),
5247
});

‎src/legacy/core_plugins/data/public/plugin.ts‎

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ import { SearchService, SearchStart, createSearchBar, StatetfulSearchBarProps }
2222
import { QueryService, QuerySetup } from './query';
2323
import { TimefilterService, TimefilterSetup } from './timefilter';
2424
import { IndexPatternsService, IndexPatternsSetup, IndexPatternsStart } from './index_patterns';
25-
import {
26-
LegacyDependenciesPluginSetup,
27-
LegacyDependenciesPluginStart,
28-
} from './shim/legacy_dependencies_plugin';
25+
import { Storage, IStorageWrapper } from '../../../../../src/plugins/kibana_utils/public';
2926
import { DataPublicPluginStart } from '../../../../plugins/data/public';
3027
import { initLegacyModule } from './shim/legacy_module';
3128
import { IUiActionsSetup } from '../../../../plugins/ui_actions/public';
@@ -35,19 +32,9 @@ import {
3532
} from './filter/action/apply_filter_action';
3633
import { APPLY_FILTER_TRIGGER } from '../../../../plugins/embeddable/public';
3734

38-
/**
39-
* Interface for any dependencies on other plugins' `setup` contracts.
40-
*
41-
* @internal
42-
*/
43-
export interface DataPluginSetupDependencies {
44-
__LEGACY: LegacyDependenciesPluginSetup;
45-
}
46-
4735
export interface DataPluginStartDependencies {
4836
data: DataPublicPluginStart;
4937
uiActions: IUiActionsSetup;
50-
__LEGACY: LegacyDependenciesPluginStart;
5138
}
5239

5340
/**
@@ -87,22 +74,24 @@ export interface DataStart {
8774
* in the setup/start interfaces. The remaining items exported here are either types,
8875
* or static code.
8976
*/
90-
export class DataPlugin
91-
implements
92-
Plugin<DataSetup, DataStart, DataPluginSetupDependencies, DataPluginStartDependencies> {
77+
78+
export class DataPlugin implements Plugin<DataSetup, DataStart, {}, DataPluginStartDependencies> {
9379
private readonly indexPatterns: IndexPatternsService = new IndexPatternsService();
9480
private readonly query: QueryService = new QueryService();
9581
private readonly search: SearchService = new SearchService();
9682
private readonly timefilter: TimefilterService = new TimefilterService();
9783

9884
private setupApi!: DataSetup;
85+
private storage!: IStorageWrapper;
9986

100-
public setup(core: CoreSetup, { __LEGACY }: DataPluginSetupDependencies): DataSetup {
87+
public setup(core: CoreSetup): DataSetup {
10188
const { uiSettings } = core;
10289

90+
this.storage = new Storage(window.localStorage);
91+
10392
const timefilterService = this.timefilter.setup({
10493
uiSettings,
105-
store: __LEGACY.storage,
94+
storage: this.storage,
10695
});
10796
this.setupApi = {
10897
indexPatterns: this.indexPatterns.setup(),
@@ -113,10 +102,7 @@ export class DataPlugin
113102
return this.setupApi;
114103
}
115104

116-
public start(
117-
core: CoreStart,
118-
{ __LEGACY, data, uiActions }: DataPluginStartDependencies
119-
): DataStart {
105+
public start(core: CoreStart, { data, uiActions }: DataPluginStartDependencies): DataStart {
120106
const { uiSettings, http, notifications, savedObjects } = core;
121107

122108
const indexPatternsService = this.indexPatterns.start({
@@ -131,7 +117,7 @@ export class DataPlugin
131117
const SearchBar = createSearchBar({
132118
core,
133119
data,
134-
store: __LEGACY.storage,
120+
storage: this.storage,
135121
timefilter: this.setupApi.timefilter,
136122
});
137123

‎src/legacy/core_plugins/data/public/query/persisted_log/persisted_log.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import _ from 'lodash';
2121
import * as Rx from 'rxjs';
2222
import { map } from 'rxjs/operators';
23-
import { Storage } from '../../types';
23+
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
2424

2525
const defaultIsDuplicate = (oldItem: any, newItem: any) => {
2626
return _.isEqual(oldItem, newItem);
@@ -37,12 +37,12 @@ export class PersistedLog<T = any> {
3737
public maxLength?: number;
3838
public filterDuplicates?: boolean;
3939
public isDuplicate: (oldItem: T, newItem: T) => boolean;
40-
public storage: Storage;
40+
public storage: IStorageWrapper;
4141
public items: T[];
4242

4343
private update$ = new Rx.BehaviorSubject(undefined);
4444

45-
constructor(name: string, options: PersistedLogOptions<T> = {}, storage: Storage) {
45+
constructor(name: string, options: PersistedLogOptions<T> = {}, storage: IStorageWrapper) {
4646
this.name = name;
4747
this.maxLength =
4848
typeof options.maxLength === 'string'

‎src/legacy/core_plugins/data/public/query/query_bar/components/__snapshots__/query_bar_input.test.tsx.snap‎

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/legacy/core_plugins/data/public/query/query_bar/components/query_bar_input.test.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const createMockWebStorage = () => ({
5858
});
5959

6060
const createMockStorage = () => ({
61-
store: createMockWebStorage(),
61+
storage: createMockWebStorage(),
6262
get: jest.fn(),
6363
set: jest.fn(),
6464
remove: jest.fn(),
@@ -80,7 +80,7 @@ const mockIndexPattern = {
8080
],
8181
} as IndexPattern;
8282

83-
function wrapQueryBarInputInContext(testProps: any, store?: any) {
83+
function wrapQueryBarInputInContext(testProps: any, storage?: any) {
8484
const defaultOptions = {
8585
screenTitle: 'Another Screen',
8686
intl: null as any,
@@ -89,7 +89,7 @@ function wrapQueryBarInputInContext(testProps: any, store?: any) {
8989
const services = {
9090
...startMock,
9191
appName: testProps.appName || 'test',
92-
store: store || createMockStorage(),
92+
storage: storage || createMockStorage(),
9393
};
9494

9595
return (

‎src/legacy/core_plugins/data/public/query/query_bar/components/query_bar_input.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export class QueryBarInputUI extends Component<Props, State> {
365365
body: JSON.stringify({ opt_in: language === 'kuery' }),
366366
});
367367

368-
this.services.store.set('kibana.userQueryLanguage', language);
368+
this.services.storage.set('kibana.userQueryLanguage', language);
369369

370370
const newQuery = { query: '', language };
371371
this.onChange(newQuery);
@@ -387,10 +387,10 @@ export class QueryBarInputUI extends Component<Props, State> {
387387
};
388388

389389
private initPersistedLog = () => {
390-
const { uiSettings, store, appName } = this.services;
390+
const { uiSettings, storage, appName } = this.services;
391391
this.persistedLog = this.props.persistedLog
392392
? this.props.persistedLog
393-
: getQueryLog(uiSettings, store, appName, this.props.query.language);
393+
: getQueryLog(uiSettings, storage, appName, this.props.query.language);
394394
};
395395

396396
public onMouseEnterSuggestion = (index: number) => {

‎src/legacy/core_plugins/data/public/query/query_bar/components/query_bar_top_row.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const createMockWebStorage = () => ({
7979
});
8080

8181
const createMockStorage = () => ({
82-
store: createMockWebStorage(),
82+
storage: createMockWebStorage(),
8383
get: jest.fn(),
8484
set: jest.fn(),
8585
remove: jest.fn(),
@@ -112,7 +112,7 @@ function wrapQueryBarTopRowInContext(testProps: any) {
112112
const services = {
113113
...startMock,
114114
appName: 'discover',
115-
store: createMockStorage(),
115+
storage: createMockStorage(),
116116
};
117117

118118
return (

‎src/legacy/core_plugins/data/public/query/query_bar/components/query_bar_top_row.tsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function QueryBarTopRowUI(props: Props) {
7373
const [isDateRangeInvalid, setIsDateRangeInvalid] = useState(false);
7474

7575
const kibana = useKibana<IDataPluginServices>();
76-
const { uiSettings, notifications, store, appName, docLinks } = kibana.services;
76+
const { uiSettings, notifications, storage, appName, docLinks } = kibana.services;
7777

7878
const kueryQuerySyntaxLink: string = docLinks!.links.query.kueryQuerySyntax;
7979

@@ -82,7 +82,7 @@ function QueryBarTopRowUI(props: Props) {
8282

8383
useEffect(() => {
8484
if (!props.query) return;
85-
persistedLog = getQueryLog(uiSettings!, store, appName, props.query.language);
85+
persistedLog = getQueryLog(uiSettings!, storage, appName, props.query.language);
8686
}, [queryLanguage]);
8787

8888
function onClickSubmitButton(event: React.MouseEvent<HTMLButtonElement>) {
@@ -211,7 +211,7 @@ function QueryBarTopRowUI(props: Props) {
211211
}
212212

213213
function shouldRenderQueryInput(): boolean {
214-
return Boolean(props.showQueryInput && props.indexPatterns && props.query && store);
214+
return Boolean(props.showQueryInput && props.indexPatterns && props.query && storage);
215215
}
216216

217217
function renderUpdateButton() {
@@ -293,7 +293,7 @@ function QueryBarTopRowUI(props: Props) {
293293
if (
294294
language === 'kuery' &&
295295
typeof query === 'string' &&
296-
(!store || !store.get('kibana.luceneSyntaxWarningOptOut')) &&
296+
(!storage || !storage.get('kibana.luceneSyntaxWarningOptOut')) &&
297297
doesKueryExpressionHaveLuceneSyntaxError(query)
298298
) {
299299
const toast = notifications!.toasts.addWarning({
@@ -337,8 +337,8 @@ function QueryBarTopRowUI(props: Props) {
337337
}
338338

339339
function onLuceneSyntaxWarningOptOut(toast: Toast) {
340-
if (!store) return;
341-
store.set('kibana.luceneSyntaxWarningOptOut', true);
340+
if (!storage) return;
341+
storage.set('kibana.luceneSyntaxWarningOptOut', true);
342342
notifications!.toasts.remove(toast);
343343
}
344344

‎src/legacy/core_plugins/data/public/query/query_bar/lib/get_query_log.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
*/
1919

2020
import { UiSettingsClientContract } from 'src/core/public';
21+
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
2122
import { PersistedLog } from '../../persisted_log';
22-
import { Storage } from '../../../types';
2323

2424
export function getQueryLog(
2525
uiSettings: UiSettingsClientContract,
26-
store: Storage,
26+
storage: IStorageWrapper,
2727
appName: string,
2828
language: string
2929
) {
@@ -33,6 +33,6 @@ export function getQueryLog(
3333
maxLength: uiSettings.get('history:limit'),
3434
filterDuplicates: true,
3535
},
36-
store
36+
storage
3737
);
3838
}

‎src/legacy/core_plugins/data/public/search/search_bar/components/create_search_bar.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { Subscription } from 'rxjs';
2222
import { Filter } from '@kbn/es-query';
2323
import { CoreStart } from 'src/core/public';
2424
import { DataPublicPluginStart } from 'src/plugins/data/public';
25-
import { Storage } from '../../../types';
25+
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
2626
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
2727
import { TimefilterSetup } from '../../../timefilter';
2828
import { SearchBar } from '../../../';
@@ -31,7 +31,7 @@ import { SearchBarOwnProps } from '.';
3131
interface StatefulSearchBarDeps {
3232
core: CoreStart;
3333
data: DataPublicPluginStart;
34-
store: Storage;
34+
storage: IStorageWrapper;
3535
timefilter: TimefilterSetup;
3636
}
3737

@@ -54,7 +54,7 @@ const defaultOnRefreshChange = (timefilter: TimefilterSetup) => {
5454
};
5555
};
5656

57-
export function createSearchBar({ core, store, timefilter, data }: StatefulSearchBarDeps) {
57+
export function createSearchBar({ core, storage, timefilter, data }: StatefulSearchBarDeps) {
5858
// App name should come from the core application service.
5959
// Until it's available, we'll ask the user to provide it for the pre-wired component.
6060
return (props: StatetfulSearchBarProps) => {
@@ -107,7 +107,7 @@ export function createSearchBar({ core, store, timefilter, data }: StatefulSearc
107107
services={{
108108
appName: props.appName,
109109
data,
110-
store,
110+
storage,
111111
...core,
112112
}}
113113
>

0 commit comments

Comments
 (0)