index.tsx 3.3 KB

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