[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 { Location } from 'history';
|
||||||
import { BreadcrumbRoute, getBreadcrumbs } from '../ProvideBreadcrumbs';
|
import { BreadcrumbRoute, getBreadcrumbs } from './ProvideBreadcrumbs';
|
||||||
import { RouteName } from '../route_config/route_names';
|
import { RouteName } from './route_config/route_names';
|
||||||
|
|
||||||
describe('getBreadcrumbs', () => {
|
describe('getBreadcrumbs', () => {
|
||||||
const getTestRoutes = (): BreadcrumbRoute[] => [
|
const getTestRoutes = (): BreadcrumbRoute[] => [
|
|
@ -30,10 +30,18 @@ function getTitleFromBreadCrumbs(breadcrumbs: Breadcrumb[]) {
|
||||||
|
|
||||||
class UpdateBreadcrumbsComponent extends React.Component<Props> {
|
class UpdateBreadcrumbsComponent extends React.Component<Props> {
|
||||||
public updateHeaderBreadcrumbs() {
|
public updateHeaderBreadcrumbs() {
|
||||||
const breadcrumbs = this.props.breadcrumbs.map(({ value, match }) => ({
|
const breadcrumbs = this.props.breadcrumbs.map(
|
||||||
text: value,
|
({ value, match }, index) => {
|
||||||
href: getAPMHref(match.url, this.props.location.search)
|
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);
|
document.title = getTitleFromBreadCrumbs(this.props.breadcrumbs);
|
||||||
this.props.core.chrome.setBreadcrumbs(breadcrumbs);
|
this.props.core.chrome.setBreadcrumbs(breadcrumbs);
|
||||||
|
|
|
@ -15,7 +15,7 @@ Array [
|
||||||
"text": "opbeans-node",
|
"text": "opbeans-node",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"href": "#/services/opbeans-node/errors?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
"href": undefined,
|
||||||
"text": "Errors",
|
"text": "Errors",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -40,7 +40,7 @@ Array [
|
||||||
"text": "Errors",
|
"text": "Errors",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"href": "#/services/opbeans-node/errors/myGroupId?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
"href": undefined,
|
||||||
"text": "myGroupId",
|
"text": "myGroupId",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -61,7 +61,7 @@ Array [
|
||||||
"text": "opbeans-node",
|
"text": "opbeans-node",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"href": "#/services/opbeans-node/transactions?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
"href": undefined,
|
||||||
"text": "Transactions",
|
"text": "Transactions",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -86,7 +86,7 @@ Array [
|
||||||
"text": "Transactions",
|
"text": "Transactions",
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"href": "#/services/opbeans-node/transactions/view?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
"href": undefined,
|
||||||
"text": "my-transaction-name",
|
"text": "my-transaction-name",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -95,7 +95,7 @@ Array [
|
||||||
exports[`UpdateBreadcrumbs Homepage 1`] = `
|
exports[`UpdateBreadcrumbs Homepage 1`] = `
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"href": "#/?rangeFrom=now-24h&rangeTo=now&refreshPaused=true&refreshInterval=0&kuery=myKuery",
|
"href": undefined,
|
||||||
"text": "APM",
|
"text": "APM",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue