index.tsx 2.5 KB

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