limitExceededMessage.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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;
  22. const totalTransactions = meta?.transactions ?? count;
  23. if (totalTransactions === null || count >= totalTransactions) {
  24. return null;
  25. }
  26. const target = traceEventView.getResultsViewUrlTarget(organization.slug);
  27. return (
  28. <MessageRow>
  29. {tct(
  30. 'Limited to a view of [count] transactions. To view the full list, [discover].',
  31. {
  32. count,
  33. discover: (
  34. <DiscoverFeature>
  35. {({hasFeature}) => (
  36. <Link disabled={!hasFeature} to={target}>
  37. {t('Open in Discover')}
  38. </Link>
  39. )}
  40. </DiscoverFeature>
  41. ),
  42. }
  43. )}
  44. </MessageRow>
  45. );
  46. }
  47. export default LimitExceededMessage;