databaseLandingPage.tsx 3.4 KB

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