Skip to content

Commit

Permalink
[APM] Remove link from active page in the breadcrumb (elastic#65473)
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed May 7, 2020
1 parent 4619b47 commit ac61957
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { Location } from 'history';
import { BreadcrumbRoute, getBreadcrumbs } from '../ProvideBreadcrumbs';
import { RouteName } from '../route_config/route_names';
import { BreadcrumbRoute, getBreadcrumbs } from './ProvideBreadcrumbs';
import { RouteName } from './route_config/route_names';

describe('getBreadcrumbs', () => {
const getTestRoutes = (): BreadcrumbRoute[] => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ function getTitleFromBreadCrumbs(breadcrumbs: Breadcrumb[]) {

class UpdateBreadcrumbsComponent extends React.Component<Props> {
public updateHeaderBreadcrumbs() {
const breadcrumbs = this.props.breadcrumbs.map(({ value, match }) => ({
text: value,
href: getAPMHref(match.url, this.props.location.search)
}));
const breadcrumbs = this.props.breadcrumbs.map(
({ value, match }, index) => {
const isLastBreadcrumbItem =
index === this.props.breadcrumbs.length - 1;
return {
text: value,
href: isLastBreadcrumbItem
? undefined // makes the breadcrumb item not clickable
: getAPMHref(match.url, this.props.location.search)
};
}
);

document.title = getTitleFromBreadCrumbs(this.props.breadcrumbs);
this.props.core.chrome.setBreadcrumbs(breadcrumbs);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac61957

Please sign in to comment.