fix np app navlink url (#54691) (#54706)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Pierre Gayvallet 2020-01-14 15:08:46 +01:00 committed by GitHub
parent 9d00587de1
commit 9f714e2f50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,7 +57,7 @@ import {
} from '../..';
import { HttpStart } from '../../../http';
import { ChromeHelpExtension } from '../../chrome_service';
import { ApplicationStart, InternalApplicationStart } from '../../../application/types';
import { InternalApplicationStart } from '../../../application/types';
// Providing a buffer between the limit and the cut off index
// protects from truncating just the last couple (6) characters
@ -108,7 +108,7 @@ function extendRecentlyAccessedHistoryItem(
};
}
function extendNavLink(navLink: ChromeNavLink, urlForApp: ApplicationStart['getUrlForApp']) {
function extendNavLink(navLink: ChromeNavLink) {
if (navLink.legacy) {
return {
...navLink,
@ -118,7 +118,7 @@ function extendNavLink(navLink: ChromeNavLink, urlForApp: ApplicationStart['getU
return {
...navLink,
href: urlForApp(navLink.id),
href: navLink.baseUrl,
};
}
@ -229,9 +229,7 @@ class HeaderUI extends Component<Props, State> {
appTitle,
isVisible,
forceNavigation,
navLinks: navLinks.map(navLink =>
extendNavLink(navLink, this.props.application.getUrlForApp)
),
navLinks: navLinks.map(extendNavLink),
recentlyAccessed: recentlyAccessed.map(ra =>
extendRecentlyAccessedHistoryItem(navLinks, ra, this.props.basePath)
),