import {Fragment} from 'react'; import styled from '@emotion/styled'; import Alert from 'sentry/components/alert'; import Link from 'sentry/components/links/link'; import LoadingError from 'sentry/components/loadingError'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import { ErrorDot, ErrorLevel, ErrorMessageContent, ErrorTitle, } from 'sentry/components/performance/waterfall/rowDetails'; import {t, tct} from 'sentry/locale'; import space from 'sentry/styles/space'; import {Organization} from 'sentry/types'; import DiscoverQuery from 'sentry/utils/discover/discoverQuery'; import EventView from 'sentry/utils/discover/eventView'; import {TraceMeta} from 'sentry/utils/performance/quickTrace/types'; interface TraceNotFoundProps { location: any; meta: TraceMeta | null; organization: Organization; traceEventView: EventView; traceSlug: string; } function TraceNotFound({ meta, traceEventView, traceSlug, organization, location, }: TraceNotFoundProps) { const transactions = meta?.transactions ?? 0; const errors = meta?.errors ?? 0; if (transactions === 0 && errors > 0) { const errorsEventView = traceEventView.withColumns([ {kind: 'field', field: 'project'}, {kind: 'field', field: 'title'}, {kind: 'field', field: 'issue.id'}, {kind: 'field', field: 'level'}, ]); errorsEventView.query = `trace:${traceSlug} !event.type:transaction `; return ( {({isLoading, tableData, error}) => { if (isLoading) { return ; } if (error) { return ( {tct( 'The trace cannot be shown when all events are errors. An error occurred when attempting to fetch these error events: [error]', {error: error.message} )} ); } return ( {t('The trace cannot be shown when all events are errors.')} {tableData?.data.map(data => ( {data.level} {data.title} ))} ); }} ); } return ; } const ErrorLabel = styled('div')` margin-bottom: ${space(1)}; `; export default TraceNotFound;