traceTreeNodeDetails.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type {Organization} from 'sentry/types/organization';
  2. import type {VirtualizedViewManager} from 'sentry/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager';
  3. import type {ReplayRecord} from 'sentry/views/replays/types';
  4. import {
  5. isMissingInstrumentationNode,
  6. isParentAutogroupedNode,
  7. isSiblingAutogroupedNode,
  8. isSpanNode,
  9. isTraceErrorNode,
  10. isTransactionNode,
  11. } from '../../guards';
  12. import type {TraceTree, TraceTreeNode} from '../../traceModels/traceTree';
  13. import {ErrorNodeDetails} from '../details/error';
  14. import {MissingInstrumentationNodeDetails} from '../details/missingInstrumentation';
  15. import {ParentAutogroupNodeDetails} from '../details/parentAutogroup';
  16. import {SiblingAutogroupNodeDetails} from '../details/siblingAutogroup';
  17. import {SpanNodeDetails} from '../details/span/index';
  18. import {TransactionNodeDetails} from '../details/transaction/index';
  19. export interface TraceTreeNodeDetailsProps<T> {
  20. manager: VirtualizedViewManager;
  21. node: T;
  22. onParentClick: (node: TraceTreeNode<TraceTree.NodeValue>) => void;
  23. onTabScrollToNode: (node: TraceTreeNode<any>) => void;
  24. organization: Organization;
  25. replayRecord: ReplayRecord | null;
  26. }
  27. export function TraceTreeNodeDetails(props: TraceTreeNodeDetailsProps<any>) {
  28. if (isTransactionNode(props.node)) {
  29. return <TransactionNodeDetails {...props} />;
  30. }
  31. if (isSpanNode(props.node)) {
  32. return <SpanNodeDetails {...props} />;
  33. }
  34. if (isTraceErrorNode(props.node)) {
  35. return <ErrorNodeDetails {...props} />;
  36. }
  37. if (isParentAutogroupedNode(props.node)) {
  38. return <ParentAutogroupNodeDetails {...props} />;
  39. }
  40. if (isSiblingAutogroupedNode(props.node)) {
  41. return <SiblingAutogroupNodeDetails {...props} />;
  42. }
  43. if (isMissingInstrumentationNode(props.node)) {
  44. return <MissingInstrumentationNodeDetails {...props} />;
  45. }
  46. throw new Error('Unknown clicked node type');
  47. }