-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[APM] Fix APM breadcrumbs on Serverless #191506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f2dbcd2
27a71cf
6510524
004df37
d5ae659
df16456
a011991
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,6 @@ import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; | |
| import { environmentRt } from '../../../../common/environment_rt'; | ||
| import { TraceSearchType } from '../../../../common/trace_explorer'; | ||
| import { ApmTimeRangeMetadataContextProvider } from '../../../context/time_range_metadata/time_range_metadata_context'; | ||
| import { Breadcrumb } from '../../app/breadcrumb'; | ||
| import { ServiceInventory } from '../../app/service_inventory'; | ||
| import { ServiceMapHome } from '../../app/service_map'; | ||
| import { TopTracesOverview } from '../../app/top_traces_overview'; | ||
|
|
@@ -50,11 +49,13 @@ function serviceGroupPage<TPath extends string>({ | |
| return { | ||
| [path]: { | ||
| element: ( | ||
| <Breadcrumb title={title} href={path}> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note was removed to avoid conflicts with
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. totally off topic: never knew about these alert indicators. I'll immediately start (ab)-using these! :) Other type of alerts per my recent findings: Note Highlights information that users should take into account, even when skimming. Tip Optional information to help a user be more successful. Important Crucial information necessary for users to succeed. Warning Critical content demanding immediate user attention due to potential risks. Caution Negative potential consequences of an action.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to say that I found that out a couple of days ago in one of @tonyghiani's PRs. 😄 |
||
| <ServiceGroupTemplate pageTitle={title} serviceGroupContextTab={serviceGroupContextTab}> | ||
| {element} | ||
| </ServiceGroupTemplate> | ||
| </Breadcrumb> | ||
| <ServiceGroupTemplate | ||
| pageTitle={title} | ||
| pagePath={path} | ||
| serviceGroupContextTab={serviceGroupContextTab} | ||
| > | ||
| {element} | ||
| </ServiceGroupTemplate> | ||
| ), | ||
| params: t.type({ | ||
| query: t.type({ serviceGroup: t.string }), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,13 +26,15 @@ import { useEntityManagerEnablementContext } from '../../../context/entity_manag | |
| export function ServiceGroupTemplate({ | ||
| pageTitle, | ||
| pageHeader, | ||
| pagePath, | ||
| children, | ||
| environmentFilter = true, | ||
| serviceGroupContextTab, | ||
| ...pageTemplateProps | ||
| }: { | ||
| pageTitle?: React.ReactNode; | ||
| pageTitle: string; | ||
| pageHeader?: EuiPageHeaderProps; | ||
| pagePath: string; | ||
| children: React.ReactNode; | ||
| environmentFilter?: boolean; | ||
| serviceGroupContextTab: ServiceGroupContextTab['key']; | ||
|
|
@@ -81,34 +83,44 @@ export function ServiceGroupTemplate({ | |
| ); | ||
|
|
||
| const tabs = useTabs(serviceGroupContextTab); | ||
| const selectedTab = tabs?.find(({ isSelected }) => isSelected); | ||
| const selectedTab = tabs.find(({ isSelected }) => isSelected); | ||
|
|
||
| // this is only used for building the breadcrumbs for the service group page | ||
| useBreadcrumb( | ||
| () => [ | ||
| { | ||
| title: i18n.translate('xpack.apm.serviceGroups.breadcrumb.title', { | ||
| defaultMessage: 'Services', | ||
| }), | ||
| href: serviceGroupsLink, | ||
| }, | ||
| ...(selectedTab | ||
| () => | ||
| !serviceGroupName | ||
| ? [ | ||
| ...(serviceGroupName | ||
| { | ||
| title: pageTitle, | ||
| href: pagePath, | ||
| }, | ||
| ] | ||
| : [ | ||
| { | ||
| title: i18n.translate('xpack.apm.serviceGroups.breadcrumb.title', { | ||
| defaultMessage: 'Services', | ||
| }), | ||
| href: serviceGroupsLink, | ||
| }, | ||
| { | ||
| title: serviceGroupName, | ||
| href: router.link('/services', { query }), | ||
| }, | ||
| ...(selectedTab | ||
| ? [ | ||
| { | ||
| title: serviceGroupName, | ||
| href: router.link('/services', { query }), | ||
| }, | ||
| title: selectedTab.breadcrumbLabel || selectedTab.label, | ||
| href: selectedTab.href, | ||
| } as { title: string; href: string }, | ||
| ] | ||
| : []), | ||
| { | ||
| title: selectedTab.breadcrumbLabel || selectedTab.label, | ||
| href: selectedTab.href, | ||
| } as { title: string; href: string }, | ||
| ] | ||
| : []), | ||
| ], | ||
| [query, router, selectedTab, serviceGroupName, serviceGroupsLink] | ||
| ], | ||
| [pagePath, pageTitle, query, router, selectedTab, serviceGroupName, serviceGroupsLink], | ||
| { | ||
| omitRootOnServerless: true, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note
|
||
| } | ||
| ); | ||
|
|
||
| return ( | ||
| <ApmMainTemplate | ||
| pageTitle={serviceGroupsPageTitle} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
Side nav items are automatically added, so we have to avoid adding repeated items to the breadcrumbs