index.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. return (
  27. <Feature
  28. features={['starfish-aggregate-span-waterfall']}
  29. organization={organization}
  30. renderDisabled={renderNoAccess}
  31. >
  32. <PageLayout
  33. location={location}
  34. organization={organization}
  35. projects={projects.projects}
  36. tab={Tab.AGGREGATE_WATERFALL}
  37. generateEventView={() => EventView.fromLocation(location)}
  38. getDocumentTitle={() => t(`Aggregate Waterfall: %s`, transaction)}
  39. childComponent={() => {
  40. return (
  41. <Layout.Main fullWidth>
  42. {defined(transaction) && <AggregateSpans transaction={transaction} />}
  43. </Layout.Main>
  44. );
  45. }}
  46. />
  47. </Feature>
  48. );
  49. }
  50. export default AggregateSpanWaterfall;