* add hasHeaderBanner$ API to chrome * update generated doc Co-authored-by: Pierre Gayvallet <pierre.gayvallet@gmail.com>
This commit is contained in:
parent
d4dbce0e1e
commit
43d55d95dd
|
@ -0,0 +1,17 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [ChromeStart](./kibana-plugin-core-public.chromestart.md) > [hasHeaderBanner$](./kibana-plugin-core-public.chromestart.hasheaderbanner_.md)
|
||||
|
||||
## ChromeStart.hasHeaderBanner$() method
|
||||
|
||||
Get an observable of the current header banner presence state.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hasHeaderBanner$(): Observable<boolean>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`Observable<boolean>`
|
||||
|
|
@ -57,6 +57,7 @@ core.chrome.setHelpExtension(elem => {
|
|||
| [getHelpExtension$()](./kibana-plugin-core-public.chromestart.gethelpextension_.md) | Get an observable of the current custom help conttent |
|
||||
| [getIsNavDrawerLocked$()](./kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md) | Get an observable of the current locked state of the nav drawer. |
|
||||
| [getIsVisible$()](./kibana-plugin-core-public.chromestart.getisvisible_.md) | Get an observable of the current visibility state of the chrome. |
|
||||
| [hasHeaderBanner$()](./kibana-plugin-core-public.chromestart.hasheaderbanner_.md) | Get an observable of the current header banner presence state. |
|
||||
| [setBadge(badge)](./kibana-plugin-core-public.chromestart.setbadge.md) | Override the current badge |
|
||||
| [setBreadcrumbs(newBreadcrumbs)](./kibana-plugin-core-public.chromestart.setbreadcrumbs.md) | Override the current set of breadcrumbs |
|
||||
| [setBreadcrumbsAppendExtension(breadcrumbsAppendExtension)](./kibana-plugin-core-public.chromestart.setbreadcrumbsappendextension.md) | Mount an element next to the last breadcrumb |
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -55,6 +55,7 @@ const createStartContractMock = () => {
|
|||
getCustomNavLink$: jest.fn(),
|
||||
setCustomNavLink: jest.fn(),
|
||||
setHeaderBanner: jest.fn(),
|
||||
hasHeaderBanner$: jest.fn(),
|
||||
getBodyClasses$: jest.fn(),
|
||||
};
|
||||
startContract.navLinks.getAll.mockReturnValue([]);
|
||||
|
@ -66,6 +67,7 @@ const createStartContractMock = () => {
|
|||
startContract.getHelpExtension$.mockReturnValue(new BehaviorSubject(undefined));
|
||||
startContract.getIsNavDrawerLocked$.mockReturnValue(new BehaviorSubject(false));
|
||||
startContract.getBodyClasses$.mockReturnValue(new BehaviorSubject([]));
|
||||
startContract.hasHeaderBanner$.mockReturnValue(new BehaviorSubject(false));
|
||||
return startContract;
|
||||
};
|
||||
|
||||
|
|
|
@ -390,6 +390,19 @@ describe('start', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('header banner', () => {
|
||||
it('updates/emits the state of the header banner', async () => {
|
||||
const { chrome, service } = await start();
|
||||
const promise = chrome.hasHeaderBanner$().pipe(toArray()).toPromise();
|
||||
|
||||
chrome.setHeaderBanner({ content: () => () => undefined });
|
||||
chrome.setHeaderBanner(undefined);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toEqual([false, true, false]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('erase chrome fields', () => {
|
||||
it('while switching an app', async () => {
|
||||
const startDeps = defaultStartDeps([new FakeApp('alpha')]);
|
||||
|
|
|
@ -273,6 +273,13 @@ export class ChromeService {
|
|||
headerBanner$.next(headerBanner);
|
||||
},
|
||||
|
||||
hasHeaderBanner$: () => {
|
||||
return headerBanner$.pipe(
|
||||
takeUntil(this.stop$),
|
||||
map((banner) => Boolean(banner))
|
||||
);
|
||||
},
|
||||
|
||||
getBodyClasses$: () => bodyClasses$.pipe(takeUntil(this.stop$)),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -168,6 +168,11 @@ export interface ChromeStart {
|
|||
* @remarks Using `undefined` when invoking this API will remove the banner.
|
||||
*/
|
||||
setHeaderBanner(headerBanner?: ChromeUserBanner): void;
|
||||
|
||||
/**
|
||||
* Get an observable of the current header banner presence state.
|
||||
*/
|
||||
hasHeaderBanner$(): Observable<boolean>;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
|
|
@ -356,6 +356,7 @@ export interface ChromeStart {
|
|||
getHelpExtension$(): Observable<ChromeHelpExtension | undefined>;
|
||||
getIsNavDrawerLocked$(): Observable<boolean>;
|
||||
getIsVisible$(): Observable<boolean>;
|
||||
hasHeaderBanner$(): Observable<boolean>;
|
||||
navControls: ChromeNavControls;
|
||||
navLinks: ChromeNavLinks;
|
||||
recentlyAccessed: ChromeRecentlyAccessed;
|
||||
|
|
Loading…
Reference in a new issue