Skip to content

Commit

Permalink
Rename to searchDeepLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Nov 30, 2020
1 parent f1dd7a9 commit 6460c07
Show file tree
Hide file tree
Showing 19 changed files with 163 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export interface App<HistoryLocationState = unknown>
| [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)<!-- -->. |
| [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) |
| [order](./kibana-plugin-core-public.app.order.md) | <code>number</code> | An ordinal used to sort nav links relative to one another for display. |
| [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. |
| [status](./kibana-plugin-core-public.app.status.md) | <code>AppStatus</code> | The initial status of the application. Defaulting to <code>accessible</code> |
| [subLinks](./kibana-plugin-core-public.app.sublinks.md) | <code>AppSubLink[]</code> | Array of links that represent secondary in-app locations for the given app.<!-- -->Can be updated using the [App.updater$](./kibana-plugin-core-public.app.updater_.md) observable. See [AppSubLink](./kibana-plugin-core-public.appsublink.md) for more details. |
| [title](./kibana-plugin-core-public.app.title.md) | <code>string</code> | The title of the application. |
| [tooltip](./kibana-plugin-core-public.app.tooltip.md) | <code>string</code> | A tooltip shown when hovering over app link. |
| [updater$](./kibana-plugin-core-public.app.updater_.md) | <code>Observable&lt;AppUpdater&gt;</code> | An [AppUpdater](./kibana-plugin-core-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-core-public.appupdatablefields.md) at runtime. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [App](./kibana-plugin-core-public.app.md) &gt; [subLinks](./kibana-plugin-core-public.app.sublinks.md)
[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)

## App.subLinks property
## App.searchDeepLinks property

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

Can be updated using the [App.updater$](./kibana-plugin-core-public.app.updater_.md) observable. See [AppSubLink](./kibana-plugin-core-public.appsublink.md) for more details.
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.

<b>Signature:</b>

```typescript
subLinks?: AppSubLink[];
searchDeepLinks?: AppSearchDeepLink[];
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [AppSearchDeepLink](./kibana-plugin-core-public.appsearchdeeplink.md)

## AppSearchDeepLink type

Input type for registering secondary in-app locations for an application.

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.

<b>Signature:</b>

```typescript
export declare type AppSearchDeepLink = {
id: string;
title: string;
} & ({
path: string;
searchDeepLinks?: AppSearchDeepLink[];
} | {
path?: string;
searchDeepLinks: AppSearchDeepLink[];
});
```

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Defines the list of fields that can be updated via an [AppUpdater](./kibana-plug
<b>Signature:</b>

```typescript
export declare type AppUpdatableFields = Pick<App, 'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' | 'subLinks'>;
export declare type AppUpdatableFields = Pick<App, 'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' | 'searchDeepLinks'>;
```
4 changes: 2 additions & 2 deletions docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [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. |
| [AppMount](./kibana-plugin-core-public.appmount.md) | A mount function called when the user navigates to this app's route. |
| [AppMountDeprecated](./kibana-plugin-core-public.appmountdeprecated.md) | A mount function called when the user navigates to this app's route. |
| [AppSubLink](./kibana-plugin-core-public.appsublink.md) | Input type for registering secondary in-app locations for an application.<!-- -->Sublinks must include at least one of <code>path</code> or <code>subLinks</code>. A sublink 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.<!-- -->Used to populate navigational search results (where available). |
| [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. |
| [AppUnmount](./kibana-plugin-core-public.appunmount.md) | A function called when an application should be unmounted from the page. This function should be synchronous. |
| [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)<!-- -->. |
| [AppUpdater](./kibana-plugin-core-public.appupdater.md) | Updater for applications. see [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) |
Expand All @@ -161,7 +161,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [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. |
| [PluginOpaqueId](./kibana-plugin-core-public.pluginopaqueid.md) | |
| [PublicAppInfo](./kibana-plugin-core-public.publicappinfo.md) | Public information about a registered [application](./kibana-plugin-core-public.app.md) |
| [PublicAppSubLinkInfo](./kibana-plugin-core-public.publicappsublinkinfo.md) | Public information about a registered app's [subLinks](./kibana-plugin-core-public.appsublink.md) |
| [PublicAppSearchDeepLinkInfo](./kibana-plugin-core-public.publicappsearchdeeplinkinfo.md) | Public information about a registered app's [searchDeepLinks](./kibana-plugin-core-public.appsearchdeeplink.md) |
| [PublicUiSettingsParams](./kibana-plugin-core-public.publicuisettingsparams.md) | A sub-set of [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) exposed to the client-side. |
| [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
| [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) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Public information about a registered [application](./kibana-plugin-core-public.
<b>Signature:</b>

```typescript
export declare type PublicAppInfo = Omit<App, 'mount' | 'updater$' | 'subLinks'> & {
export declare type PublicAppInfo = Omit<App, 'mount' | 'updater$' | 'searchDeepLinks'> & {
status: AppStatus;
navLinkStatus: AppNavLinkStatus;
appRoute: string;
subLinks: PublicAppSubLinkInfo[];
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
};
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [PublicAppSearchDeepLinkInfo](./kibana-plugin-core-public.publicappsearchdeeplinkinfo.md)

## PublicAppSearchDeepLinkInfo type

Public information about a registered app's [searchDeepLinks](./kibana-plugin-core-public.appsearchdeeplink.md)

<b>Signature:</b>

```typescript
export declare type PublicAppSearchDeepLinkInfo = Omit<AppSearchDeepLink, 'searchDeepLinks'> & {
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
};
```

This file was deleted.

4 changes: 2 additions & 2 deletions src/core/public/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export {
AppNavLinkStatus,
AppUpdatableFields,
AppUpdater,
AppSubLink,
AppSearchDeepLink,
ApplicationSetup,
ApplicationStart,
AppLeaveHandler,
Expand All @@ -41,7 +41,7 @@ export {
AppLeaveConfirmAction,
NavigateToAppOptions,
PublicAppInfo,
PublicAppSubLinkInfo,
PublicAppSearchDeepLinkInfo,
// Internal types
InternalApplicationSetup,
InternalApplicationStart,
Expand Down
32 changes: 16 additions & 16 deletions src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export enum AppNavLinkStatus {
*/
export type AppUpdatableFields = Pick<
App,
'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' | 'subLinks'
'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' | 'searchDeepLinks'
>;

/**
Expand Down Expand Up @@ -237,62 +237,62 @@ export interface App<HistoryLocationState = unknown> {
exactRoute?: boolean;

/**
* Array of links that represent secondary in-app locations for the given app.
* 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 {@link App.updater$} observable. See {@link AppSubLink} for more details.
*/
subLinks?: AppSubLink[];
searchDeepLinks?: AppSearchDeepLink[];
}

/**
* Input type for registering secondary in-app locations for an application.
*
* Sublinks must include at least one of `path` or `subLinks`. A sublink 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.
*
* Used to populate navigational search results (where available).
* 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.
* @public
*/
export type AppSubLink = {
export type AppSearchDeepLink = {
/** Identifier to represent this sublink, should be unique for this application */
id: string;
/** Title to label represent this sublink */
/** Title to label represent this deep link */
title: string;
} & (
| {
/** URL path to access this link, relative to the application's appRoute. */
path: string;
/** Optional array of links that are 'underneath' this section in the hierarchy */
subLinks?: AppSubLink[];
searchDeepLinks?: AppSearchDeepLink[];
}
| {
/** Optional path to access this section. Omit if this part of the hierarchy does not have a page URL. */
path?: string;
/** Array links that are 'underneath' this section in this hierarchy. */
subLinks: AppSubLink[];
searchDeepLinks: AppSearchDeepLink[];
}
);

/**
* Public information about a registered app's {@link AppSubLink | subLinks}
* Public information about a registered app's {@link AppSearchDeepLink | searchDeepLinks}
*
* @public
*/
export type PublicAppSubLinkInfo = Omit<AppSubLink, 'subLinks'> & {
subLinks: PublicAppSubLinkInfo[];
export type PublicAppSearchDeepLinkInfo = Omit<AppSearchDeepLink, 'searchDeepLinks'> & {
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
};

/**
* Public information about a registered {@link App | application}
*
* @public
*/
export type PublicAppInfo = Omit<App, 'mount' | 'updater$' | 'subLinks'> & {
export type PublicAppInfo = Omit<App, 'mount' | 'updater$' | 'searchDeepLinks'> & {
// remove optional on fields populated with default values
status: AppStatus;
navLinkStatus: AppNavLinkStatus;
appRoute: string;
subLinks: PublicAppSubLinkInfo[];
searchDeepLinks: PublicAppSearchDeepLinkInfo[];
};

/**
Expand Down
14 changes: 7 additions & 7 deletions src/core/public/application/utils/get_app_info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ describe('getAppInfo', () => {
status: AppStatus.accessible,
navLinkStatus: AppNavLinkStatus.visible,
appRoute: `/app/some-id`,
subLinks: [],
searchDeepLinks: [],
});
});

it('populates default values for nested subLinks', () => {
it('populates default values for nested searchDeepLinks', () => {
const app = createApp({
subLinks: [
searchDeepLinks: [
{
id: 'sub-id',
title: 'sub-title',
subLinks: [{ id: 'sub-sub-id', title: 'sub-sub-title', path: '/sub-sub' }],
searchDeepLinks: [{ id: 'sub-sub-id', title: 'sub-sub-title', path: '/sub-sub' }],
},
],
});
Expand All @@ -65,16 +65,16 @@ describe('getAppInfo', () => {
status: AppStatus.accessible,
navLinkStatus: AppNavLinkStatus.visible,
appRoute: `/app/some-id`,
subLinks: [
searchDeepLinks: [
{
id: 'sub-id',
title: 'sub-title',
subLinks: [
searchDeepLinks: [
{
id: 'sub-sub-id',
title: 'sub-sub-title',
path: '/sub-sub',
subLinks: [], // default empty array added
searchDeepLinks: [], // default empty array added
},
],
},
Expand Down
31 changes: 18 additions & 13 deletions src/core/public/application/utils/get_app_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
App,
AppNavLinkStatus,
AppStatus,
AppSubLink,
AppSearchDeepLink,
PublicAppInfo,
PublicAppSubLinkInfo,
PublicAppSearchDeepLinkInfo,
} from '../types';

export function getAppInfo(app: App): PublicAppInfo {
Expand All @@ -39,21 +39,26 @@ export function getAppInfo(app: App): PublicAppInfo {
status: app.status!,
navLinkStatus,
appRoute: app.appRoute!,
subLinks: getSubLinkInfos(app, app.subLinks),
searchDeepLinks: getSearchDeepLinkInfos(app, app.searchDeepLinks),
};
}

function getSubLinkInfos(app: App, subLinks?: AppSubLink[]): PublicAppSubLinkInfo[] {
if (!subLinks) {
function getSearchDeepLinkInfos(
app: App,
searchDeepLinks?: AppSearchDeepLink[]
): PublicAppSearchDeepLinkInfo[] {
if (!searchDeepLinks) {
return [];
}

return subLinks.map((rawSubLink) => {
return {
id: rawSubLink.id,
title: rawSubLink.title,
path: rawSubLink.path,
subLinks: getSubLinkInfos(app, rawSubLink.subLinks),
};
});
return searchDeepLinks.map(
(rawDeepLink): PublicAppSearchDeepLinkInfo => {
return {
id: rawDeepLink.id,
title: rawDeepLink.title,
path: rawDeepLink.path,
searchDeepLinks: getSearchDeepLinkInfos(app, rawDeepLink.searchDeepLinks),
};
}
);
}
4 changes: 2 additions & 2 deletions src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ export {
AppNavLinkStatus,
AppUpdatableFields,
AppUpdater,
AppSubLink,
AppSearchDeepLink,
PublicAppInfo,
PublicAppSubLinkInfo,
PublicAppSearchDeepLinkInfo,
ScopedHistory,
NavigateToAppOptions,
} from './application';
Expand Down
Loading

0 comments on commit 6460c07

Please sign in to comment.