Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -253,6 +253,42 @@ describe('Performance GridEditable Table', () => {
);
});

it('does not render trace link when trace id is missing', async () => {
const initialData = initializeData();
const eventView = EventView.fromNewQueryWithLocation(
{
id: undefined,
version: 2,
name: 'transactionName',
fields,
query,
projects: [],
orderby: '-timestamp',
},
initialData.router.location
);

render(
<EventsTable
theme={theme}
eventView={eventView}
organization={organization}
routes={initialData.router.routes}
location={initialData.router.location}
setError={() => {}}
columnTitles={transactionsListTitles}
transactionName={transactionName}
/>
);

// First event has a trace and should render a trace link
expect(await screen.findByRole('link', {name: '1234'})).toBeInTheDocument();

// Second event has no trace - its (no value) should not be a link
const noValueElement = screen.getByText('(no value)');
expect(noValueElement.closest('a')).toBeNull();
});

it('renders replay id', async () => {
MockApiClient.addMockResponse({
url: '/organizations/org-slug/replay-count/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,27 +232,27 @@ export function EventsTable({

if (field === 'id' || field === 'trace') {
const isIssue = !!issueId;
let target: LocationDescriptor = {};
let target: LocationDescriptor | null = null;
if (isIssue && !isRegressionIssue && field === 'id') {
target.pathname = `/organizations/${organization.slug}/issues/${issueId}/events/${dataRow.id}/`;
} else {
if (field === 'id') {
target = generateLinkToEventInTraceView({
traceSlug: dataRow.trace?.toString()!,
eventId: dataRow.id,
timestamp: dataRow.timestamp!,
location,
organization,
source: TraceViewSources.PERFORMANCE_TRANSACTION_SUMMARY,
view: domainViewFilters?.view,
});
} else {
target = generateTraceLink(transactionName, domainViewFilters?.view)(
organization,
dataRow,
location
);
}
target = {
pathname: `/organizations/${organization.slug}/issues/${issueId}/events/${dataRow.id}/`,
};
} else if (field === 'id') {
target = generateLinkToEventInTraceView({
traceSlug: dataRow.trace?.toString()!,
eventId: dataRow.id,
timestamp: dataRow.timestamp!,
location,
organization,
source: TraceViewSources.PERFORMANCE_TRANSACTION_SUMMARY,
view: domainViewFilters?.view,
});
} else if (dataRow.trace) {
target = generateTraceLink(transactionName, domainViewFilters?.view)(
organization,
dataRow,
location
);
}

return (
Expand All @@ -262,7 +262,7 @@ export function EventsTable({
handleCellAction={cellActionHandler}
allowActions={allowActions}
>
<Link to={target}>{rendered}</Link>
{target ? <Link to={target}>{rendered}</Link> : rendered}
</CellAction>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const MOCK_EVENTS_TABLE_DATA = [
'transaction.duration': 600,
'project.id': 1,
timestamp: '2020-05-22T15:31:18+00:00',
trace: '4321',
'span_ops_breakdown.relative': '',
'spans.browser': 100,
'spans.db': 300,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function generateTraceLink(dateSelection: any, view?: DomainView) {
tableRow: TableDataRow,
location: Location
): LocationDescriptor => {
const traceId = `${tableRow.trace}`;
const traceId = tableRow.trace ? `${tableRow.trace}` : '';
if (!traceId) {
return {};
}
Expand Down
Loading