-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Drilldowns] Config to disable URL Drilldown (#77887)
This pr makes sure there is way to disable URL drilldown feature. I decided to extract Url drilldown definition into a separate plugin to benefit from regular disabling a plugin feature. Having it as a separate plugin also makes sense because we will start adding registries specific to URL drilldown implementation Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
0f8043c
commit 4b6d77f
Showing
22 changed files
with
151 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
...public/drilldowns/url_drilldown/README.md → ...lugins/drilldowns/url_drilldown/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
# Basic url drilldown implementation | ||
## URL drilldown | ||
|
||
> NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to `ui_actions_enhanced` plugin. | ||
Url drilldown allows navigating to external URL or to internal kibana URL. | ||
By using variables in url template result url can be dynamic and depend on user's interaction. | ||
|
||
URL drilldown has 3 sources for variables: | ||
|
||
- Global static variables like, for example, `kibanaUrl`. Such variables won’t change depending on a place where url drilldown is used. | ||
- Context variables are dynamic and different depending on where drilldown is created and used. | ||
- Event variables depend on a trigger context. These variables are dynamically extracted from the action context when drilldown is executed. | ||
1. Global static variables like, for example, `kibanaUrl`. Such variables won’t change depending on a place where url drilldown is used. | ||
2. Context variables are dynamic and different depending on where drilldown is created and used. | ||
3. Event variables depend on a trigger context. These variables are dynamically extracted from the action context when drilldown is executed. | ||
|
||
Difference between `event` and `context` variables, is that real `context` variables are available during drilldown creation (e.g. embeddable panel), | ||
but `event` variables mapped from trigger context. Since there is no trigger context during drilldown creation, we have to provide some _mock_ variables for validating and previewing the URL. | ||
|
||
In current implementation url drilldown has to be used inside the embeddable and with `ValueClickTrigger` or `RangeSelectTrigger`. | ||
|
||
- `context` variables extracted from `embeddable` | ||
- `event` variables extracted from `trigger` context | ||
* `context` variables extracted from `embeddable` | ||
* `event` variables extracted from `trigger` context | ||
|
||
In future this basic url drilldown implementation would allow injecting more variables into `context` (e.g. `dashboard` app specific variables) and would allow providing support for new trigger types from outside. | ||
This extensibility improvements are tracked here: https://github.com/elastic/kibana/issues/55324 | ||
|
||
In case a solution app has a use case for url drilldown that has to be different from current basic implementation and | ||
just extending variables list is not enough, then recommendation is to create own custom url drilldown and reuse building blocks from `ui_actions_enhanced`. | ||
just extending variables list is not enough, then recommendation is to create own custom url drilldown and reuse building blocks from `ui_actions_enhanced`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "urlDrilldown", | ||
"version": "kibana", | ||
"server": false, | ||
"ui": true, | ||
"requiredPlugins": ["embeddable", "uiActions", "uiActionsEnhanced"], | ||
"requiredBundles": ["kibanaUtils", "kibanaReact"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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 { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'src/core/public'; | ||
import { EmbeddableSetup, EmbeddableStart } from '../../../../../src/plugins/embeddable/public'; | ||
import { | ||
AdvancedUiActionsSetup, | ||
AdvancedUiActionsStart, | ||
urlDrilldownGlobalScopeProvider, | ||
} from '../../../ui_actions_enhanced/public'; | ||
import { UrlDrilldown } from './lib'; | ||
import { createStartServicesGetter } from '../../../../../src/plugins/kibana_utils/public'; | ||
|
||
export interface SetupDependencies { | ||
embeddable: EmbeddableSetup; | ||
uiActionsEnhanced: AdvancedUiActionsSetup; | ||
} | ||
|
||
export interface StartDependencies { | ||
embeddable: EmbeddableStart; | ||
uiActionsEnhanced: AdvancedUiActionsStart; | ||
} | ||
|
||
// eslint-disable-next-line | ||
export interface SetupContract {} | ||
|
||
// eslint-disable-next-line | ||
export interface StartContract {} | ||
|
||
export class UrlDrilldownPlugin | ||
implements Plugin<SetupContract, StartContract, SetupDependencies, StartDependencies> { | ||
constructor(protected readonly context: PluginInitializerContext) {} | ||
|
||
public setup(core: CoreSetup<StartDependencies>, plugins: SetupDependencies): SetupContract { | ||
const startServices = createStartServicesGetter(core.getStartServices); | ||
plugins.uiActionsEnhanced.registerDrilldown( | ||
new UrlDrilldown({ | ||
getGlobalScope: urlDrilldownGlobalScopeProvider({ core }), | ||
navigateToUrl: (url: string) => | ||
core.getStartServices().then(([{ application }]) => application.navigateToUrl(url)), | ||
getSyntaxHelpDocsLink: () => | ||
startServices().core.docLinks.links.dashboard.urlDrilldownTemplateSyntax, | ||
getVariablesHelpDocsLink: () => | ||
startServices().core.docLinks.links.dashboard.urlDrilldownVariables, | ||
}) | ||
); | ||
|
||
return {}; | ||
} | ||
|
||
public start(core: CoreStart, plugins: StartDependencies): StartContract { | ||
return {}; | ||
} | ||
|
||
public stop() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters