Skip to content

Commit 321ff0e

Browse files
committed
Fix types + add better example
1 parent da1cd8e commit 321ff0e

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-6
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +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.<!-- -->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. |
30+
| [searchDeepLinks](./kibana-plugin-core-public.app.searchdeeplinks.md) | <code>AppSearchDeepLink[]</code> | Array of links that represent secondary in-app locations for the app. |
3131
| [status](./kibana-plugin-core-public.app.status.md) | <code>AppStatus</code> | The initial status of the application. Defaulting to <code>accessible</code> |
3232
| [title](./kibana-plugin-core-public.app.title.md) | <code>string</code> | The title of the application. |
3333
| [tooltip](./kibana-plugin-core-public.app.tooltip.md) | <code>string</code> | A tooltip shown when hovering over app link. |

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,37 @@
66

77
Array of links that represent secondary in-app locations for the app.
88

9-
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.
10-
119
<b>Signature:</b>
1210

1311
```typescript
1412
searchDeepLinks?: AppSearchDeepLink[];
1513
```
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+

src/core/public/application/types.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export interface App<HistoryLocationState = unknown> {
225225
* ```ts
226226
* core.application.register({
227227
* id: 'my_app',
228-
* title: 'My App'
228+
* title: 'My App',
229229
* exactRoute: true,
230230
* mount: () => { ... },
231231
* })
@@ -239,8 +239,33 @@ export interface App<HistoryLocationState = unknown> {
239239
/**
240240
* Array of links that represent secondary in-app locations for the app.
241241
*
242+
* @remarks
242243
* Used to populate navigational search results (where available).
243244
* 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`
244269
*/
245270
searchDeepLinks?: AppSearchDeepLink[];
246271
}

src/core/public/chrome/nav_links/to_nav_link.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const app = (props: Partial<PublicAppInfo> = {}): PublicAppInfo => ({
2828
status: AppStatus.accessible,
2929
navLinkStatus: AppNavLinkStatus.default,
3030
appRoute: `/app/some-id`,
31-
subLinks: [],
31+
searchDeepLinks: [],
3232
...props,
3333
});
3434

0 commit comments

Comments
 (0)