Skip to content

Commit

Permalink
Allow registered applications to hide Kibana chrome (elastic#49795)
Browse files Browse the repository at this point in the history
* Allow registered applications to hide Kibana chrome

* Fix bug in flipped value of application chromeHidden

* Add additional test for app chrome hidden versus chrome visibility

* Rename chromeHidden to chromeless

* Default chrome service app hidden observable to same value as force hidden

* Consolidate force hiding in chrome, add functional tests

* Move chromeless flag to App interface to prevent legacy applications from specifying

* Address review nits to improve separation
  • Loading branch information
eliperelman committed Nov 13, 2019
1 parent 384b037 commit b73b069
Show file tree
Hide file tree
Showing 14 changed files with 550 additions and 234 deletions.
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; [App](./kibana-plugin-public.app.md) &gt; [chromeless](./kibana-plugin-public.app.chromeless.md)

## App.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;
```
1 change: 1 addition & 0 deletions docs/development/core/public/kibana-plugin-public.app.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export interface App extends AppBase
| Property | Type | Description |
| --- | --- | --- |
| [chromeless](./kibana-plugin-public.app.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. |
| [mount](./kibana-plugin-public.app.mount.md) | <code>(context: AppMountContext, params: AppMountParameters) =&gt; AppUnmount &#124; Promise&lt;AppUnmount&gt;</code> | A mount function called when the user navigates to this app's route. |
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ How to configure react-router with a base path:
export class MyPlugin implements Plugin {
setup({ application }) {
application.register({
id: 'my-app',
async mount(context, params) {
const { renderApp } = await import('./application');
return renderApp(context, params);
},
});
id: 'my-app',
async mount(context, params) {
const { renderApp } = await import('./application');
return renderApp(context, params);
},
});
}
}

```
Expand Down
19 changes: 13 additions & 6 deletions src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export interface App extends AppBase {
* @returns An unmounting function that will be called to unmount the application.
*/
mount: (context: AppMountContext, params: AppMountParameters) => AppUnmount | Promise<AppUnmount>;

/**
* Hide the UI chrome when the application is mounted. Defaults to `false`.
* Takes precedence over chrome service visibility settings.
*/
chromeless?: boolean;
}

/** @internal */
Expand Down Expand Up @@ -145,12 +151,13 @@ export interface AppMountParameters {
* export class MyPlugin implements Plugin {
* setup({ application }) {
* application.register({
* id: 'my-app',
* async mount(context, params) {
* const { renderApp } = await import('./application');
* return renderApp(context, params);
* },
* });
* id: 'my-app',
* async mount(context, params) {
* const { renderApp } = await import('./application');
* return renderApp(context, params);
* },
* });
* }
* }
* ```
*
Expand Down
Loading

0 comments on commit b73b069

Please sign in to comment.