index.tsx 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import styled from '@emotion/styled';
  2. import Breadcrumbs from 'sentry/components/breadcrumbs';
  3. import FloatingFeedbackWidget from 'sentry/components/feedback/widget/floatingFeedbackWidget';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  6. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  7. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  8. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  9. import {t} from 'sentry/locale';
  10. import {space} from 'sentry/styles/space';
  11. import {RateUnits} from 'sentry/utils/discover/fields';
  12. import {
  13. PageErrorAlert,
  14. PageErrorProvider,
  15. } from 'sentry/utils/performance/contexts/pageError';
  16. import useOrganization from 'sentry/utils/useOrganization';
  17. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  18. import ResourceView, {
  19. DEFAULT_RESOURCE_TYPES,
  20. FilterOptionsContainer,
  21. } from 'sentry/views/performance/browser/resources/resourceView';
  22. import {
  23. BrowserStarfishFields,
  24. useResourceModuleFilters,
  25. } from 'sentry/views/performance/browser/resources/utils/useResourceFilters';
  26. import {DEFAULT_RESOURCE_FILTERS} from 'sentry/views/performance/browser/resources/utils/useResourcesQuery';
  27. import {ModulePageProviders} from 'sentry/views/performance/database/modulePageProviders';
  28. import {DomainSelector} from 'sentry/views/starfish/views/spans/selectors/domainSelector';
  29. const {SPAN_OP, SPAN_DOMAIN} = BrowserStarfishFields;
  30. export const RESOURCE_THROUGHPUT_UNIT = RateUnits.PER_MINUTE;
  31. function ResourcesLandingPage() {
  32. const organization = useOrganization();
  33. const filters = useResourceModuleFilters();
  34. return (
  35. <ModulePageProviders
  36. title={[t('Performance'), t('Resources')].join(' — ')}
  37. baseURL="/performance/browser/resources"
  38. >
  39. <PageErrorProvider>
  40. <Layout.Header>
  41. <Layout.HeaderContent>
  42. <Breadcrumbs
  43. crumbs={[
  44. {
  45. label: 'Performance',
  46. to: normalizeUrl(`/organizations/${organization.slug}/performance/`),
  47. preservePageFilters: true,
  48. },
  49. {
  50. label: 'Resources',
  51. },
  52. ]}
  53. />
  54. <Layout.Title>{t('Resources')}</Layout.Title>
  55. </Layout.HeaderContent>
  56. </Layout.Header>
  57. <Layout.Body>
  58. <Layout.Main fullWidth>
  59. <FloatingFeedbackWidget />
  60. <PageErrorAlert />
  61. <FilterOptionsContainer columnCount={2}>
  62. <PageFilterBar condensed>
  63. <ProjectPageFilter />
  64. <EnvironmentPageFilter />
  65. <DatePageFilter />
  66. </PageFilterBar>
  67. <DomainSelector
  68. emptyOptionLocation="top"
  69. value={filters[SPAN_DOMAIN] || ''}
  70. additionalQuery={[
  71. ...DEFAULT_RESOURCE_FILTERS,
  72. `${SPAN_OP}:[${DEFAULT_RESOURCE_TYPES.join(',')}]`,
  73. ]}
  74. />
  75. </FilterOptionsContainer>
  76. <ResourceView />
  77. </Layout.Main>
  78. </Layout.Body>
  79. </PageErrorProvider>
  80. </ModulePageProviders>
  81. );
  82. }
  83. export const PaddedContainer = styled('div')`
  84. margin-bottom: ${space(2)};
  85. `;
  86. export default ResourcesLandingPage;