index.tsx 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import styled from '@emotion/styled';
  2. import {t} from 'sentry/locale';
  3. import {space} from 'sentry/styles/space';
  4. import {isSiblingAutogroupedNode} from '../../../traceGuards';
  5. import type {ParentAutogroupNode} from '../../../traceModels/parentAutogroupNode';
  6. import type {SiblingAutogroupNode} from '../../../traceModels/siblingAutogroupNode';
  7. import {useHasTraceNewUi} from '../../../useHasTraceNewUi';
  8. import type {TraceTreeNodeDetailsProps} from '../../tabs/traceTreeNodeDetails';
  9. import {TraceDrawerComponents} from '../styles';
  10. import {ParentAutogroupNodeDetails} from './parentAutogroup';
  11. import {SiblingAutogroupNodeDetails} from './siblingAutogroup';
  12. export function AutogroupNodeDetails(
  13. props: TraceTreeNodeDetailsProps<ParentAutogroupNode | SiblingAutogroupNode>
  14. ) {
  15. const hasTraceNewUi = useHasTraceNewUi();
  16. const {node, organization, onTabScrollToNode} = props;
  17. if (!hasTraceNewUi) {
  18. if (isSiblingAutogroupedNode(node)) {
  19. return (
  20. <SiblingAutogroupNodeDetails
  21. {...(props as TraceTreeNodeDetailsProps<SiblingAutogroupNode>)}
  22. />
  23. );
  24. }
  25. return (
  26. <ParentAutogroupNodeDetails
  27. {...(props as TraceTreeNodeDetailsProps<ParentAutogroupNode>)}
  28. />
  29. );
  30. }
  31. return (
  32. <TraceDrawerComponents.DetailContainer>
  33. <TraceDrawerComponents.HeaderContainer>
  34. <TraceDrawerComponents.Title>
  35. <TraceDrawerComponents.LegacyTitleText>
  36. <TraceDrawerComponents.TitleText>
  37. {t('Autogroup')}
  38. </TraceDrawerComponents.TitleText>
  39. <TraceDrawerComponents.SubtitleWithCopyButton
  40. text={`ID: ${node.value.span_id}`}
  41. />
  42. </TraceDrawerComponents.LegacyTitleText>
  43. </TraceDrawerComponents.Title>
  44. <TraceDrawerComponents.NodeActions
  45. node={node}
  46. organization={organization}
  47. onTabScrollToNode={onTabScrollToNode}
  48. />
  49. </TraceDrawerComponents.HeaderContainer>
  50. <TraceDrawerComponents.BodyContainer hasNewTraceUi={hasTraceNewUi}>
  51. <TextBlock>
  52. {t(
  53. 'This block represents autogrouped spans. We do this to reduce noise whenever it fits one of the following criteria:'
  54. )}
  55. </TextBlock>
  56. <BulletList>
  57. <li>{t('5 or more siblings with the same operation and description')}</li>
  58. <li>{t('2 or more descendants with the same operation')}</li>
  59. </BulletList>
  60. <TextBlock>
  61. {t(
  62. 'You can either open this autogroup using the chevron on the span or turn this functionality off using the settings dropdown above.'
  63. )}
  64. </TextBlock>
  65. </TraceDrawerComponents.BodyContainer>
  66. </TraceDrawerComponents.DetailContainer>
  67. );
  68. }
  69. const TextBlock = styled('div')`
  70. font-size: ${p => p.theme.fontSizeLarge};
  71. line-height: 1.5;
  72. margin-bottom: ${space(2)};
  73. `;
  74. const BulletList = styled('ul')`
  75. list-style-type: disc;
  76. padding-left: 20px;
  77. margin-bottom: ${space(2)};
  78. li {
  79. margin-bottom: ${space(1)};
  80. }
  81. `;