Skip to content
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

[APM] Fix comparison option showing in individual transaction page #155915

Merged
merged 4 commits into from
May 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ export function TimeComparison() {
const comparisonOptions = useMemo(() => {
const matchingRoutes = apmRouter.getRoutesToMatch(location.pathname);
// Only show the "Expected bounds" option in Overview and Transactions tabs
const showExpectedBoundsForThisTab = matchingRoutes.some(
(d) =>
d.path === '/services/{serviceName}/overview' ||
d.path === '/services/{serviceName}/transactions'
);
const showExpectedBoundsForThisTab =
!matchingRoutes.some(
(d) => d.path === '/services/{serviceName}/transactions/view'
) &&
matchingRoutes.some(
(d) =>
d.path === '/services/{serviceName}/overview' ||
d.path === '/services/{serviceName}/transactions'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remind me: why did the previous check match /services/{serviceName}/transactions/view? The check only refers to /services/{serviceName}/overview and /services/{serviceName}/transactions.

(I don't completely recall how getRoutesToMatch work)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because matchingRoutes.map(r => r.path) returns the following:

[
    "/",
    "/services/{serviceName}",
    "/services/{serviceName}/transactions",
    "/services/{serviceName}/transactions/view"
]

for the following link app/apm/services/frontend/transactions/view?...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests here 3f37787 (#155915)

);

const timeComparisonOptions = getComparisonOptions({
start,
Expand Down