[8.8] [Search Application] Fix doc link in navigation toolbar (#158203) (#158453)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Search Application] Fix doc link in navigation toolbar
(#158203)](https://github.com/elastic/kibana/pull/158203)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Yan
Savitski","email":"yan.savitski@elastic.co"},"sourceCommit":{"committedDate":"2023-05-23T01:53:07Z","message":"[Search
Application] Fix doc link in navigation toolbar (#158203)\n\n- Fix the
way of using setActionMenu. According their doc and source\r\ncode we
need to call it twice, for moun and unmount.\r\n- Fix redirection issue
and using reactDom in rendering of action items\r\n\r\n<img
width=\"926\"
alt=\"image\"\r\nsrc=\"1e531299-e055-4af1-8ec7-92511e1a6e81\">","sha":"1b0a1ec30cde7355fe30445df8c0e96149c68e74","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.8.0","v8.9.0"],"number":158203,"url":"https://github.com/elastic/kibana/pull/158203","mergeCommit":{"message":"[Search
Application] Fix doc link in navigation toolbar (#158203)\n\n- Fix the
way of using setActionMenu. According their doc and source\r\ncode we
need to call it twice, for moun and unmount.\r\n- Fix redirection issue
and using reactDom in rendering of action items\r\n\r\n<img
width=\"926\"
alt=\"image\"\r\nsrc=\"1e531299-e055-4af1-8ec7-92511e1a6e81\">","sha":"1b0a1ec30cde7355fe30445df8c0e96149c68e74"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158203","number":158203,"mergeCommit":{"message":"[Search
Application] Fix doc link in navigation toolbar (#158203)\n\n- Fix the
way of using setActionMenu. According their doc and source\r\ncode we
need to call it twice, for moun and unmount.\r\n- Fix redirection issue
and using reactDom in rendering of action items\r\n\r\n<img
width=\"926\"
alt=\"image\"\r\nsrc=\"1e531299-e055-4af1-8ec7-92511e1a6e81\">","sha":"1b0a1ec30cde7355fe30445df8c0e96149c68e74"}}]}]
BACKPORT-->
This commit is contained in:
Yan Savitski 2023-05-25 15:50:09 +02:00 committed by GitHub
parent 48945fa33a
commit 3b54b080e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import React, { useEffect } from 'react';
import React, { useEffect, useLayoutEffect } from 'react';
import { useParams, Redirect, Switch } from 'react-router-dom';
import { useValues, useActions } from 'kea';
@ -43,9 +43,16 @@ export const EngineView: React.FC = () => {
}>();
const { renderHeaderActions } = useValues(KibanaLogic);
useLayoutEffect(() => {
renderHeaderActions(EngineHeaderDocsAction);
return () => {
renderHeaderActions();
};
}, []);
useEffect(() => {
fetchEngine({ engineName });
renderHeaderActions(EngineHeaderDocsAction);
}, [engineName]);
if (fetchEngineApiStatus === Status.ERROR) {

View file

@ -76,7 +76,9 @@ export const renderApp = (
setChromeIsVisible: core.chrome.setIsVisible,
setDocTitle: core.chrome.docTitle.change,
renderHeaderActions: (HeaderActions) =>
params.setHeaderActionMenu((el) => renderHeaderActions(HeaderActions, store, el)),
params.setHeaderActionMenu(
HeaderActions ? renderHeaderActions.bind(null, HeaderActions, store) : undefined
),
});
const unmountLicensingLogic = mountLicensingLogic({
license$: plugins.licensing.license$,

View file

@ -45,7 +45,7 @@ interface KibanaLogicProps {
setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void;
setChromeIsVisible(isVisible: boolean): void;
setDocTitle(title: string): void;
renderHeaderActions(HeaderActions: FC): void;
renderHeaderActions(HeaderActions?: FC): void;
// Required plugins
charts: ChartsPluginStart;
guidedOnboarding: GuidedOnboardingPluginStart;