index.tsx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 hasNewTraceUi={hasTraceNewUi}>
  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. <TextBlock>
  51. {t(
  52. 'This block represents autogrouped spans. We do this to reduce noise whenever it fits one of the following criteria:'
  53. )}
  54. </TextBlock>
  55. <BulletList>
  56. <li>{t('5 or more siblings with the same operation and description')}</li>
  57. <li>{t('2 or more descendants with the same operation')}</li>
  58. </BulletList>
  59. <TextBlock>
  60. {t(
  61. 'You can either open this autogroup using the chevron on the span or turn this functionality off using the settings dropdown above.'
  62. )}
  63. </TextBlock>
  64. </TraceDrawerComponents.DetailContainer>
  65. );
  66. }
  67. const TextBlock = styled('div')`
  68. font-size: ${p => p.theme.fontSizeLarge};
  69. line-height: 1.5;
  70. margin-bottom: ${space(2)};
  71. `;
  72. const BulletList = styled('ul')`
  73. list-style-type: disc;
  74. padding-left: 20px;
  75. margin-bottom: ${space(2)};
  76. li {
  77. margin-bottom: ${space(1)};
  78. }
  79. `;