Skip to content

Commit

Permalink
fix(insights): view query summary button broken (#81327)
Browse files Browse the repository at this point in the history
The view query summary button should be using `useModuleUrl`, this is a
shared function that returns the appropriate module url. Previously the
button did not use this hook, and when we updated the module urls, the
old url was left here.
  • Loading branch information
DominikB2014 authored Nov 26, 2024
1 parent bf9592d commit ec0fc3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('SpanDetail', function () {
).toBeInTheDocument();
expect(screen.getByRole('button', {name: 'View Query Summary'})).toHaveAttribute(
'href',
'/organizations/org-slug/insights/database/spans/span/a7ebd21614897/?project=2'
'/organizations/org-slug/insights/backend/database/spans/span/a7ebd21614897/?project=2'
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Props {
function SpanSummaryButton(props: Props) {
const location = useLocation();
const resourceBaseUrl = useModuleURL(ModuleName.RESOURCE);
const queryBaseUrl = useModuleURL(ModuleName.DB);

const {event, organization, span} = props;

Expand All @@ -41,7 +42,7 @@ function SpanSummaryButton(props: Props) {
<LinkButton
size="xs"
to={querySummaryRouteWithQuery({
orgSlug: organization.slug,
base: queryBaseUrl,
query: location.query,
group: sentryTags.group,
projectID: event.projectID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ export function spanDetailsRouteWithQuery({
}

export function generateQuerySummaryRoute({
orgSlug,
base,
group,
}: {
base: string;
group: string;
orgSlug: string;
}): string {
return `/organizations/${orgSlug}/insights/database/spans/span/${group}/`;
return `${base}/spans/span/${group}/`;
}

export function querySummaryRouteWithQuery({
orgSlug,
base,
query,
group,
projectID,
}: {
base: string;
group: string;
orgSlug: string;
query: Query;
projectID?: string | string[];
}) {
const pathname = generateQuerySummaryRoute({
orgSlug,
base,
group,
});

Expand Down

0 comments on commit ec0fc3d

Please sign in to comment.