mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[docs] Adds paragraphs on inter-app navigation with application service (#129421)
This commit is contained in:
parent
735b4c936d
commit
3bb27f21fa
3 changed files with 47 additions and 1 deletions
|
@ -89,6 +89,10 @@ To navigate between different Kibana apps without a page reload there are APIs i
|
|||
* [core.application.navigateToApp](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md)
|
||||
* [core.application.navigateToUrl](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md)
|
||||
|
||||
Both methods offer customization such as opening the target in a new page, with an `options` parameter. All the options are optional be default.
|
||||
* [core.application.navigateToApp options](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md)
|
||||
* [core.application.navigateToUrl options](https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.navigatetourloptions.md)
|
||||
|
||||
*Rendering a link to a different app on its own would also cause a full page reload:*
|
||||
|
||||
```jsx
|
||||
|
@ -124,6 +128,24 @@ const MyApp = () =>
|
|||
</RedirectAppLinks>
|
||||
```
|
||||
|
||||
NOTE: There may be cases where you need a full page reload. While rare and should be avoided, rather than implement your own navigation,
|
||||
you can use the `navigateToUrl` `forceRedirect` option.
|
||||
|
||||
```tsx
|
||||
const MyForcedPageReloadLink = () =>
|
||||
<a
|
||||
href={urlToSomeSpecialApp}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
core.application.navigateToUrl('someSpecialApp', { forceRedirect: true });
|
||||
}}
|
||||
>
|
||||
Go to Some Special App
|
||||
</a>;
|
||||
```
|
||||
|
||||
If you also need to bypass the default onAppLeave behavior, you can set the `skipUnload` option to `true`. This option is also available in `navigateToApp`.
|
||||
|
||||
## Setting up internal app routing
|
||||
|
||||
It is very common for Kibana apps to use React and React Router.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue