traceAutogroupedRow.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import {t} from 'sentry/locale';
  2. import {TraceIcons} from '../traceIcons';
  3. import type {ParentAutogroupNode} from '../traceModels/parentAutogroupNode';
  4. import type {SiblingAutogroupNode} from '../traceModels/siblingAutogroupNode';
  5. import {AutogroupedTraceBar, makeTraceNodeBarColor} from '../traceRow/traceBar';
  6. import {
  7. maybeFocusTraceRow,
  8. TRACE_COUNT_FORMATTER,
  9. TraceChildrenButton,
  10. TraceRowConnectors,
  11. type TraceRowProps,
  12. } from '../traceRow/traceRow';
  13. export function TraceAutogroupedRow(
  14. props: TraceRowProps<ParentAutogroupNode | SiblingAutogroupNode>
  15. ) {
  16. return (
  17. <div
  18. key={props.index}
  19. ref={r =>
  20. props.tabIndex === 0
  21. ? maybeFocusTraceRow(r, props.node, props.previouslyFocusedNodeRef)
  22. : null
  23. }
  24. tabIndex={props.tabIndex}
  25. className={`Autogrouped TraceRow ${props.rowSearchClassName} ${props.node.hasErrors ? props.node.maxIssueSeverity : ''}`}
  26. onPointerDown={props.onRowClick}
  27. onKeyDown={props.onRowKeyDown}
  28. style={props.style}
  29. >
  30. <div className="TraceLeftColumn" ref={props.registerListColumnRef}>
  31. <div
  32. className="TraceLeftColumnInner"
  33. style={props.listColumnStyle}
  34. onDoubleClick={props.onRowDoubleClick}
  35. >
  36. <div className="TraceChildrenCountWrapper">
  37. <TraceRowConnectors node={props.node} manager={props.manager} />
  38. <TraceChildrenButton
  39. icon={
  40. <TraceIcons.Chevron direction={props.node.expanded ? 'up' : 'down'} />
  41. }
  42. status={props.node.fetchStatus}
  43. expanded={!props.node.expanded}
  44. onClick={props.onExpand}
  45. onDoubleClick={props.onExpandDoubleClick}
  46. >
  47. {TRACE_COUNT_FORMATTER.format(props.node.groupCount)}
  48. </TraceChildrenButton>
  49. </div>
  50. <span className="TraceOperation">{t('Autogrouped')}</span>
  51. <strong className="TraceEmDash"> — </strong>
  52. <span className="TraceDescription">{props.node.value.autogrouped_by.op}</span>
  53. </div>
  54. </div>
  55. <div
  56. className={props.spanColumnClassName}
  57. ref={props.registerSpanColumnRef}
  58. onDoubleClick={props.onRowDoubleClick}
  59. >
  60. <AutogroupedTraceBar
  61. node={props.node}
  62. manager={props.manager}
  63. entire_space={props.node.space}
  64. errors={props.node.errors}
  65. virtualized_index={props.virtualized_index}
  66. color={makeTraceNodeBarColor(props.theme, props.node)}
  67. node_spaces={props.node.autogroupedSegments}
  68. performance_issues={props.node.performance_issues}
  69. profiles={props.node.profiles}
  70. />
  71. <button
  72. ref={props.registerSpanArrowRef}
  73. className="TraceArrow"
  74. onClick={props.onSpanArrowClick}
  75. >
  76. <TraceIcons.Chevron direction="left" />
  77. </button>
  78. </div>
  79. </div>
  80. );
  81. }