[APM] Remove link from active page in the breadcrumb (#65473)
This commit is contained in:
parent
15eec5a9ee
commit
19ed83958f
|
@ -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[] => [
|
|
@ -30,10 +30,18 @@ function getTitleFromBreadCrumbs(breadcrumbs: Breadcrumb[]) {
|
|||
|
||||
class UpdateBreadcrumbsComponent extends React.Component<Props> {
|
||||
public updateHeaderBreadcrumbs() {
|
||||
const breadcrumbs = this.props.breadcrumbs.map(({ value, match }) => ({
|
||||
const breadcrumbs = this.props.breadcrumbs.map(
|
||||
({ value, match }, index) => {
|
||||
const isLastBreadcrumbItem =
|
||||
index === this.props.breadcrumbs.length - 1;
|
||||
return {
|
||||
text: value,
|
||||
href: getAPMHref(match.url, this.props.location.search)
|
||||
}));
|
||||
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);
|
||||
|
|
|
@ -15,7 +15,7 @@ Array [
|
|||
"text": "opbeans-node",
|
||||
},
|
||||
Object {
|
||||
"href": "#/services/opbeans-node/errors?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
||||
"href": undefined,
|
||||
"text": "Errors",
|
||||
},
|
||||
]
|
||||
|
@ -40,7 +40,7 @@ Array [
|
|||
"text": "Errors",
|
||||
},
|
||||
Object {
|
||||
"href": "#/services/opbeans-node/errors/myGroupId?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
||||
"href": undefined,
|
||||
"text": "myGroupId",
|
||||
},
|
||||
]
|
||||
|
@ -61,7 +61,7 @@ Array [
|
|||
"text": "opbeans-node",
|
||||
},
|
||||
Object {
|
||||
"href": "#/services/opbeans-node/transactions?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
||||
"href": undefined,
|
||||
"text": "Transactions",
|
||||
},
|
||||
]
|
||||
|
@ -86,7 +86,7 @@ Array [
|
|||
"text": "Transactions",
|
||||
},
|
||||
Object {
|
||||
"href": "#/services/opbeans-node/transactions/view?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
||||
"href": undefined,
|
||||
"text": "my-transaction-name",
|
||||
},
|
||||
]
|
||||
|
@ -95,7 +95,7 @@ Array [
|
|||
exports[`UpdateBreadcrumbs Homepage 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"href": "#/?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
||||
"href": undefined,
|
||||
"text": "APM",
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue