styles.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import styled from '@emotion/styled';
  2. import {Location} from 'history';
  3. import EventTagsPill from 'sentry/components/events/eventTags/eventTagsPill';
  4. import {SecondaryHeader} from 'sentry/components/events/interfaces/spans/header';
  5. import {Panel} from 'sentry/components/panels';
  6. import Pills from 'sentry/components/pills';
  7. import SearchBar from 'sentry/components/searchBar';
  8. import space from 'sentry/styles/space';
  9. import {Organization} from 'sentry/types';
  10. import {defined} from 'sentry/utils';
  11. import {TraceFullDetailed} from 'sentry/utils/performance/quickTrace/types';
  12. import {appendTagCondition} from 'sentry/utils/queryString';
  13. import {transactionSummaryRouteWithQuery} from 'sentry/views/performance/transactionSummary/utils';
  14. export {
  15. Row,
  16. SpanDetails as TransactionDetails,
  17. SpanDetailContainer as TransactionDetailsContainer,
  18. } from 'sentry/components/events/interfaces/spans/spanDetail';
  19. export const TraceSearchContainer = styled('div')`
  20. display: flex;
  21. width: 100%;
  22. `;
  23. export const TraceSearchBar = styled(SearchBar)`
  24. flex-grow: 1;
  25. `;
  26. export const TraceViewHeaderContainer = styled(SecondaryHeader)`
  27. position: static;
  28. top: auto;
  29. border-top: none;
  30. border-bottom: 1px solid ${p => p.theme.border};
  31. `;
  32. export const TraceDetailHeader = styled('div')`
  33. display: grid;
  34. grid-template-columns: 1fr;
  35. gap: ${space(3)};
  36. margin-bottom: ${space(2)};
  37. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  38. grid-template-columns: max-content max-content;
  39. grid-row-gap: 0;
  40. }
  41. `;
  42. export const TraceDetailBody = styled('div')`
  43. margin-top: ${space(2)};
  44. `;
  45. export const TraceViewContainer = styled('div')`
  46. overflow-x: hidden;
  47. border-bottom-left-radius: 3px;
  48. border-bottom-right-radius: 3px;
  49. `;
  50. export const TracePanel = styled(Panel)`
  51. overflow: hidden;
  52. `;
  53. export const ProjectBadgeContainer = styled('span')`
  54. margin-right: ${space(0.75)};
  55. display: flex;
  56. flex-direction: column;
  57. justify-content: center;
  58. `;
  59. const StyledPills = styled(Pills)`
  60. padding-top: ${space(1.5)};
  61. `;
  62. export function Tags({
  63. location,
  64. organization,
  65. transaction,
  66. }: {
  67. location: Location;
  68. organization: Organization;
  69. transaction: TraceFullDetailed;
  70. }) {
  71. const {tags} = transaction;
  72. if (!tags || tags.length <= 0) {
  73. return null;
  74. }
  75. const orgSlug = organization.slug;
  76. return (
  77. <tr>
  78. <td className="key">Tags</td>
  79. <td className="value">
  80. <StyledPills>
  81. {tags.map((tag, index) => {
  82. const {pathname: streamPath, query} = transactionSummaryRouteWithQuery({
  83. orgSlug,
  84. transaction: transaction.transaction,
  85. projectID: String(transaction.project_id),
  86. query: {
  87. ...location.query,
  88. query: appendTagCondition(location.query.query, tag.key, tag.value),
  89. },
  90. });
  91. return (
  92. <EventTagsPill
  93. key={!defined(tag.key) ? `tag-pill-${index}` : tag.key}
  94. tag={tag}
  95. projectId={transaction.project_slug}
  96. organization={organization}
  97. query={query}
  98. streamPath={streamPath}
  99. />
  100. );
  101. })}
  102. </StyledPills>
  103. </td>
  104. </tr>
  105. );
  106. }