Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pageLoadAssetSize:
sessionView: 77750
cloudSecurityPosture: 19109
visTypeGauge: 24113
unifiedSearch: 49195
unifiedSearch: 104869
data: 454087
expressionXY: 26500
eventAnnotation: 19334
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { uniq } from 'lodash';
import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';

// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
// import { AutocompleteStart } from '../../../../../../../src/plugins/data/public';
// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public';
type AutocompleteStart = any;

import * as i18n from '../translations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-
import { DataViewBase, DataViewFieldBase } from '@kbn/es-query';

// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
// import { AutocompleteStart } from '../../../../../../../src/plugins/data/public';
// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public';
type AutocompleteStart = any;

import * as i18n from '../translations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { uniq } from 'lodash';
import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types';

// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
// import { AutocompleteStart } from '../../../../../../../src/plugins/data/public';
// import { AutocompleteStart } from '../../../../../../../src/plugins/unified_search/public';
type AutocompleteStart = any;

import * as i18n from '../translations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ListOperatorTypeEnum as OperatorTypeEnum } from '@kbn/securitysolution-
import { DataViewBase, DataViewFieldBase, getDataViewFieldSubtypeNested } from '@kbn/es-query';

// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
// import { AutocompleteStart } from '../../../../../../../../src/plugins/data/public';
// import { AutocompleteStart } from '../../../../../../../../src/plugins/unified_search/public';
type AutocompleteStart = any;

interface FuncArgs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ kibana_vars=(
csp.frame_ancestors
csp.report_uri
csp.report_to
data.autocomplete.valueSuggestions.terminateAfter
data.autocomplete.valueSuggestions.timeout
unifiedSearch.autocomplete.valueSuggestions.terminateAfter
unifiedSearch.autocomplete.valueSuggestions.timeout
elasticsearch.customHeaders
elasticsearch.hosts
elasticsearch.logQueries
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/controls/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"expressions",
"embeddable",
"dataViews",
"data"
"data",
"unifiedSearch"
],
"optionalPlugins": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { decorators } from './decorators';
import { ControlsPanels } from '../control_group/types';
import { ControlGroupContainer } from '../control_group';
import { pluginServices, registry } from '../services/storybook';
import { replaceValueSuggestionMethod } from '../services/storybook/data';
import { replaceValueSuggestionMethod } from '../services/storybook/unified_search';
import { injectStorybookDataView } from '../services/storybook/data_views';
import { populateStorybookControlFactories } from './storybook_control_factories';
import { OptionsListRequest } from '../services/options_list';
Expand Down
1 change: 0 additions & 1 deletion src/plugins/controls/public/services/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface ControlsDataService {
) => Observable<{ min?: number; max?: number }>;
getDataView: DataPublicPluginStart['dataViews']['get'];
getDataView$: (id: string) => Observable<DataView>;
autocomplete: DataPublicPluginStart['autocomplete'];
query: DataPublicPluginStart['query'];
searchSource: DataPublicPluginStart['search']['searchSource'];
timefilter: DataPublicPluginStart['query']['timefilter']['timefilter'];
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/controls/public/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ControlsOverlaysService } from './overlays';
import { registry as stubRegistry } from './stub';
import { ControlsPluginStart } from '../types';
import { ControlsDataService } from './data';
import { ControlsUnifiedSearchService } from './unified_search';
import { ControlsService } from './controls';
import { ControlsHTTPService } from './http';
import { ControlsOptionsListService } from './options_list';
Expand All @@ -22,6 +23,7 @@ export interface ControlsServices {
dataViews: ControlsDataViewsService;
overlays: ControlsOverlaysService;
data: ControlsDataService;
unifiedSearch: ControlsUnifiedSearchService;
http: ControlsHTTPService;
settings: ControlsSettingsService;

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/controls/public/services/kibana/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const minMaxAgg = (field?: DataViewField) => {

export const dataServiceFactory: DataServiceFactory = ({ startPlugins }) => {
const {
data: { query: queryPlugin, search, autocomplete },
data: { query: queryPlugin, search },
} = startPlugins;
const { data } = startPlugins;

Expand Down Expand Up @@ -95,7 +95,6 @@ export const dataServiceFactory: DataServiceFactory = ({ startPlugins }) => {
from(fetchFieldRange(dataView, fieldName, input)),
getDataView: data.dataViews.get,
getDataView$: (id: string) => from(data.dataViews.get(id)),
autocomplete,
query: queryPlugin,
searchSource: search.searchSource,
timefilter: queryPlugin.timefilter.timefilter,
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/controls/public/services/kibana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import { dataServiceFactory } from './data';
import { httpServiceFactory } from './http';
import { optionsListServiceFactory } from './options_list';
import { settingsServiceFactory } from './settings';
import { unifiedSearchServiceFactory } from './unified_search';

export const providers: PluginServiceProviders<
ControlsServices,
KibanaPluginServiceParams<ControlsPluginStartDeps>
> = {
http: new PluginServiceProvider(httpServiceFactory),
data: new PluginServiceProvider(dataServiceFactory),
unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
overlays: new PluginServiceProvider(overlaysServiceFactory),
dataViews: new PluginServiceProvider(dataViewsServiceFactory),
settings: new PluginServiceProvider(settingsServiceFactory),
Expand Down
26 changes: 26 additions & 0 deletions src/plugins/controls/public/services/kibana/unified_search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { ControlsUnifiedSearchService } from '../unified_search';
import { ControlsPluginStartDeps } from '../../types';
import { KibanaPluginServiceFactory } from '../../../../presentation_util/public';

export type UnifiedSearchServiceFactory = KibanaPluginServiceFactory<
ControlsUnifiedSearchService,
ControlsPluginStartDeps
>;

export const unifiedSearchServiceFactory: UnifiedSearchServiceFactory = ({ startPlugins }) => {
const {
unifiedSearch: { autocomplete },
} = startPlugins;

return {
autocomplete,
};
};
11 changes: 1 addition & 10 deletions src/plugins/controls/public/services/storybook/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@
import { of, Observable } from 'rxjs';
import { PluginServiceFactory } from '../../../../presentation_util/public';
import { DataPublicPluginStart } from '../../../../data/public';
import { DataViewField, DataView } from '../../../../data_views/common';
import { DataView } from '../../../../data_views/common';
import { ControlsDataService } from '../data';

let valueSuggestionMethod = ({ field, query }: { field: DataViewField; query: string }) =>
Promise.resolve(['storybook', 'default', 'values']);
export const replaceValueSuggestionMethod = (
newMethod: ({ field, query }: { field: DataViewField; query: string }) => Promise<string[]>
) => (valueSuggestionMethod = newMethod);

export type DataServiceFactory = PluginServiceFactory<ControlsDataService>;
export const dataServiceFactory: DataServiceFactory = () => ({
autocomplete: {
getValueSuggestions: valueSuggestionMethod,
} as unknown as DataPublicPluginStart['autocomplete'],
query: {} as unknown as DataPublicPluginStart['query'],
searchSource: {
create: () => ({
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/controls/public/services/storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '../../../../presentation_util/public';
import { ControlsServices } from '..';
import { dataServiceFactory } from './data';
import { unifiedSearchServiceFactory } from './unified_search';
import { overlaysServiceFactory } from './overlays';
import { dataViewsServiceFactory } from './data_views';
import { httpServiceFactory } from '../stub/http';
Expand All @@ -28,6 +29,7 @@ export const providers: PluginServiceProviders<ControlsServices> = {
dataViews: new PluginServiceProvider(dataViewsServiceFactory),
http: new PluginServiceProvider(httpServiceFactory),
data: new PluginServiceProvider(dataServiceFactory),
unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
overlays: new PluginServiceProvider(overlaysServiceFactory),
settings: new PluginServiceProvider(settingsServiceFactory),

Expand Down
25 changes: 25 additions & 0 deletions src/plugins/controls/public/services/storybook/unified_search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { PluginServiceFactory } from '../../../../presentation_util/public';
import { DataViewField } from '../../../../data_views/common';
import { ControlsUnifiedSearchService } from '../unified_search';
import { UnifiedSearchPublicPluginStart } from '../../../../unified_search/public';

let valueSuggestionMethod = ({ field, query }: { field: DataViewField; query: string }) =>
Promise.resolve(['storybook', 'default', 'values']);
export const replaceValueSuggestionMethod = (
newMethod: ({ field, query }: { field: DataViewField; query: string }) => Promise<string[]>
) => (valueSuggestionMethod = newMethod);

export type UnifiedSearchServiceFactory = PluginServiceFactory<ControlsUnifiedSearchService>;
export const unifiedSearchServiceFactory: UnifiedSearchServiceFactory = () => ({
autocomplete: {
getValueSuggestions: valueSuggestionMethod,
} as unknown as UnifiedSearchPublicPluginStart['autocomplete'],
});
3 changes: 2 additions & 1 deletion src/plugins/controls/public/services/stub/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import { dataServiceFactory } from '../storybook/data';
import { dataViewsServiceFactory } from '../storybook/data_views';
import { optionsListServiceFactory } from '../storybook/options_list';
import { settingsServiceFactory } from '../storybook/settings';
import { unifiedSearchServiceFactory } from '../storybook/unified_search';

export const providers: PluginServiceProviders<ControlsServices> = {
http: new PluginServiceProvider(httpServiceFactory),
data: new PluginServiceProvider(dataServiceFactory),
overlays: new PluginServiceProvider(overlaysServiceFactory),
dataViews: new PluginServiceProvider(dataViewsServiceFactory),
settings: new PluginServiceProvider(settingsServiceFactory),

unifiedSearch: new PluginServiceProvider(unifiedSearchServiceFactory),
controls: new PluginServiceProvider(controlsServiceFactory),
optionsList: new PluginServiceProvider(optionsListServiceFactory),
};
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/controls/public/services/unified_search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { UnifiedSearchPublicPluginStart } from '../../../unified_search/public';

export interface ControlsUnifiedSearchService {
autocomplete: UnifiedSearchPublicPluginStart['autocomplete'];
}
2 changes: 2 additions & 0 deletions src/plugins/controls/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '../../embeddable/public';
import { ControlInput } from '../common/types';
import { DataPublicPluginStart } from '../../data/public';
import { UnifiedSearchPublicPluginStart } from '../../unified_search/public';
import { ControlsService } from './services/controls';
import { DataView, DataViewsPublicPluginStart } from '../../data_views/public';

Expand Down Expand Up @@ -70,6 +71,7 @@ export interface ControlsPluginSetupDeps {
}
export interface ControlsPluginStartDeps {
data: DataPublicPluginStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
embeddable: EmbeddableStart;
dataViews: DataViewsPublicPluginStart;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import {
} from '../../../common/control_types/options_list/types';
import { CoreSetup, ElasticsearchClient } from '../../../../../core/server';
import { getKbnServerError, reportServerError } from '../../../../kibana_utils/server';
import { PluginSetup as DataPluginSetup } from '../../../../data/server';
import { PluginSetup as UnifiedSearchPluginSetup } from '../../../../unified_search/server';
import { FieldSpec, getFieldSubtypeNested } from '../../../../data_views/common';

export const setupOptionsListSuggestionsRoute = (
{ http }: CoreSetup,
getAutocompleteSettings: DataPluginSetup['autocomplete']['getAutocompleteSettings']
getAutocompleteSettings: UnifiedSearchPluginSetup['autocomplete']['getAutocompleteSettings']
) => {
const router = http.createRouter();

Expand Down
6 changes: 4 additions & 2 deletions src/plugins/controls/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { CoreSetup, Plugin } from 'kibana/server';

import { EmbeddableSetup } from '../../embeddable/server';
import { PluginSetup as DataSetup } from '../../data/server';
import { PluginSetup as UnifiedSearchSetup } from '../../unified_search/server';
import { setupOptionsListSuggestionsRoute } from './control_types/options_list/options_list_suggestions_route';
import { controlGroupContainerPersistableStateServiceFactory } from './control_group/control_group_container_factory';
import { optionsListPersistableStateServiceFactory } from './control_types/options_list/options_list_embeddable_factory';
Expand All @@ -18,18 +19,19 @@ import { timeSliderPersistableStateServiceFactory } from './control_types/time_s
interface SetupDeps {
embeddable: EmbeddableSetup;
data: DataSetup;
unifiedSearch: UnifiedSearchSetup;
}

export class ControlsPlugin implements Plugin<object, object, SetupDeps> {
public setup(core: CoreSetup, { embeddable, data }: SetupDeps) {
public setup(core: CoreSetup, { embeddable, unifiedSearch }: SetupDeps) {
embeddable.registerEmbeddableFactory(optionsListPersistableStateServiceFactory());
embeddable.registerEmbeddableFactory(timeSliderPersistableStateServiceFactory());

embeddable.registerEmbeddableFactory(
controlGroupContainerPersistableStateServiceFactory(embeddable)
);

setupOptionsListSuggestionsRoute(core, data.autocomplete.getAutocompleteSettings);
setupOptionsListSuggestionsRoute(core, unifiedSearch.autocomplete.getAutocompleteSettings);
return {};
}

Expand Down
3 changes: 2 additions & 1 deletion src/plugins/controls/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{ "path": "../embeddable/tsconfig.json" },
{ "path": "../presentation_util/tsconfig.json" },
{ "path": "../kibana_react/tsconfig.json" },
{ "path": "../data/tsconfig.json" }
{ "path": "../data/tsconfig.json" },
{ "path": "../unified_search/tsconfig.json" }
]
}
22 changes: 0 additions & 22 deletions src/plugins/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,6 @@
import { schema, TypeOf } from '@kbn/config-schema';

export const configSchema = schema.object({
autocomplete: schema.object({
querySuggestions: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
valueSuggestions: schema.object({
enabled: schema.boolean({ defaultValue: true }),
tiers: schema.arrayOf(
schema.oneOf([
schema.literal('data_content'),
schema.literal('data_hot'),
schema.literal('data_warm'),
schema.literal('data_cold'),
schema.literal('data_frozen'),
]),
{
defaultValue: ['data_hot', 'data_warm', 'data_content', 'data_cold'],
}
),
terminateAfter: schema.duration({ defaultValue: 100000 }),
timeout: schema.duration({ defaultValue: 1000 }),
}),
}),
search: schema.object({
aggs: schema.object({
shardDelay: schema.object({
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"server": true,
"ui": true,
"requiredPlugins": ["bfetch", "expressions", "uiActions", "share", "inspector", "fieldFormats", "dataViews"],
"serviceFolders": ["search", "query", "autocomplete", "ui"],
"serviceFolders": ["search", "query", "ui"],
"optionalPlugins": ["usageCollection", "taskManager", "security"],
"extraPublicDirs": ["common"],
"requiredBundles": ["kibanaUtils", "kibanaReact", "inspector"],
Expand Down
Loading