forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setHeaderActionMenu API to AppMountParameters (elastic#75422)
* add `setHeaderActionMenu` to AppMountParameters * allow to remove the current menu by calling handler with undefined * update generated doc * updating snapshots * fix legacy tests * call renderApp with params * rename toMountPoint component file for consistency * add the MountPointPortal utility component * adapt TopNavMenu to add optional `setMenuMountPoint` prop * add kibanaReact as required bundle. * use innerHTML instead of textContent for portal tests * add error boundaries to portal component * improve renderLayout readability * duplicate wrapper in portal mode to avoid altering styles Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
9fed654
commit 92b97f3
Showing
31 changed files
with
785 additions
and
30 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
...core/public/kibana-plugin-core-public.appmountparameters.setheaderactionmenu.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,39 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [AppMountParameters](./kibana-plugin-core-public.appmountparameters.md) > [setHeaderActionMenu](./kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md) | ||
|
||
## AppMountParameters.setHeaderActionMenu property | ||
|
||
A function that can be used to set the mount point used to populate the application action container in the chrome header. | ||
|
||
Calling the handler multiple time will erase the current content of the action menu with the mount from the latest call. Calling the handler with `undefined` will unmount the current mount point. Calling the handler after the application has been unmounted will have no effect. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
setHeaderActionMenu: (menuMount: MountPoint | undefined) => void; | ||
``` | ||
|
||
## Example | ||
|
||
|
||
```ts | ||
// application.tsx | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { BrowserRouter, Route } from 'react-router-dom'; | ||
|
||
import { CoreStart, AppMountParameters } from 'src/core/public'; | ||
import { MyPluginDepsStart } from './plugin'; | ||
|
||
export renderApp = ({ element, history, setHeaderActionMenu }: AppMountParameters) => { | ||
const { renderApp } = await import('./application'); | ||
const { renderActionMenu } = await import('./action_menu'); | ||
setHeaderActionMenu((element) => { | ||
return renderActionMenu(element); | ||
}) | ||
return renderApp({ element, history }); | ||
} | ||
|
||
``` | ||
|
1 change: 1 addition & 0 deletions
1
src/core/public/application/__snapshots__/application_service.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.