traceTreeNodeDetails.tsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. isNoDataNode,
  7. isParentAutogroupedNode,
  8. isSiblingAutogroupedNode,
  9. isSpanNode,
  10. isTraceErrorNode,
  11. isTransactionNode,
  12. } from '../../guards';
  13. import type {TraceTree, TraceTreeNode} from '../../traceModels/traceTree';
  14. import {ErrorNodeDetails} from '../details/error';
  15. import {MissingInstrumentationNodeDetails} from '../details/missingInstrumentation';
  16. import {NoDataDetails} from '../details/noData';
  17. import {ParentAutogroupNodeDetails} from '../details/parentAutogroup';
  18. import {SiblingAutogroupNodeDetails} from '../details/siblingAutogroup';
  19. import {SpanNodeDetails} from '../details/span/index';
  20. import {TransactionNodeDetails} from '../details/transaction/index';
  21. export interface TraceTreeNodeDetailsProps<T> {
  22. manager: VirtualizedViewManager;
  23. node: T;
  24. onParentClick: (node: TraceTreeNode<TraceTree.NodeValue>) => void;
  25. onTabScrollToNode: (node: TraceTreeNode<any>) => void;
  26. organization: Organization;
  27. replayRecord: ReplayRecord | null;
  28. }
  29. export function TraceTreeNodeDetails(props: TraceTreeNodeDetailsProps<any>) {
  30. if (isTransactionNode(props.node)) {
  31. return <TransactionNodeDetails {...props} />;
  32. }
  33. if (isSpanNode(props.node)) {
  34. return <SpanNodeDetails {...props} />;
  35. }
  36. if (isTraceErrorNode(props.node)) {
  37. return <ErrorNodeDetails {...props} />;
  38. }
  39. if (isParentAutogroupedNode(props.node)) {
  40. return <ParentAutogroupNodeDetails {...props} />;
  41. }
  42. if (isSiblingAutogroupedNode(props.node)) {
  43. return <SiblingAutogroupNodeDetails {...props} />;
  44. }
  45. if (isMissingInstrumentationNode(props.node)) {
  46. return <MissingInstrumentationNodeDetails {...props} />;
  47. }
  48. if (isNoDataNode(props.node)) {
  49. return <NoDataDetails {...props} />;
  50. }
  51. throw new Error('Unknown clicked node type');
  52. }