index.tsx 2.2 KB

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