index.tsx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 FeatureBadge from 'sentry/components/badge/featureBadge';
  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 {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  10. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  11. import {t} from 'sentry/locale';
  12. import useOrganization from 'sentry/utils/useOrganization';
  13. import {Content} from './content';
  14. export const TRACE_EXPLORER_DOCS_URL = 'https://docs.sentry.io/product/explore/traces/';
  15. function TraceExplorerLandingPage() {
  16. return (
  17. <Fragment>
  18. <Layout.Header>
  19. <Layout.HeaderContent>
  20. <HeaderContentBar>
  21. <Layout.Title>
  22. {t('Traces')}
  23. <PageHeadingQuestionTooltip
  24. docsUrl={TRACE_EXPLORER_DOCS_URL}
  25. title={t(
  26. 'Traces lets you search for individual spans that make up a trace, linked by a trace id.'
  27. )}
  28. />
  29. <FeatureBadge type="beta" />
  30. </Layout.Title>
  31. <FeedbackWidgetButton />
  32. </HeaderContentBar>
  33. </Layout.HeaderContent>
  34. </Layout.Header>
  35. <Layout.Body>
  36. <Content />
  37. </Layout.Body>
  38. </Fragment>
  39. );
  40. }
  41. const HeaderContentBar = styled('div')`
  42. display: flex;
  43. align-items: center;
  44. justify-content: space-between;
  45. flex-direction: row;
  46. `;
  47. function NoAccess() {
  48. return (
  49. <Layout.Page withPadding>
  50. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  51. </Layout.Page>
  52. );
  53. }
  54. const DEFAULT_STATS_PERIOD = '24h';
  55. export default function TracesPage() {
  56. const organization = useOrganization();
  57. return (
  58. <SentryDocumentTitle title={t('Traces')} orgSlug={organization.slug}>
  59. <PageFiltersContainer
  60. defaultSelection={{
  61. datetime: {start: null, end: null, utc: null, period: DEFAULT_STATS_PERIOD},
  62. }}
  63. >
  64. <Layout.Page>
  65. <Feature
  66. features={['performance-trace-explorer']}
  67. organization={organization}
  68. renderDisabled={NoAccess}
  69. >
  70. <TraceExplorerLandingPage />
  71. </Feature>
  72. </Layout.Page>
  73. </PageFiltersContainer>
  74. </SentryDocumentTitle>
  75. );
  76. }