index.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import {RouteComponentProps} from 'react-router';
  2. import {Project} from 'sentry/types';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. import ProjectSourceMapsDetail from 'sentry/views/settings/projectSourceMaps/detail';
  5. import ProjectSourceMapsList from 'sentry/views/settings/projectSourceMaps/list';
  6. import {ProjectSourceMaps} from './projectSourceMaps';
  7. import {ProjectSourceMapsArtifacts} from './projectSourceMapsArtifacts';
  8. type Props = RouteComponentProps<
  9. {orgId: string; projectId: string; bundleId?: string; name?: string},
  10. {}
  11. > & {
  12. children: React.ReactNode;
  13. project: Project;
  14. };
  15. export function ProjectSourceMapsContainer({params, location, ...props}: Props) {
  16. const organization = useOrganization();
  17. const sourceMapsDebugIds = organization.features.includes('source-maps-debug-ids');
  18. if (!sourceMapsDebugIds) {
  19. if (params.name) {
  20. return (
  21. <ProjectSourceMapsDetail
  22. {...props}
  23. location={location}
  24. params={{...params, name: params.name}}
  25. organization={organization}
  26. />
  27. );
  28. }
  29. return (
  30. <ProjectSourceMapsList
  31. {...props}
  32. location={location}
  33. params={params}
  34. organization={organization}
  35. />
  36. );
  37. }
  38. if (params.bundleId) {
  39. return (
  40. <ProjectSourceMapsArtifacts
  41. {...props}
  42. location={location}
  43. params={{...params, bundleId: params.bundleId}}
  44. />
  45. );
  46. }
  47. return <ProjectSourceMaps {...props} location={location} params={params} />;
  48. }