databaseLandingPage.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import styled from '@emotion/styled';
  2. import Breadcrumbs from 'sentry/components/breadcrumbs';
  3. import DatePageFilter from 'sentry/components/datePageFilter';
  4. import FeatureBadge from 'sentry/components/featureBadge';
  5. import * as Layout from 'sentry/components/layouts/thirds';
  6. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  7. import ProjectPageFilter from 'sentry/components/projectPageFilter';
  8. import {t} from 'sentry/locale';
  9. import {space} from 'sentry/styles/space';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  12. import {ModulePageProviders} from 'sentry/views/performance/database/modulePageProviders';
  13. import {RELEASE_LEVEL} from 'sentry/views/performance/database/settings';
  14. import {ModuleName, SpanMetricsField} from 'sentry/views/starfish/types';
  15. import {QueryParameterNames} from 'sentry/views/starfish/views/queryParameters';
  16. import {ActionSelector} from 'sentry/views/starfish/views/spans/selectors/actionSelector';
  17. import {DomainSelector} from 'sentry/views/starfish/views/spans/selectors/domainSelector';
  18. import SpansTable from 'sentry/views/starfish/views/spans/spansTable';
  19. import {SpanTimeCharts} from 'sentry/views/starfish/views/spans/spanTimeCharts';
  20. import {useModuleFilters} from 'sentry/views/starfish/views/spans/useModuleFilters';
  21. import {useModuleSort} from 'sentry/views/starfish/views/spans/useModuleSort';
  22. function DatabaseLandingPage() {
  23. const organization = useOrganization();
  24. const moduleName = ModuleName.DB;
  25. const moduleFilters = useModuleFilters();
  26. const sort = useModuleSort(QueryParameterNames.SPANS_SORT);
  27. return (
  28. <ModulePageProviders title={[t('Performance'), t('Database')].join(' — ')}>
  29. <Layout.Header>
  30. <Layout.HeaderContent>
  31. <Breadcrumbs
  32. crumbs={[
  33. {
  34. label: 'Performance',
  35. to: normalizeUrl(`/organizations/${organization.slug}/performance/`),
  36. preservePageFilters: true,
  37. },
  38. {
  39. label: 'Database',
  40. },
  41. ]}
  42. />
  43. <Layout.Title>
  44. {t('Database')}
  45. <FeatureBadge type={RELEASE_LEVEL} />
  46. </Layout.Title>
  47. </Layout.HeaderContent>
  48. </Layout.Header>
  49. <Layout.Body>
  50. <Layout.Main fullWidth>
  51. <PaddedContainer>
  52. <PageFilterBar condensed>
  53. <ProjectPageFilter />
  54. <DatePageFilter alignDropdown="left" />
  55. </PageFilterBar>
  56. </PaddedContainer>
  57. <SpanTimeCharts moduleName={moduleName} appliedFilters={moduleFilters} />
  58. <FilterOptionsContainer>
  59. <ActionSelector
  60. moduleName={moduleName}
  61. value={moduleFilters[SpanMetricsField.SPAN_ACTION] || ''}
  62. />
  63. <DomainSelector
  64. moduleName={moduleName}
  65. value={moduleFilters[SpanMetricsField.SPAN_DOMAIN] || ''}
  66. />
  67. </FilterOptionsContainer>
  68. <SpansTable moduleName={moduleName} sort={sort} limit={LIMIT} />
  69. </Layout.Main>
  70. </Layout.Body>
  71. </ModulePageProviders>
  72. );
  73. }
  74. const PaddedContainer = styled('div')`
  75. margin-bottom: ${space(2)};
  76. `;
  77. const FilterOptionsContainer = styled('div')`
  78. display: grid;
  79. grid-template-columns: repeat(3, 1fr);
  80. gap: ${space(2)};
  81. margin-bottom: ${space(2)};
  82. max-width: 800px;
  83. `;
  84. const LIMIT: number = 25;
  85. export default DatabaseLandingPage;