diff --git a/x-pack/plugins/discover_enhanced/kibana.json b/x-pack/plugins/discover_enhanced/kibana.json index 25b2a83baf98..704096ce7fca 100644 --- a/x-pack/plugins/discover_enhanced/kibana.json +++ b/x-pack/plugins/discover_enhanced/kibana.json @@ -2,8 +2,9 @@ "id": "discoverEnhanced", "version": "8.0.0", "kibanaVersion": "kibana", - "server": false, + "server": true, "ui": true, "requiredPlugins": ["uiActions", "embeddable", "discover"], - "optionalPlugins": ["share"] + "optionalPlugins": ["share"], + "configPath": ["xpack", "discoverEnhanced"] } diff --git a/x-pack/plugins/discover_enhanced/public/plugin.ts b/x-pack/plugins/discover_enhanced/public/plugin.ts index ea3c1222eb36..9613a9a8e3c8 100644 --- a/x-pack/plugins/discover_enhanced/public/plugin.ts +++ b/x-pack/plugins/discover_enhanced/public/plugin.ts @@ -53,7 +53,11 @@ export interface DiscoverEnhancedStartDependencies { export class DiscoverEnhancedPlugin implements Plugin { - constructor(public readonly initializerContext: PluginInitializerContext) {} + public readonly config: { actions: { exploreDataInChart: { enabled: boolean } } }; + + constructor(protected readonly context: PluginInitializerContext) { + this.config = context.config.get(); + } setup( core: CoreSetup, @@ -68,9 +72,11 @@ export class DiscoverEnhancedPlugin const exploreDataAction = new ExploreDataContextMenuAction(params); uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, exploreDataAction); - const exploreDataChartAction = new ExploreDataChartAction(params); - uiActions.addTriggerAction(SELECT_RANGE_TRIGGER, exploreDataChartAction); - uiActions.addTriggerAction(VALUE_CLICK_TRIGGER, exploreDataChartAction); + if (this.config.actions.exploreDataInChart.enabled) { + const exploreDataChartAction = new ExploreDataChartAction(params); + uiActions.addTriggerAction(SELECT_RANGE_TRIGGER, exploreDataChartAction); + uiActions.addTriggerAction(VALUE_CLICK_TRIGGER, exploreDataChartAction); + } } } diff --git a/x-pack/plugins/discover_enhanced/server/config.ts b/x-pack/plugins/discover_enhanced/server/config.ts new file mode 100644 index 000000000000..becbdee1bfe4 --- /dev/null +++ b/x-pack/plugins/discover_enhanced/server/config.ts @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +import { schema, TypeOf } from '@kbn/config-schema'; +import { PluginConfigDescriptor } from '../../../../src/core/server'; + +export const configSchema = schema.object({ + actions: schema.object({ + exploreDataInChart: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), + }), +}); + +export type ConfigSchema = TypeOf; + +export const config: PluginConfigDescriptor = { + schema: configSchema, + exposeToBrowser: { + actions: true, + }, +}; diff --git a/x-pack/plugins/discover_enhanced/server/index.ts b/x-pack/plugins/discover_enhanced/server/index.ts new file mode 100644 index 000000000000..e361b9fb075e --- /dev/null +++ b/x-pack/plugins/discover_enhanced/server/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { config } from './config'; + +export const plugin = () => ({ + setup() {}, + start() {}, +});