traceTreeNodeDetails.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import type {Organization} from 'sentry/types';
  2. import type {VirtualizedViewManager} from 'sentry/views/performance/newTraceDetails/virtualizedViewManager';
  3. import {
  4. isMissingInstrumentationNode,
  5. isNoDataNode,
  6. isParentAutogroupedNode,
  7. isSiblingAutogroupedNode,
  8. isSpanNode,
  9. isTraceErrorNode,
  10. isTransactionNode,
  11. } from '../../guards';
  12. import type {TraceTree, TraceTreeNode} from '../../traceTree';
  13. import {ErrorNodeDetails} from '../details/error';
  14. import {MissingInstrumentationNodeDetails} from '../details/missingInstrumentation';
  15. import {NoDataDetails} from '../details/noData';
  16. import {ParentAutogroupNodeDetails} from '../details/parentAutogroup';
  17. import {SiblingAutogroupNodeDetails} from '../details/siblingAutogroup';
  18. import {SpanNodeDetails} from '../details/span';
  19. import {TransactionNodeDetails} from '../details/transaction';
  20. export interface TraceTreeNodeDetailsProps<T> {
  21. manager: VirtualizedViewManager;
  22. node: T;
  23. onParentClick: (node: TraceTreeNode<TraceTree.NodeValue>) => void;
  24. organization: Organization;
  25. scrollToNode: (node: T) => void;
  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. if (isNoDataNode(props.node)) {
  47. return <NoDataDetails {...props} />;
  48. }
  49. throw new Error('Unknown clicked node type');
  50. }