limitExceededMessage.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import DiscoverFeature from 'sentry/components/discover/discoverFeature';
  2. import Link from 'sentry/components/links/link';
  3. import {MessageRow} from 'sentry/components/performance/waterfall/messageRow';
  4. import {t, tct} from 'sentry/locale';
  5. import {Organization} from 'sentry/types';
  6. import EventView from 'sentry/utils/discover/eventView';
  7. import {TraceMeta} from 'sentry/utils/performance/quickTrace/types';
  8. import {TraceInfo} from 'sentry/views/performance/traceDetails/types';
  9. interface LimitExceededMessageProps {
  10. meta: TraceMeta | null;
  11. organization: Organization;
  12. traceEventView: EventView;
  13. traceInfo: TraceInfo;
  14. }
  15. function LimitExceededMessage({
  16. traceInfo,
  17. traceEventView,
  18. organization,
  19. meta,
  20. }: LimitExceededMessageProps) {
  21. const count = traceInfo.transactions.size + traceInfo.errors.size;
  22. const totalEvents = (meta && meta.transactions + meta.errors) ?? count;
  23. if (totalEvents === null || count >= totalEvents) {
  24. return null;
  25. }
  26. const target = traceEventView.getResultsViewUrlTarget(organization.slug);
  27. return (
  28. <MessageRow>
  29. {tct('Limited to a view of [count] rows. To view the full list, [discover].', {
  30. count,
  31. discover: (
  32. <DiscoverFeature>
  33. {({hasFeature}) => (
  34. <Link disabled={!hasFeature} to={target}>
  35. {t('Open in Discover')}
  36. </Link>
  37. )}
  38. </DiscoverFeature>
  39. ),
  40. })}
  41. </MessageRow>
  42. );
  43. }
  44. export default LimitExceededMessage;