index.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 {Breadcrumbs} from 'sentry/components/breadcrumbs';
  6. import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton';
  7. import * as Layout from 'sentry/components/layouts/thirds';
  8. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  9. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  10. import {t} from 'sentry/locale';
  11. import useOrganization from 'sentry/utils/useOrganization';
  12. import {Content} from './content';
  13. function TraceExplorerLandingPage() {
  14. return (
  15. <Fragment>
  16. <Layout.Header>
  17. <Layout.HeaderContent>
  18. <Breadcrumbs
  19. crumbs={[
  20. {
  21. label: 'Traces',
  22. },
  23. ]}
  24. />
  25. <HeaderContentBar>
  26. <Layout.Title>{t('Traces')}</Layout.Title>
  27. <FeedbackWidgetButton />
  28. </HeaderContentBar>
  29. </Layout.HeaderContent>
  30. </Layout.Header>
  31. <Layout.Body>
  32. <Content />
  33. </Layout.Body>
  34. </Fragment>
  35. );
  36. }
  37. const HeaderContentBar = styled('div')`
  38. display: flex;
  39. align-items: center;
  40. justify-content: space-between;
  41. flex-direction: row;
  42. `;
  43. function NoAccess() {
  44. return (
  45. <Layout.Page withPadding>
  46. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  47. </Layout.Page>
  48. );
  49. }
  50. const DEFAULT_STATS_PERIOD = '24h';
  51. export default function TracesPage() {
  52. const organization = useOrganization();
  53. return (
  54. <SentryDocumentTitle title={t('Traces')} orgSlug={organization.slug}>
  55. <PageFiltersContainer
  56. defaultSelection={{
  57. datetime: {start: null, end: null, utc: null, period: DEFAULT_STATS_PERIOD},
  58. }}
  59. >
  60. <Layout.Page>
  61. <Feature
  62. features={['performance-trace-explorer']}
  63. organization={organization}
  64. renderDisabled={NoAccess}
  65. >
  66. <TraceExplorerLandingPage />
  67. </Feature>
  68. </Layout.Page>
  69. </PageFiltersContainer>
  70. </SentryDocumentTitle>
  71. );
  72. }