content.tsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import styled from '@emotion/styled';
  2. import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight';
  3. import getOutputType, {
  4. Output,
  5. } from 'sentry/views/replays/detail/network/details/getOutputType';
  6. import {
  7. Setup,
  8. UnsupportedOp,
  9. } from 'sentry/views/replays/detail/network/details/onboarding';
  10. import type {SectionProps} from 'sentry/views/replays/detail/network/details/sections';
  11. import {
  12. GeneralSection,
  13. QueryParamsSection,
  14. RequestHeadersSection,
  15. RequestPayloadSection,
  16. ResponseHeadersSection,
  17. ResponsePayloadSection,
  18. } from 'sentry/views/replays/detail/network/details/sections';
  19. type Props = Parameters<typeof getOutputType>[0] & SectionProps;
  20. export default function NetworkDetailsContent(props: Props) {
  21. const {visibleTab} = props;
  22. const output = getOutputType(props);
  23. switch (visibleTab) {
  24. case 'request':
  25. return (
  26. <OverflowFluidHeight>
  27. <SectionList>
  28. <QueryParamsSection {...props} />
  29. {output === Output.DATA && <RequestPayloadSection {...props} />}
  30. </SectionList>
  31. {[Output.SETUP, Output.URL_SKIPPED, Output.BODY_SKIPPED].includes(output) && (
  32. <Setup showSnippet={output} {...props} />
  33. )}
  34. {output === Output.UNSUPPORTED && <UnsupportedOp type="bodies" />}
  35. </OverflowFluidHeight>
  36. );
  37. case 'response':
  38. return (
  39. <OverflowFluidHeight>
  40. {output === Output.DATA && (
  41. <SectionList>
  42. <ResponsePayloadSection {...props} />
  43. </SectionList>
  44. )}
  45. {[Output.SETUP, Output.URL_SKIPPED, Output.BODY_SKIPPED].includes(output) && (
  46. <Setup showSnippet={output} {...props} />
  47. )}
  48. {output === Output.UNSUPPORTED && <UnsupportedOp type="bodies" />}
  49. </OverflowFluidHeight>
  50. );
  51. case 'details':
  52. default:
  53. return (
  54. <OverflowFluidHeight>
  55. <SectionList>
  56. <GeneralSection {...props} />
  57. {output === Output.DATA && <RequestHeadersSection {...props} />}
  58. {output === Output.DATA && <ResponseHeadersSection {...props} />}
  59. </SectionList>
  60. {[Output.SETUP, Output.URL_SKIPPED, Output.DATA].includes(output) && (
  61. <Setup showSnippet={output} {...props} />
  62. )}
  63. {output === Output.UNSUPPORTED && <UnsupportedOp type="headers" />}
  64. </OverflowFluidHeight>
  65. );
  66. }
  67. }
  68. const OverflowFluidHeight = styled(FluidHeight)`
  69. overflow: auto;
  70. `;
  71. const SectionList = styled('dl')`
  72. margin: 0;
  73. `;