Skip to content

Commit d93e211

Browse files
authored
Add application deep links to global search (#83380)
1 parent 6e88954 commit d93e211

21 files changed

+503
-86
lines changed

docs/development/core/public/kibana-plugin-core-public.app.exactroute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exactRoute?: boolean;
1818
```ts
1919
core.application.register({
2020
id: 'my_app',
21-
title: 'My App'
21+
title: 'My App',
2222
exactRoute: true,
2323
mount: () => { ... },
2424
})

docs/development/core/public/kibana-plugin-core-public.app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface App<HistoryLocationState = unknown>
2727
| [mount](./kibana-plugin-core-public.app.mount.md) | <code>AppMount&lt;HistoryLocationState&gt; &#124; AppMountDeprecated&lt;HistoryLocationState&gt;</code> | A mount function called when the user navigates to this app's route. May have signature of [AppMount](./kibana-plugin-core-public.appmount.md) or [AppMountDeprecated](./kibana-plugin-core-public.appmountdeprecated.md)<!-- -->. |
2828
| [navLinkStatus](./kibana-plugin-core-public.app.navlinkstatus.md) | <code>AppNavLinkStatus</code> | The initial status of the application's navLink. Defaulting to <code>visible</code> if <code>status</code> is <code>accessible</code> and <code>hidden</code> if status is <code>inaccessible</code> See [AppNavLinkStatus](./kibana-plugin-core-public.appnavlinkstatus.md) |
2929
| [order](./kibana-plugin-core-public.app.order.md) | <code>number</code> | An ordinal used to sort nav links relative to one another for display. |
30+
| [searchDeepLinks](./kibana-plugin-core-public.app.searchdeeplinks.md) | <code>AppSearchDeepLink[]</code> | Array of links that represent secondary in-app locations for the app. |
3031
| [status](./kibana-plugin-core-public.app.status.md) | <code>AppStatus</code> | The initial status of the application. Defaulting to <code>accessible</code> |
3132
| [title](./kibana-plugin-core-public.app.title.md) | <code>string</code> | The title of the application. |
3233
| [tooltip](./kibana-plugin-core-public.app.tooltip.md) | <code>string</code> | A tooltip shown when hovering over app link. |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [App](./kibana-plugin-core-public.app.md) &gt; [searchDeepLinks](./kibana-plugin-core-public.app.searchdeeplinks.md)
4+
5+
## App.searchDeepLinks property
6+
7+
Array of links that represent secondary in-app locations for the app.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
searchDeepLinks?: AppSearchDeepLink[];
13+
```
14+
15+
## Remarks
16+
17+
Used to populate navigational search results (where available). Can be updated using the [App.updater$](./kibana-plugin-core-public.app.updater_.md) observable. See for more details.
18+
19+
## Example
20+
21+
The `path` property on deep links should not include the application's `appRoute`<!-- -->:
22+
23+
```ts
24+
core.application.register({
25+
id: 'my_app',
26+
title: 'My App',
27+
searchDeepLinks: [
28+
{ id: 'sub1', title: 'Sub1', path: '/sub1' },
29+
{
30+
id: 'sub2',
31+
title: 'Sub2',
32+
searchDeepLinks: [
33+
{ id: 'subsub', title: 'SubSub', path: '/sub2/sub' }
34+
]
35+
}
36+
],
37+
mount: () => { ... },
38+
})
39+
40+
```
41+
Will produce deep links on these paths: - `/app/my_app/sub1` - `/app/my_app/sub2/sub`
42+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [AppSearchDeepLink](./kibana-plugin-core-public.appsearchdeeplink.md)
4+
5+
## AppSearchDeepLink type
6+
7+
Input type for registering secondary in-app locations for an application.
8+
9+
Deep links must include at least one of `path` or `searchDeepLinks`<!-- -->. A deep link that does not have a `path` represents a topological level in the application's hierarchy, but does not have a destination URL that is user-accessible.
10+
11+
<b>Signature:</b>
12+
13+
```typescript
14+
export declare type AppSearchDeepLink = {
15+
id: string;
16+
title: string;
17+
} & ({
18+
path: string;
19+
searchDeepLinks?: AppSearchDeepLink[];
20+
} | {
21+
path?: string;
22+
searchDeepLinks: AppSearchDeepLink[];
23+
});
24+
```

docs/development/core/public/kibana-plugin-core-public.appupdatablefields.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Defines the list of fields that can be updated via an [AppUpdater](./kibana-plug
99
<b>Signature:</b>
1010

1111
```typescript
12-
export declare type AppUpdatableFields = Pick<App, 'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath'>;
12+
export declare type AppUpdatableFields = Pick<App, 'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' | 'searchDeepLinks'>;
1313
```

docs/development/core/public/kibana-plugin-core-public.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
138138
| [AppLeaveHandler](./kibana-plugin-core-public.appleavehandler.md) | A handler that will be executed before leaving the application, either when going to another application or when closing the browser tab or manually changing the url. Should return <code>confirm</code> to to prompt a message to the user before leaving the page, or <code>default</code> to keep the default behavior (doing nothing).<!-- -->See [AppMountParameters](./kibana-plugin-core-public.appmountparameters.md) for detailed usage examples. |
139139
| [AppMount](./kibana-plugin-core-public.appmount.md) | A mount function called when the user navigates to this app's route. |
140140
| [AppMountDeprecated](./kibana-plugin-core-public.appmountdeprecated.md) | A mount function called when the user navigates to this app's route. |
141+
| [AppSearchDeepLink](./kibana-plugin-core-public.appsearchdeeplink.md) | Input type for registering secondary in-app locations for an application.<!-- -->Deep links must include at least one of <code>path</code> or <code>searchDeepLinks</code>. A deep link that does not have a <code>path</code> represents a topological level in the application's hierarchy, but does not have a destination URL that is user-accessible. |
141142
| [AppUnmount](./kibana-plugin-core-public.appunmount.md) | A function called when an application should be unmounted from the page. This function should be synchronous. |
142143
| [AppUpdatableFields](./kibana-plugin-core-public.appupdatablefields.md) | Defines the list of fields that can be updated via an [AppUpdater](./kibana-plugin-core-public.appupdater.md)<!-- -->. |
143144
| [AppUpdater](./kibana-plugin-core-public.appupdater.md) | Updater for applications. see [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) |
@@ -160,6 +161,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
160161
| [PluginInitializer](./kibana-plugin-core-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
161162
| [PluginOpaqueId](./kibana-plugin-core-public.pluginopaqueid.md) | |
162163
| [PublicAppInfo](./kibana-plugin-core-public.publicappinfo.md) | Public information about a registered [application](./kibana-plugin-core-public.app.md) |
164+
| [PublicAppSearchDeepLinkInfo](./kibana-plugin-core-public.publicappsearchdeeplinkinfo.md) | Public information about a registered app's [searchDeepLinks](./kibana-plugin-core-public.appsearchdeeplink.md) |
163165
| [PublicUiSettingsParams](./kibana-plugin-core-public.publicuisettingsparams.md) | A sub-set of [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) exposed to the client-side. |
164166
| [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
165167
| [SavedObjectAttributeSingle](./kibana-plugin-core-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) |

docs/development/core/public/kibana-plugin-core-public.publicappinfo.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ Public information about a registered [application](./kibana-plugin-core-public.
99
<b>Signature:</b>
1010

1111
```typescript
12-
export declare type PublicAppInfo = Omit<App, 'mount' | 'updater$'> & {
12+
export declare type PublicAppInfo = Omit<App, 'mount' | 'updater$' | 'searchDeepLinks'> & {
1313
status: AppStatus;
1414
navLinkStatus: AppNavLinkStatus;
1515
appRoute: string;
16+
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
1617
};
1718
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [PublicAppSearchDeepLinkInfo](./kibana-plugin-core-public.publicappsearchdeeplinkinfo.md)
4+
5+
## PublicAppSearchDeepLinkInfo type
6+
7+
Public information about a registered app's [searchDeepLinks](./kibana-plugin-core-public.appsearchdeeplink.md)
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export declare type PublicAppSearchDeepLinkInfo = Omit<AppSearchDeepLink, 'searchDeepLinks'> & {
13+
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
14+
};
15+
```

src/core/public/application/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export {
3131
AppNavLinkStatus,
3232
AppUpdatableFields,
3333
AppUpdater,
34+
AppSearchDeepLink,
3435
ApplicationSetup,
3536
ApplicationStart,
3637
AppLeaveHandler,
@@ -40,6 +41,7 @@ export {
4041
AppLeaveConfirmAction,
4142
NavigateToAppOptions,
4243
PublicAppInfo,
44+
PublicAppSearchDeepLinkInfo,
4345
// Internal types
4446
InternalApplicationSetup,
4547
InternalApplicationStart,

src/core/public/application/types.ts

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ export enum AppNavLinkStatus {
8181
* Defines the list of fields that can be updated via an {@link AppUpdater}.
8282
* @public
8383
*/
84-
export type AppUpdatableFields = Pick<App, 'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath'>;
84+
export type AppUpdatableFields = Pick<
85+
App,
86+
'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' | 'searchDeepLinks'
87+
>;
8588

8689
/**
8790
* Updater for applications.
@@ -222,7 +225,7 @@ export interface App<HistoryLocationState = unknown> {
222225
* ```ts
223226
* core.application.register({
224227
* id: 'my_app',
225-
* title: 'My App'
228+
* title: 'My App',
226229
* exactRoute: true,
227230
* mount: () => { ... },
228231
* })
@@ -232,18 +235,89 @@ export interface App<HistoryLocationState = unknown> {
232235
* ```
233236
*/
234237
exactRoute?: boolean;
238+
239+
/**
240+
* Array of links that represent secondary in-app locations for the app.
241+
*
242+
* @remarks
243+
* Used to populate navigational search results (where available).
244+
* Can be updated using the {@link App.updater$} observable. See {@link AppSubLink} for more details.
245+
*
246+
* @example
247+
* The `path` property on deep links should not include the application's `appRoute`:
248+
* ```ts
249+
* core.application.register({
250+
* id: 'my_app',
251+
* title: 'My App',
252+
* searchDeepLinks: [
253+
* { id: 'sub1', title: 'Sub1', path: '/sub1' },
254+
* {
255+
* id: 'sub2',
256+
* title: 'Sub2',
257+
* searchDeepLinks: [
258+
* { id: 'subsub', title: 'SubSub', path: '/sub2/sub' }
259+
* ]
260+
* }
261+
* ],
262+
* mount: () => { ... },
263+
* })
264+
* ```
265+
*
266+
* Will produce deep links on these paths:
267+
* - `/app/my_app/sub1`
268+
* - `/app/my_app/sub2/sub`
269+
*/
270+
searchDeepLinks?: AppSearchDeepLink[];
235271
}
236272

273+
/**
274+
* Input type for registering secondary in-app locations for an application.
275+
*
276+
* Deep links must include at least one of `path` or `searchDeepLinks`. A deep link that does not have a `path`
277+
* represents a topological level in the application's hierarchy, but does not have a destination URL that is
278+
* user-accessible.
279+
* @public
280+
*/
281+
export type AppSearchDeepLink = {
282+
/** Identifier to represent this sublink, should be unique for this application */
283+
id: string;
284+
/** Title to label represent this deep link */
285+
title: string;
286+
} & (
287+
| {
288+
/** URL path to access this link, relative to the application's appRoute. */
289+
path: string;
290+
/** Optional array of links that are 'underneath' this section in the hierarchy */
291+
searchDeepLinks?: AppSearchDeepLink[];
292+
}
293+
| {
294+
/** Optional path to access this section. Omit if this part of the hierarchy does not have a page URL. */
295+
path?: string;
296+
/** Array links that are 'underneath' this section in this hierarchy. */
297+
searchDeepLinks: AppSearchDeepLink[];
298+
}
299+
);
300+
301+
/**
302+
* Public information about a registered app's {@link AppSearchDeepLink | searchDeepLinks}
303+
*
304+
* @public
305+
*/
306+
export type PublicAppSearchDeepLinkInfo = Omit<AppSearchDeepLink, 'searchDeepLinks'> & {
307+
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
308+
};
309+
237310
/**
238311
* Public information about a registered {@link App | application}
239312
*
240313
* @public
241314
*/
242-
export type PublicAppInfo = Omit<App, 'mount' | 'updater$'> & {
315+
export type PublicAppInfo = Omit<App, 'mount' | 'updater$' | 'searchDeepLinks'> & {
243316
// remove optional on fields populated with default values
244317
status: AppStatus;
245318
navLinkStatus: AppNavLinkStatus;
246319
appRoute: string;
320+
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
247321
};
248322

249323
/**

0 commit comments

Comments
 (0)