ddm.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import styled from '@emotion/styled';
  2. import ButtonBar from 'sentry/components/buttonBar';
  3. import {CompactSelect} from 'sentry/components/compactSelect';
  4. import EnvironmentPageFilter from 'sentry/components/environmentPageFilter';
  5. import FeatureBadge from 'sentry/components/featureBadge';
  6. import {FeatureFeedback} from 'sentry/components/featureFeedback';
  7. import * as Layout from 'sentry/components/layouts/thirds';
  8. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  9. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  10. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  11. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  12. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  13. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  14. import {t} from 'sentry/locale';
  15. import {space} from 'sentry/styles/space';
  16. import {defaultMetricDisplayType, MetricDisplayType} from 'sentry/utils/metrics';
  17. import useOrganization from 'sentry/utils/useOrganization';
  18. import useRouter from 'sentry/utils/useRouter';
  19. import MetricsExplorer from 'sentry/views/ddm/metricsExplorer';
  20. function DDM() {
  21. const organization = useOrganization();
  22. const router = useRouter();
  23. return (
  24. <SentryDocumentTitle title={t('DDM')} orgSlug={organization.slug}>
  25. <PageFiltersContainer>
  26. <Layout.Page>
  27. <Layout.Header>
  28. <Layout.HeaderContent>
  29. <Layout.Title>
  30. {t('DDM')}
  31. <PageHeadingQuestionTooltip
  32. docsUrl="https://docs.sentry.io"
  33. title={t('Delightful Developer Metrics.')}
  34. />
  35. <FeatureBadge type="alpha" />
  36. </Layout.Title>
  37. </Layout.HeaderContent>
  38. <Layout.HeaderActions>
  39. <ButtonBar gap={1}>
  40. <FeatureFeedback featureName="DDM" buttonProps={{size: 'sm'}} />
  41. </ButtonBar>
  42. </Layout.HeaderActions>
  43. </Layout.Header>
  44. <Layout.Body>
  45. <Layout.Main fullWidth>
  46. <PaddedContainer>
  47. <PageFilterBar condensed>
  48. <ProjectPageFilter />
  49. <EnvironmentPageFilter />
  50. <DatePageFilter />
  51. </PageFilterBar>
  52. <CompactSelect
  53. triggerProps={{prefix: t('Display')}}
  54. value={router.location.query.display ?? defaultMetricDisplayType}
  55. options={[
  56. {
  57. value: MetricDisplayType.LINE,
  58. label: t('Line Chart'),
  59. },
  60. {
  61. value: MetricDisplayType.AREA,
  62. label: t('Area Chart'),
  63. },
  64. {
  65. value: MetricDisplayType.BAR,
  66. label: t('Bar Chart'),
  67. },
  68. ]}
  69. onChange={({value}) => {
  70. router.push({
  71. ...router.location,
  72. query: {
  73. ...router.location.query,
  74. cursor: undefined,
  75. display: value,
  76. },
  77. });
  78. }}
  79. />
  80. </PaddedContainer>
  81. <MetricsExplorer />
  82. </Layout.Main>
  83. </Layout.Body>
  84. </Layout.Page>
  85. </PageFiltersContainer>
  86. </SentryDocumentTitle>
  87. );
  88. }
  89. export const PaddedContainer = styled('div')`
  90. margin-bottom: ${space(2)};
  91. display: grid;
  92. grid-template: 1fr / 1fr max-content;
  93. gap: ${space(1)};
  94. @media (max-width: ${props => props.theme.breakpoints.small}) {
  95. grid-template: 1fr 1fr / 1fr;
  96. }
  97. `;
  98. export default DDM;