Skip to content

Commit a8101bd

Browse files
[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 <elasticmachine@users.noreply.github.com>
1 parent 2da221e commit a8101bd

22 files changed

Lines changed: 151 additions & 36 deletions

File tree

docs/developer/plugin-list.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,10 @@ in their infrastructure.
504504
|Contains HTTP endpoints and UiSettings that are slated for removal.
505505
506506
507+
|{kib-repo}blob/{branch}/x-pack/plugins/drilldowns/url_drilldown/README.md[urlDrilldown]
508+
|NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin.
509+
510+
507511
|===
508512
509513
include::{kibana-root}/src/plugins/dashboard/README.asciidoc[leveloffset=+1]

docs/user/dashboard/url-drilldown.asciidoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,14 @@ Tip: Consider using <<helpers, date>> helper for date formatting.
238238
| Aggregation field behind the selected range, if available.
239239

240240
|===
241+
242+
[float]
243+
[[disable]]
244+
==== Disable URL drilldown
245+
246+
You can disable URL drilldown feature on your {kib} instance by disabling the plugin:
247+
248+
["source","yml"]
249+
-----------
250+
url_drilldown.enabled: false
251+
-----------

src/plugins/ui_actions/public/mocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const createStartContract = (): Start => {
4848
executeTriggerActions: jest.fn(),
4949
fork: jest.fn(),
5050
getAction: jest.fn(),
51+
hasAction: jest.fn(),
5152
getTrigger: jest.fn(),
5253
getTriggerActions: jest.fn((id: TriggerId) => []),
5354
getTriggerCompatibleActions: jest.fn(),

src/plugins/ui_actions/public/service/ui_actions_service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export class UiActionsService {
9999
this.actions.delete(actionId);
100100
};
101101

102+
public readonly hasAction = (actionId: string): boolean => {
103+
return this.actions.has(actionId);
104+
};
105+
102106
public readonly attachAction = <T extends TriggerId>(triggerId: T, actionId: string): void => {
103107
const trigger = this.triggers.get(triggerId);
104108

x-pack/.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
5656
"xpack.upgradeAssistant": "plugins/upgrade_assistant",
5757
"xpack.uptime": ["plugins/uptime"],
58+
"xpack.urlDrilldown": "plugins/drilldowns/url_drilldown",
5859
"xpack.watcher": "plugins/watcher",
5960
"xpack.observability": "plugins/observability"
6061
},

x-pack/plugins/embeddable_enhanced/public/drilldowns/url_drilldown/README.md renamed to x-pack/plugins/drilldowns/url_drilldown/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
# Basic url drilldown implementation
1+
## URL drilldown
2+
3+
> NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to `ui_actions_enhanced` plugin.
24
35
Url drilldown allows navigating to external URL or to internal kibana URL.
46
By using variables in url template result url can be dynamic and depend on user's interaction.
57

68
URL drilldown has 3 sources for variables:
79

8-
- Global static variables like, for example, `kibanaUrl`. Such variables won’t change depending on a place where url drilldown is used.
9-
- Context variables are dynamic and different depending on where drilldown is created and used.
10-
- Event variables depend on a trigger context. These variables are dynamically extracted from the action context when drilldown is executed.
10+
1. Global static variables like, for example, `kibanaUrl`. Such variables won’t change depending on a place where url drilldown is used.
11+
2. Context variables are dynamic and different depending on where drilldown is created and used.
12+
3. Event variables depend on a trigger context. These variables are dynamically extracted from the action context when drilldown is executed.
1113

1214
Difference between `event` and `context` variables, is that real `context` variables are available during drilldown creation (e.g. embeddable panel),
1315
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.
1416

1517
In current implementation url drilldown has to be used inside the embeddable and with `ValueClickTrigger` or `RangeSelectTrigger`.
1618

17-
- `context` variables extracted from `embeddable`
18-
- `event` variables extracted from `trigger` context
19+
* `context` variables extracted from `embeddable`
20+
* `event` variables extracted from `trigger` context
1921

2022
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.
2123
This extensibility improvements are tracked here: https://github.com/elastic/kibana/issues/55324
2224

2325
In case a solution app has a use case for url drilldown that has to be different from current basic implementation and
24-
just extending variables list is not enough, then recommendation is to create own custom url drilldown and reuse building blocks from `ui_actions_enhanced`.
26+
just extending variables list is not enough, then recommendation is to create own custom url drilldown and reuse building blocks from `ui_actions_enhanced`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "urlDrilldown",
3+
"version": "kibana",
4+
"server": false,
5+
"ui": true,
6+
"requiredPlugins": ["embeddable", "uiActions", "uiActionsEnhanced"],
7+
"requiredBundles": ["kibanaUtils", "kibanaReact"]
8+
}

x-pack/plugins/embeddable_enhanced/public/drilldowns/index.ts renamed to x-pack/plugins/drilldowns/url_drilldown/public/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
export * from './url_drilldown';
7+
import { PluginInitializerContext } from 'src/core/public';
8+
import { UrlDrilldownPlugin } from './plugin';
9+
10+
export function plugin(context: PluginInitializerContext) {
11+
return new UrlDrilldownPlugin(context);
12+
}

x-pack/plugins/embeddable_enhanced/public/drilldowns/url_drilldown/i18n.ts renamed to x-pack/plugins/drilldowns/url_drilldown/public/lib/i18n.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
import { i18n } from '@kbn/i18n';
88

9-
export const txtUrlDrilldownDisplayName = i18n.translate(
10-
'xpack.embeddableEnhanced.drilldowns.urlDrilldownDisplayName',
11-
{
12-
defaultMessage: 'Go to URL',
13-
}
14-
);
9+
export const txtUrlDrilldownDisplayName = i18n.translate('xpack.urlDrilldown.DisplayName', {
10+
defaultMessage: 'Go to URL',
11+
});

x-pack/plugins/embeddable_enhanced/public/drilldowns/url_drilldown/index.ts renamed to x-pack/plugins/drilldowns/url_drilldown/public/lib/index.ts

File renamed without changes.

0 commit comments

Comments
 (0)