diff --git a/docs/development/core/public/kibana-plugin-public.chromenavlink.disablesuburltracking.md b/docs/development/core/public/kibana-plugin-public.chromenavlink.disablesuburltracking.md new file mode 100644 index 0000000000000..0054adc693dc3 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.chromenavlink.disablesuburltracking.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) > [disableSubUrlTracking](./kibana-plugin-public.chromenavlink.disablesuburltracking.md) + +## ChromeNavLink.disableSubUrlTracking property + +> Warning: This API is now obsolete. +> +> + +A flag that tells legacy chrome to ignore the link when tracking sub-urls + +Signature: + +```typescript +readonly disableSubUrlTracking?: boolean; +``` diff --git a/docs/development/core/public/kibana-plugin-public.chromenavlink.md b/docs/development/core/public/kibana-plugin-public.chromenavlink.md index 7e7849b1a1358..810e520badf47 100644 --- a/docs/development/core/public/kibana-plugin-public.chromenavlink.md +++ b/docs/development/core/public/kibana-plugin-public.chromenavlink.md @@ -1,32 +1,33 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) - -## ChromeNavLink interface - - -Signature: - -```typescript -export interface ChromeNavLink -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [active](./kibana-plugin-public.chromenavlink.active.md) | boolean | Indicates whether or not this app is currently on the screen. | -| [baseUrl](./kibana-plugin-public.chromenavlink.baseurl.md) | string | The base route used to open the root of an application. | -| [category](./kibana-plugin-public.chromenavlink.category.md) | AppCategory | The category the app lives in | -| [disabled](./kibana-plugin-public.chromenavlink.disabled.md) | boolean | Disables a link from being clickable. | -| [euiIconType](./kibana-plugin-public.chromenavlink.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | -| [hidden](./kibana-plugin-public.chromenavlink.hidden.md) | boolean | Hides a link from the navigation. | -| [icon](./kibana-plugin-public.chromenavlink.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | -| [id](./kibana-plugin-public.chromenavlink.id.md) | string | A unique identifier for looking up links. | -| [linkToLastSubUrl](./kibana-plugin-public.chromenavlink.linktolastsuburl.md) | boolean | Whether or not the subUrl feature should be enabled. | -| [order](./kibana-plugin-public.chromenavlink.order.md) | number | An ordinal used to sort nav links relative to one another for display. | -| [subUrlBase](./kibana-plugin-public.chromenavlink.suburlbase.md) | string | A url base that legacy apps can set to match deep URLs to an application. | -| [title](./kibana-plugin-public.chromenavlink.title.md) | string | The title of the application. | -| [tooltip](./kibana-plugin-public.chromenavlink.tooltip.md) | string | A tooltip shown when hovering over an app link. | -| [url](./kibana-plugin-public.chromenavlink.url.md) | string | A url that legacy apps can set to deep link into their applications. | - + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) + +## ChromeNavLink interface + + +Signature: + +```typescript +export interface ChromeNavLink +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [active](./kibana-plugin-public.chromenavlink.active.md) | boolean | Indicates whether or not this app is currently on the screen. | +| [baseUrl](./kibana-plugin-public.chromenavlink.baseurl.md) | string | The base route used to open the root of an application. | +| [category](./kibana-plugin-public.chromenavlink.category.md) | AppCategory | The category the app lives in | +| [disabled](./kibana-plugin-public.chromenavlink.disabled.md) | boolean | Disables a link from being clickable. | +| [disableSubUrlTracking](./kibana-plugin-public.chromenavlink.disablesuburltracking.md) | boolean | A flag that tells legacy chrome to ignore the link when tracking sub-urls | +| [euiIconType](./kibana-plugin-public.chromenavlink.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | +| [hidden](./kibana-plugin-public.chromenavlink.hidden.md) | boolean | Hides a link from the navigation. | +| [icon](./kibana-plugin-public.chromenavlink.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | +| [id](./kibana-plugin-public.chromenavlink.id.md) | string | A unique identifier for looking up links. | +| [linkToLastSubUrl](./kibana-plugin-public.chromenavlink.linktolastsuburl.md) | boolean | Whether or not the subUrl feature should be enabled. | +| [order](./kibana-plugin-public.chromenavlink.order.md) | number | An ordinal used to sort nav links relative to one another for display. | +| [subUrlBase](./kibana-plugin-public.chromenavlink.suburlbase.md) | string | A url base that legacy apps can set to match deep URLs to an application. | +| [title](./kibana-plugin-public.chromenavlink.title.md) | string | The title of the application. | +| [tooltip](./kibana-plugin-public.chromenavlink.tooltip.md) | string | A tooltip shown when hovering over an app link. | +| [url](./kibana-plugin-public.chromenavlink.url.md) | string | A url that legacy apps can set to deep link into their applications. | + diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 63e542b0127ed..17fdfc627187e 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -229,6 +229,7 @@ export interface LegacyApp extends AppBase { appUrl: string; subUrlBase?: string; linkToLastSubUrl?: boolean; + disableSubUrlTracking?: boolean; } /** diff --git a/src/core/public/chrome/nav_links/nav_link.ts b/src/core/public/chrome/nav_links/nav_link.ts index 4d3a1e9ecd199..d0ef2aeb265fe 100644 --- a/src/core/public/chrome/nav_links/nav_link.ts +++ b/src/core/public/chrome/nav_links/nav_link.ts @@ -78,6 +78,17 @@ export interface ChromeNavLink { */ readonly subUrlBase?: string; + /** + * A flag that tells legacy chrome to ignore the link when + * tracking sub-urls + * + * @internalRemarks + * This should be removed once legacy apps are gone. + * + * @deprecated + */ + readonly disableSubUrlTracking?: boolean; + /** * Whether or not the subUrl feature should be enabled. * diff --git a/src/core/public/legacy/legacy_service.ts b/src/core/public/legacy/legacy_service.ts index cc3210771eecc..e4788e686dd45 100644 --- a/src/core/public/legacy/legacy_service.ts +++ b/src/core/public/legacy/legacy_service.ts @@ -75,6 +75,7 @@ export class LegacyPlatformService { subUrlBase: navLink.subUrlBase, linkToLastSubUrl: navLink.linkToLastSubUrl, category: navLink.category, + disableSubUrlTracking: navLink.disableSubUrlTracking, }) ); diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 5e36638516e56..8517166ee00e6 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -264,6 +264,8 @@ export interface ChromeNavLink { readonly category?: AppCategory; // @deprecated readonly disabled?: boolean; + // @deprecated + readonly disableSubUrlTracking?: boolean; readonly euiIconType?: string; readonly hidden?: boolean; readonly icon?: string; diff --git a/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts b/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts index a19133c30659b..1c6ab91a39279 100644 --- a/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts +++ b/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts @@ -85,6 +85,7 @@ function getNavLinks(uiExports: LegacyUiExports, pluginSpecs: LegacyPluginSpec[] order: typeof spec.order === 'number' ? spec.order : 0, url: spec.url, subUrlBase: spec.subUrlBase || spec.url, + disableSubUrlTracking: spec.disableSubUrlTracking, icon: spec.icon, euiIconType: spec.euiIconType, linkToLastSub: 'linkToLastSubUrl' in spec ? spec.linkToLastSubUrl : false, diff --git a/src/legacy/ui/public/chrome/api/nav.ts b/src/legacy/ui/public/chrome/api/nav.ts index 5f97e5fa8d55d..771314d9e1481 100644 --- a/src/legacy/ui/public/chrome/api/nav.ts +++ b/src/legacy/ui/public/chrome/api/nav.ts @@ -78,7 +78,7 @@ export function initChromeNavApi(chrome: any, internals: NavInternals) { coreNavLinks .getAll() // Filter only legacy links - .filter(link => link.legacy) + .filter(link => link.legacy && !link.disableSubUrlTracking) .forEach(link => { const active = url.startsWith(link.subUrlBase!); link = coreNavLinks.update(link.id, { active })!; diff --git a/src/legacy/ui/ui_apps/ui_app.js b/src/legacy/ui/ui_apps/ui_app.js index 1cfd54588b516..926db5836e9d1 100644 --- a/src/legacy/ui/ui_apps/ui_app.js +++ b/src/legacy/ui/ui_apps/ui_app.js @@ -31,6 +31,7 @@ export class UiApp { euiIconType, hidden, linkToLastSubUrl, + disableSubUrlTracking, listed, category, url = `/app/${id}`, @@ -47,6 +48,7 @@ export class UiApp { this._icon = icon; this._euiIconType = euiIconType; this._linkToLastSubUrl = linkToLastSubUrl; + this._disableSubUrlTracking = disableSubUrlTracking; this._category = category; this._hidden = hidden; this._listed = listed; @@ -70,6 +72,7 @@ export class UiApp { euiIconType: this._euiIconType, url: this._url, linkToLastSubUrl: this._linkToLastSubUrl, + disableSubUrlTracking: this._disableSubUrlTracking, category: this._category, }); } @@ -118,6 +121,7 @@ export class UiApp { main: this._main, navLink: this._navLink, linkToLastSubUrl: this._linkToLastSubUrl, + disableSubUrlTracking: this._disableSubUrlTracking, category: this._category, }; } diff --git a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js index 543fe05b13e43..27dbec0c2b7bc 100644 --- a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js +++ b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js @@ -49,6 +49,7 @@ describe('UiNavLink', () => { // defaults linkToLastSubUrl: true, + disableSubUrlTracking: undefined, tooltip: '', }); }); diff --git a/src/legacy/ui/ui_nav_links/ui_nav_link.js b/src/legacy/ui/ui_nav_links/ui_nav_link.js index 5888c21a53c95..f56809f7ebb80 100644 --- a/src/legacy/ui/ui_nav_links/ui_nav_link.js +++ b/src/legacy/ui/ui_nav_links/ui_nav_link.js @@ -25,6 +25,7 @@ export class UiNavLink { order = 0, url, subUrlBase, + disableSubUrlTracking, icon, euiIconType, linkToLastSubUrl = true, @@ -39,6 +40,7 @@ export class UiNavLink { this._order = order; this._url = url; this._subUrlBase = subUrlBase || url; + this._disableSubUrlTracking = disableSubUrlTracking; this._icon = icon; this._euiIconType = euiIconType; this._linkToLastSubUrl = linkToLastSubUrl; @@ -62,6 +64,7 @@ export class UiNavLink { icon: this._icon, euiIconType: this._euiIconType, linkToLastSubUrl: this._linkToLastSubUrl, + disableSubUrlTracking: this._disableSubUrlTracking, hidden: this._hidden, disabled: this._disabled, tooltip: this._tooltip,