styles.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. border-top: none;
  28. border-bottom: 1px solid ${p => p.theme.border};
  29. position: sticky;
  30. top: 0;
  31. z-index: 1;
  32. `;
  33. export const TraceDetailHeader = styled('div')`
  34. display: grid;
  35. grid-template-columns: 1fr;
  36. gap: ${space(3)};
  37. margin-bottom: ${space(2)};
  38. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  39. grid-template-columns: max-content max-content;
  40. grid-row-gap: 0;
  41. }
  42. `;
  43. export const TraceDetailBody = styled('div')`
  44. height: 100%;
  45. `;
  46. export const TraceViewContainer = styled('div')`
  47. overflow-x: hidden;
  48. border-bottom-left-radius: 3px;
  49. border-bottom-right-radius: 3px;
  50. `;
  51. export const TracePanel = styled(Panel)`
  52. height: 100%;
  53. overflow: auto;
  54. `;
  55. export const ProjectBadgeContainer = styled('span')`
  56. margin-right: ${space(0.75)};
  57. display: flex;
  58. flex-direction: column;
  59. justify-content: center;
  60. `;
  61. const StyledPills = styled(Pills)`
  62. padding-top: ${space(1.5)};
  63. `;
  64. export function Tags({
  65. location,
  66. organization,
  67. transaction,
  68. }: {
  69. location: Location;
  70. organization: Organization;
  71. transaction: TraceFullDetailed;
  72. }) {
  73. const {tags} = transaction;
  74. if (!tags || tags.length <= 0) {
  75. return null;
  76. }
  77. const orgSlug = organization.slug;
  78. return (
  79. <tr>
  80. <td className="key">Tags</td>
  81. <td className="value">
  82. <StyledPills>
  83. {tags.map((tag, index) => {
  84. const {pathname: streamPath, query} = transactionSummaryRouteWithQuery({
  85. orgSlug,
  86. transaction: transaction.transaction,
  87. projectID: String(transaction.project_id),
  88. query: {
  89. ...location.query,
  90. query: appendTagCondition(location.query.query, tag.key, tag.value),
  91. },
  92. });
  93. return (
  94. <EventTagsPill
  95. key={!defined(tag.key) ? `tag-pill-${index}` : tag.key}
  96. tag={tag}
  97. projectId={transaction.project_slug}
  98. organization={organization}
  99. query={query}
  100. streamPath={streamPath}
  101. />
  102. );
  103. })}
  104. </StyledPills>
  105. </td>
  106. </tr>
  107. );
  108. }