-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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 setHeaderActionMenu API to AppMountParameters #75422
Merged
pgayvallet
merged 23 commits into
elastic:master
from
pgayvallet:kbn-68524-header-app-menu-api
Sep 1, 2020
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
96df7a9
add `setHeaderActionMenu` to AppMountParameters
pgayvallet 4556772
allow to remove the current menu by calling handler with undefined
pgayvallet 96d3494
update generated doc
pgayvallet eb70d9c
updating snapshots
pgayvallet e595519
fix legacy tests
pgayvallet 403a5f1
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet 22fef27
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet d3a2c8e
call renderApp with params
pgayvallet ea91712
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet f777721
Merge branch 'master' into kbn-68524-header-app-menu-api
elasticmachine ab75d27
rename toMountPoint component file for consistency
pgayvallet 20685b3
add the MountPointPortal utility component
pgayvallet 6405ab5
adapt TopNavMenu to add optional `setMenuMountPoint` prop
pgayvallet 70dad1d
add kibanaReact as required bundle.
pgayvallet bdbaa6a
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet 0d02a2c
use innerHTML instead of textContent for portal tests
pgayvallet 530e031
add error boundaries to portal component
pgayvallet e34f402
improve renderLayout readability
pgayvallet 950b2a2
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet 89e3363
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet 7ee6b10
duplicate wrapper in portal mode to avoid altering styles
pgayvallet 339ed72
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet 5759f93
Merge remote-tracking branch 'upstream/master' into kbn-68524-header-…
pgayvallet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not worth doing until after we complete #74911, but it feels like there's a lot of state & update juggling going on in this service now. Seems like it would be better to have a single source of truth that everything else responds to. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and I also think we should wait until legacy mode has been removed to cleanup that thing