index.tsx 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/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. features="starfish-browser-resource-module-ui"
  36. >
  37. <PageAlertProvider>
  38. <Layout.Header>
  39. <Layout.HeaderContent>
  40. <Breadcrumbs
  41. crumbs={[
  42. {
  43. label: 'Performance',
  44. to: normalizeUrl(`/organizations/${organization.slug}/performance/`),
  45. preservePageFilters: true,
  46. },
  47. {
  48. label: 'Resources',
  49. },
  50. ]}
  51. />
  52. <Layout.Title>{t('Resources')}</Layout.Title>
  53. </Layout.HeaderContent>
  54. </Layout.Header>
  55. <Layout.Body>
  56. <Layout.Main fullWidth>
  57. <FloatingFeedbackWidget />
  58. <PageAlert />
  59. <FilterOptionsContainer columnCount={2}>
  60. <PageFilterBar condensed>
  61. <ProjectPageFilter />
  62. <EnvironmentPageFilter />
  63. <DatePageFilter />
  64. </PageFilterBar>
  65. <DomainSelector
  66. emptyOptionLocation="top"
  67. value={filters[SPAN_DOMAIN] || ''}
  68. additionalQuery={[
  69. ...DEFAULT_RESOURCE_FILTERS,
  70. `${SPAN_OP}:[${DEFAULT_RESOURCE_TYPES.join(',')}]`,
  71. ]}
  72. />
  73. </FilterOptionsContainer>
  74. <ResourceView />
  75. </Layout.Main>
  76. </Layout.Body>
  77. </PageAlertProvider>
  78. </ModulePageProviders>
  79. );
  80. }
  81. export const PaddedContainer = styled('div')`
  82. margin-bottom: ${space(2)};
  83. `;
  84. export default ResourcesLandingPage;