-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes APM custom breadcrumbs, leaves only chrome.breadcrumbs.set
- Loading branch information
1 parent
9d33143
commit 02cf59f
Showing
7 changed files
with
84 additions
and
103 deletions.
There are no files selected for viewing
80 changes: 0 additions & 80 deletions
80
x-pack/plugins/apm/public/components/app/Main/Breadcrumbs.js
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
x-pack/plugins/apm/public/components/app/Main/UpdateBreadcrumbs.ts
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,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Location } from 'history'; | ||
import { flatten } from 'lodash'; | ||
import React from 'react'; | ||
// @ts-ignore | ||
import { withBreadcrumbs } from 'react-router-breadcrumbs-hoc'; | ||
import chrome from 'ui/chrome'; | ||
import { toQuery } from '../../shared/Links/url_helpers'; | ||
import { isSwitchSet, routes } from './routeConfig'; | ||
|
||
interface Props { | ||
location: Location; | ||
breadcrumbs: Array<{ | ||
breadcrumb: any; | ||
match: { | ||
url: string; | ||
}; | ||
}>; | ||
} | ||
|
||
class UpdateBreadcrumbsComponent extends React.Component<Props> { | ||
public updateHeaderBreadcrumbs() { | ||
const { _g = '', kuery = '' } = toQuery(this.props.location.search); | ||
const breadcrumbs = this.props.breadcrumbs.map(({ breadcrumb, match }) => ({ | ||
text: breadcrumb, | ||
href: `#${match.url}?_g=${_g}&kuery=${kuery}` | ||
})); | ||
|
||
chrome.breadcrumbs.set(breadcrumbs); | ||
} | ||
|
||
public componentDidMount() { | ||
this.updateHeaderBreadcrumbs(); | ||
} | ||
|
||
public componentDidUpdate() { | ||
this.updateHeaderBreadcrumbs(); | ||
} | ||
|
||
public render() { | ||
return null; | ||
} | ||
} | ||
|
||
const flatRoutes = flatten( | ||
routes.map(route => (isSwitchSet(route) ? route.routes : route)) | ||
); | ||
|
||
const UpdateBreadcrumbs = withBreadcrumbs(flatRoutes)( | ||
UpdateBreadcrumbsComponent | ||
); | ||
|
||
export { UpdateBreadcrumbs }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
<div ng-controller="TimePickerController"> | ||
<kbn-top-nav name="apm" config="topNavMenu"> | ||
<div data-transclude-slots> | ||
<div data-transclude-slot="topLeftCorner"> | ||
<div id="react-apm-breadcrumbs"></div> | ||
</div> | ||
</div> | ||
</kbn-top-nav> | ||
<div ng-controller="TimePickerController" id="kibana-angular-template"> | ||
<kbn-top-nav name="apm" config="topNavMenu"></kbn-top-nav> | ||
</div> | ||
|
||
<div id="react-apm-root" style="overflow-x: auto;"></div> |
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