transactionCell.tsx 908 B

1234567891011121314151617181920212223242526272829303132333435
  1. import * as qs from 'query-string';
  2. import Link from 'sentry/components/links/link';
  3. import {useLocation} from 'sentry/utils/useLocation';
  4. import {OverflowEllipsisTextContainer} from 'sentry/views/insights/common/components/textAlign';
  5. import {useModuleURL} from 'sentry/views/insights/common/utils/useModuleURL';
  6. interface Props {
  7. project?: string;
  8. transaction?: string;
  9. transactionMethod?: string;
  10. }
  11. export function TransactionCell({project, transaction}: Props) {
  12. const moduleURL = useModuleURL('cache');
  13. const location = useLocation();
  14. if (!transaction) {
  15. return NULL_DESCRIPTION;
  16. }
  17. const query = {
  18. ...location.query,
  19. transaction,
  20. project,
  21. };
  22. return (
  23. <OverflowEllipsisTextContainer>
  24. <Link to={`${moduleURL}/?${qs.stringify(query)}`}>{transaction}</Link>
  25. </OverflowEllipsisTextContainer>
  26. );
  27. }
  28. const NULL_DESCRIPTION = <span>&lt;null&gt;</span>;