Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ApplicationService app status management #50223

Merged
merged 40 commits into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e87d550
add unimplemented registerAppStatusUpdater & remove observers for app…
pgayvallet Nov 11, 2019
041cef1
adapt NavLinksService to use new application observables
pgayvallet Nov 11, 2019
76ee873
merge availableApps$ and availableLegacyApps$
pgayvallet Nov 11, 2019
f278903
updating core docs
pgayvallet Nov 11, 2019
5dba8fc
adapt the navLink updating methods
pgayvallet Nov 12, 2019
865eec5
filters the inaccessible apps from availableApps$
pgayvallet Nov 12, 2019
09cd6d8
restrict access to navigateToApp depending on app status
pgayvallet Nov 12, 2019
0bde308
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Nov 19, 2019
ccd6344
fixes due to merge
pgayvallet Nov 19, 2019
dd8c438
add statusUpdater$ to AppBase
pgayvallet Nov 19, 2019
038ae4e
export new types
pgayvallet Nov 19, 2019
4aa0e2c
disable navlink depending on app status
pgayvallet Nov 19, 2019
162ec01
update generated doc
pgayvallet Nov 19, 2019
1c76e68
update snapshots for disabled prop
pgayvallet Nov 19, 2019
c5385f0
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Nov 19, 2019
b031186
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Nov 19, 2019
8ace804
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Nov 22, 2019
0bfe560
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Nov 27, 2019
7dca7fa
Address josh review
pgayvallet Nov 27, 2019
a6e9d8f
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Dec 2, 2019
a5852a1
Address review comments
pgayvallet Dec 3, 2019
8ccfc62
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Dec 3, 2019
eee0d44
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Dec 3, 2019
6a0d0c1
fix merge conflicts
pgayvallet Dec 3, 2019
132938b
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Jan 6, 2020
514a362
adapt changes due to merge
pgayvallet Jan 7, 2020
196d183
update generated doc
pgayvallet Jan 7, 2020
ad9ebb8
add comment and fix navlink url for custom url apps
pgayvallet Jan 7, 2020
57be7fd
add AppNavLinkStatus type to split app/navlink states
pgayvallet Jan 7, 2020
1c8d040
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Jan 7, 2020
b1b6159
fix typo
pgayvallet Jan 7, 2020
87a7c40
review comments and improvements
pgayvallet Jan 9, 2020
626493f
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Jan 9, 2020
f2b1e78
add functional tests
pgayvallet Jan 10, 2020
ab73ba3
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Jan 10, 2020
12f469d
update generated docs and migration guide
pgayvallet Jan 10, 2020
f488946
fix wrong type cast on AppsMenuProvider.readLinks
pgayvallet Jan 10, 2020
815617b
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Jan 10, 2020
cd6a2d7
Merge remote-tracking branch 'upstream/master' into kbn-45291-applica…
pgayvallet Jan 12, 2020
b66df7e
properly type return of navigateToApp
pgayvallet Jan 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [chromeless](./kibana-plugin-public.appbase.chromeless.md)

## AppBase.chromeless property

Hide the UI chrome when the application is mounted. Defaults to `false`<!-- -->. Takes precedence over chrome service visibility settings.

<b>Signature:</b>

```typescript
chromeless?: boolean;
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## AppBase.id property

The unique identifier of the application

<b>Signature:</b>

```typescript
Expand Down
8 changes: 6 additions & 2 deletions docs/development/core/public/kibana-plugin-public.appbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ export interface AppBase
| Property | Type | Description |
| --- | --- | --- |
| [capabilities](./kibana-plugin-public.appbase.capabilities.md) | <code>Partial&lt;Capabilities&gt;</code> | Custom capabilities defined by the app. |
| [chromeless](./kibana-plugin-public.appbase.chromeless.md) | <code>boolean</code> | Hide the UI chrome when the application is mounted. Defaults to <code>false</code>. Takes precedence over chrome service visibility settings. |
| [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | <code>string</code> | A EUI iconType that will be used for the app's icon. This icon takes precendence over the <code>icon</code> property. |
| [icon](./kibana-plugin-public.appbase.icon.md) | <code>string</code> | A URL to an image file used as an icon. Used as a fallback if <code>euiIconType</code> is not provided. |
| [id](./kibana-plugin-public.appbase.id.md) | <code>string</code> | |
| [id](./kibana-plugin-public.appbase.id.md) | <code>string</code> | The unique identifier of the application |
| [navLinkStatus](./kibana-plugin-public.appbase.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-public.appnavlinkstatus.md) |
| [order](./kibana-plugin-public.appbase.order.md) | <code>number</code> | An ordinal used to sort nav links relative to one another for display. |
| [status](./kibana-plugin-public.appbase.status.md) | <code>AppStatus</code> | The initial status of the application. Defaulting to <code>accessible</code> |
| [title](./kibana-plugin-public.appbase.title.md) | <code>string</code> | The title of the application. |
| [tooltip$](./kibana-plugin-public.appbase.tooltip_.md) | <code>Observable&lt;string&gt;</code> | An observable for a tooltip shown when hovering over app link. |
| [tooltip](./kibana-plugin-public.appbase.tooltip.md) | <code>string</code> | A tooltip shown when hovering over app link. |
| [updater$](./kibana-plugin-public.appbase.updater_.md) | <code>Observable&lt;AppUpdater&gt;</code> | An [AppUpdater](./kibana-plugin-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) at runtime. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [navLinkStatus](./kibana-plugin-public.appbase.navlinkstatus.md)

## AppBase.navLinkStatus property

The initial status of the application's navLink. Defaulting to `visible` if `status` is `accessible` and `hidden` if status is `inaccessible` See [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md)

<b>Signature:</b>

```typescript
navLinkStatus?: AppNavLinkStatus;
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [tooltip$](./kibana-plugin-public.appbase.tooltip_.md)
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [status](./kibana-plugin-public.appbase.status.md)

## AppBase.tooltip$ property
## AppBase.status property

An observable for a tooltip shown when hovering over app link.
The initial status of the application. Defaulting to `accessible`

<b>Signature:</b>

```typescript
tooltip$?: Observable<string>;
status?: AppStatus;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [tooltip](./kibana-plugin-public.appbase.tooltip.md)

## AppBase.tooltip property

A tooltip shown when hovering over app link.

<b>Signature:</b>

```typescript
tooltip?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [updater$](./kibana-plugin-public.appbase.updater_.md)

## AppBase.updater$ property

An [AppUpdater](./kibana-plugin-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) at runtime.

<b>Signature:</b>

```typescript
updater$?: Observable<AppUpdater>;
```

## Example

How to update an application navLink at runtime

```ts
// inside your plugin's setup function
export class MyPlugin implements Plugin {
private appUpdater = new BehaviorSubject<AppUpdater>(() => ({}));

setup({ application }) {
application.register({
id: 'my-app',
title: 'My App',
updater$: this.appUpdater,
async mount(params) {
const { renderApp } = await import('./application');
return renderApp(params);
},
});
}

start() {
// later, when the navlink needs to be updated
appUpdater.next(() => {
navLinkStatus: AppNavLinkStatus.disabled,
})
}

```

Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export interface ApplicationSetup
| Method | Description |
| --- | --- |
| [register(app)](./kibana-plugin-public.applicationsetup.register.md) | Register an mountable application to the system. |
| [registerAppUpdater(appUpdater$)](./kibana-plugin-public.applicationsetup.registerappupdater.md) | Register an application updater that can be used to change the [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) fields of all applications at runtime.<!-- -->This is meant to be used by plugins that needs to updates the whole list of applications. To only updates a specific application, use the <code>updater$</code> property of the registered application instead. |
| [registerMountContext(contextName, provider)](./kibana-plugin-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md)<!-- -->. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) &gt; [registerAppUpdater](./kibana-plugin-public.applicationsetup.registerappupdater.md)

## ApplicationSetup.registerAppUpdater() method

Register an application updater that can be used to change the [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) fields of all applications at runtime.

This is meant to be used by plugins that needs to updates the whole list of applications. To only updates a specific application, use the `updater$` property of the registered application instead.

<b>Signature:</b>

```typescript
registerAppUpdater(appUpdater$: Observable<AppUpdater>): void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| appUpdater$ | <code>Observable&lt;AppUpdater&gt;</code> | |

<b>Returns:</b>

`void`

## Example

How to register an application updater that disables some applications:

```ts
// inside your plugin's setup function
export class MyPlugin implements Plugin {
setup({ application }) {
application.registerAppUpdater(
new BehaviorSubject<AppUpdater>(app => {
if (myPluginApi.shouldDisable(app))
return {
status: AppStatus.inaccessible,
};
})
);
}
}

```

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md)

## AppNavLinkStatus enum

Status of the application's navLink.

<b>Signature:</b>

```typescript
export declare enum AppNavLinkStatus
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| default | <code>0</code> | The application navLink will be <code>visible</code> if the application's [AppStatus](./kibana-plugin-public.appstatus.md) is set to <code>accessible</code> and <code>hidden</code> if the application status is set to <code>inaccessible</code>. |
| disabled | <code>2</code> | The application navLink is visible but inactive and not clickable in the navigation bar. |
| hidden | <code>3</code> | The application navLink does not appear in the navigation bar. |
| visible | <code>1</code> | The application navLink is visible and clickable in the navigation bar. |

21 changes: 21 additions & 0 deletions docs/development/core/public/kibana-plugin-public.appstatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppStatus](./kibana-plugin-public.appstatus.md)

## AppStatus enum

Accessibility status of an application.

<b>Signature:</b>

```typescript
export declare enum AppStatus
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| accessible | <code>0</code> | Application is accessible. |
| inaccessible | <code>1</code> | Application is not accessible. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md)

## AppUpdatableFields type

Defines the list of fields that can be updated via an [AppUpdater](./kibana-plugin-public.appupdater.md)<!-- -->.

<b>Signature:</b>

```typescript
export declare type AppUpdatableFields = Pick<AppBase, 'status' | 'navLinkStatus' | 'tooltip'>;
```
13 changes: 13 additions & 0 deletions docs/development/core/public/kibana-plugin-public.appupdater.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [AppUpdater](./kibana-plugin-public.appupdater.md)

## AppUpdater type

Updater for applications. see [ApplicationSetup](./kibana-plugin-public.applicationsetup.md)

<b>Signature:</b>

```typescript
export declare type AppUpdater = (app: AppBase) => Partial<AppUpdatableFields> | undefined;
```
Loading