traceTreeNodeDetails.tsx 1.9 KB

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