index.tsx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import styled from '@emotion/styled';
  2. import Feature from 'sentry/components/acl/feature';
  3. import {Alert} from 'sentry/components/core/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.Container>
  23. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  24. </Alert.Container>
  25. </Layout.Page>
  26. );
  27. }
  28. function AggregateSpanWaterfall(): React.ReactElement {
  29. const location = useLocation();
  30. const organization = useOrganization();
  31. const projects = useProjects();
  32. const transaction = decodeScalar(location.query.transaction);
  33. const httpMethod = decodeScalar(location.query['http.method']);
  34. return (
  35. <Feature
  36. features="insights-initial-modules"
  37. organization={organization}
  38. renderDisabled={renderNoAccess}
  39. >
  40. <PageLayout
  41. location={location}
  42. organization={organization}
  43. projects={projects.projects}
  44. tab={Tab.AGGREGATE_WATERFALL}
  45. generateEventView={() => EventView.fromLocation(location)}
  46. getDocumentTitle={() => t(`Aggregate Spans: %s`, transaction)}
  47. childComponent={() => {
  48. return (
  49. <Layout.Main fullWidth>
  50. <Container>
  51. <PageFilterBar condensed>
  52. <EnvironmentPageFilter />
  53. <DatePageFilter />
  54. </PageFilterBar>
  55. </Container>
  56. {defined(transaction) && (
  57. <AggregateSpans transaction={transaction} httpMethod={httpMethod} />
  58. )}
  59. </Layout.Main>
  60. );
  61. }}
  62. />
  63. </Feature>
  64. );
  65. }
  66. export default AggregateSpanWaterfall;
  67. const Container = styled('div')`
  68. margin-bottom: ${space(2)};
  69. `;