"Explore underlying data" in-chart action kibana.yml flag (#70045)

* refactor: 💡 rename folder to "explore_data"

* style: 💄 check for "share" plugin in more semantic way

"explore data" actions use Discover URL generator, which is registered
in "share" plugin, which is optional plugin, so we check for its
existance, because otherwise URL generator is not available.

* refactor: 💡 move KibanaURL to a separate file

* feat: 🎸 add "Explore underlying data" in-chart action

* fix: 🐛 fix imports after refactor

* feat: 🎸 add start.filtersFromContext to embeddable plugin

* feat: 🎸 add type checkers to data plugin

* feat: 🎸 better handle empty filters in Discover URL generator

* feat: 🎸 implement .getUrl() method of explore data in-chart act

* feat: 🎸 add embeddable.filtersAndTimeRangeFromContext()

* feat: 🎸 improve getUrl() method of explore data action

* test: 💍 update test mock

* fix possible stale hashHistory.location in discover

* style: 💄 ensureHashHistoryLocation -> syncHistoryLocations

* docs: ✏️ update autogenerated docs

* test: 💍 add in-chart "Explore underlying data" unit tests

* test: 💍 add in-chart "Explore underlying data" functional tests

* test: 💍 clean-up custom time range after panel action tests

* chore: 🤖 fix embeddable plugin mocks

* chore: 🤖 fix another mock

* test: 💍 add support for new action to pie chart service

* feat: 🎸 add kibana.yml to disable in-chart "explore data" actio

Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Vadim Dalecky 2020-06-29 08:47:08 -07:00 committed by GitHub
parent 28b70923df
commit 9f6ad5a8d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 6 deletions

View file

@ -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"]
}

View file

@ -53,7 +53,11 @@ export interface DiscoverEnhancedStartDependencies {
export class DiscoverEnhancedPlugin
implements
Plugin<void, void, DiscoverEnhancedSetupDependencies, DiscoverEnhancedStartDependencies> {
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<DiscoverEnhancedStartDependencies>,
@ -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);
}
}
}

View file

@ -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<typeof configSchema>;
export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
exposeToBrowser: {
actions: true,
},
};

View file

@ -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() {},
});