-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ApplicationService app status management (#50223)
* add unimplemented registerAppStatusUpdater & remove observers for apps and legacyApps * adapt NavLinksService to use new application observables * merge availableApps$ and availableLegacyApps$ * updating core docs * adapt the navLink updating methods * filters the inaccessible apps from availableApps$ * restrict access to navigateToApp depending on app status * fixes due to merge * add statusUpdater$ to AppBase * export new types * disable navlink depending on app status * update generated doc * update snapshots for disabled prop * Address josh review * Address review comments * fix merge conflicts * adapt changes due to merge * update generated doc * add comment and fix navlink url for custom url apps * add AppNavLinkStatus type to split app/navlink states * fix typo * review comments and improvements * add functional tests * update generated docs and migration guide * fix wrong type cast on AppsMenuProvider.readLinks * properly type return of navigateToApp
- Loading branch information
1 parent
794bb02
commit aeebedf
Showing
75 changed files
with
1,798 additions
and
581 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
docs/development/core/public/kibana-plugin-public.appbase.chromeless.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [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; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
|
||
## AppBase.id property | ||
|
||
The unique identifier of the application | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
docs/development/core/public/kibana-plugin-public.appbase.navlinkstatus.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [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; | ||
``` |
8 changes: 4 additions & 4 deletions
8
.../kibana-plugin-public.appbase.tooltip_.md → ...ic/kibana-plugin-public.appbase.status.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [tooltip$](./kibana-plugin-public.appbase.tooltip_.md) | ||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [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; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/development/core/public/kibana-plugin-public.appbase.tooltip.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [tooltip](./kibana-plugin-public.appbase.tooltip.md) | ||
|
||
## AppBase.tooltip property | ||
|
||
A tooltip shown when hovering over app link. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
tooltip?: string; | ||
``` |
44 changes: 44 additions & 0 deletions
44
docs/development/core/public/kibana-plugin-public.appbase.updater_.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [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, | ||
}) | ||
} | ||
|
||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...lopment/core/public/kibana-plugin-public.applicationsetup.registerappupdater.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) > [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<AppUpdater></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, | ||
}; | ||
}) | ||
); | ||
} | ||
} | ||
|
||
``` | ||
|
23 changes: 23 additions & 0 deletions
23
docs/development/core/public/kibana-plugin-public.appnavlinkstatus.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [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
21
docs/development/core/public/kibana-plugin-public.appstatus.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [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. | | ||
|
13 changes: 13 additions & 0 deletions
13
docs/development/core/public/kibana-plugin-public.appupdatablefields.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [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
13
docs/development/core/public/kibana-plugin-public.appupdater.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-public](./kibana-plugin-public.md) > [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; | ||
``` |
Oops, something went wrong.