Skip to content

Commit

Permalink
Fix transaction action menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gbamparop committed Jul 19, 2023
1 parent 9c7dda0 commit 46250e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Expand Up @@ -40,6 +40,9 @@ export const getSections = ({
infraLocators,
infraLinksAvailable,
profilingLocators,
rangeFrom,
rangeTo,
environment,
}: {
transaction?: Transaction;
basePath: IBasePath;
Expand All @@ -48,6 +51,9 @@ export const getSections = ({
infraLocators: InfraLocators;
infraLinksAvailable: boolean;
profilingLocators?: ProfilingLocators;
rangeFrom: string;
rangeTo: string;
environment: string;
}) => {
if (!transaction) return [];
const hostName = transaction.host?.hostname;
Expand All @@ -58,12 +64,6 @@ export const getSections = ({
const time = Math.round(transaction.timestamp.us / 1000);
const infraMetricsQuery = getInfraMetricsQuery(transaction);

const routeParams = apmRouter.getParams(
'/services/{serviceName}/transactions/view',
location
);
const { rangeFrom, rangeTo, environment } = routeParams.query;

const uptimeLink = url.format({
pathname: basePath.prepend('/app/uptime'),
search: `?${fromQuery(
Expand Down
Expand Up @@ -22,6 +22,7 @@ import { ProfilingLocators } from '@kbn/profiling-plugin/public';
import React, { useState } from 'react';
import { useLocation } from 'react-router-dom';
import useAsync from 'react-use/lib/useAsync';
import { useAnyOfApmParams } from '../../../hooks/use_apm_params';
import { ApmFeatureFlagName } from '../../../../common/apm_feature_flags';
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
Expand Down Expand Up @@ -115,6 +116,14 @@ function ActionMenuSections({
ApmFeatureFlagName.InfraUiAvailable
);

const {
query: { rangeFrom, rangeTo, environment },
} = useAnyOfApmParams(
'/services/{serviceName}/transactions/view',
'/traces/explorer/waterfall',
'/dependencies/operation'
);

const sections = getSections({
transaction,
basePath: core.http.basePath,
Expand All @@ -123,6 +132,9 @@ function ActionMenuSections({
infraLocators: locators,
infraLinksAvailable,
profilingLocators,
rangeFrom,
rangeTo,
environment,
});

const externalMenuItems = useAsync(() => {
Expand Down

0 comments on commit 46250e6

Please sign in to comment.