index.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import Feature from 'sentry/components/acl/feature';
  2. import Alert from 'sentry/components/alert';
  3. import {AggregateSpans} from 'sentry/components/events/interfaces/spans/aggregateSpans';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import {t} from 'sentry/locale';
  6. import {defined} from 'sentry/utils';
  7. import EventView from 'sentry/utils/discover/eventView';
  8. import {decodeScalar} from 'sentry/utils/queryString';
  9. import {useLocation} from 'sentry/utils/useLocation';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import useProjects from 'sentry/utils/useProjects';
  12. import Tab from 'sentry/views/performance/transactionSummary/tabs';
  13. import PageLayout from '../pageLayout';
  14. function renderNoAccess() {
  15. return (
  16. <Layout.Page withPadding>
  17. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  18. </Layout.Page>
  19. );
  20. }
  21. function AggregateSpanWaterfall(): React.ReactElement {
  22. const location = useLocation();
  23. const organization = useOrganization();
  24. const projects = useProjects();
  25. const transaction = decodeScalar(location.query.transaction);
  26. const httpMethod = decodeScalar(location.query['http.method']);
  27. return (
  28. <Feature
  29. features={['starfish-aggregate-span-waterfall']}
  30. organization={organization}
  31. renderDisabled={renderNoAccess}
  32. >
  33. <PageLayout
  34. location={location}
  35. organization={organization}
  36. projects={projects.projects}
  37. tab={Tab.AGGREGATE_WATERFALL}
  38. generateEventView={() => EventView.fromLocation(location)}
  39. getDocumentTitle={() => t(`Aggregate Spans: %s`, transaction)}
  40. childComponent={() => {
  41. return (
  42. <Layout.Main fullWidth>
  43. {defined(transaction) && (
  44. <AggregateSpans transaction={transaction} httpMethod={httpMethod} />
  45. )}
  46. </Layout.Main>
  47. );
  48. }}
  49. />
  50. </Feature>
  51. );
  52. }
  53. export default AggregateSpanWaterfall;