resourcesLandingPage.tsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import React, {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import * as Layout from 'sentry/components/layouts/thirds';
  4. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  5. import {space} from 'sentry/styles/space';
  6. import {PageAlert, PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
  7. import {DEFAULT_RESOURCE_FILTERS} from 'sentry/views/insights/browser/common/queries/useResourcesQuery';
  8. import ResourceView from 'sentry/views/insights/browser/resources/components/resourceView';
  9. import {
  10. DEFAULT_RESOURCE_TYPES,
  11. MODULE_DESCRIPTION,
  12. MODULE_DOC_LINK,
  13. MODULE_TITLE,
  14. } from 'sentry/views/insights/browser/resources/settings';
  15. import {
  16. BrowserStarfishFields,
  17. useResourceModuleFilters,
  18. } from 'sentry/views/insights/browser/resources/utils/useResourceFilters';
  19. import {HeaderContainer} from 'sentry/views/insights/common/components/headerContainer';
  20. import {ModulePageFilterBar} from 'sentry/views/insights/common/components/modulePageFilterBar';
  21. import {ModulePageProviders} from 'sentry/views/insights/common/components/modulePageProviders';
  22. import {ModulesOnboarding} from 'sentry/views/insights/common/components/modulesOnboarding';
  23. import {ModuleBodyUpsellHook} from 'sentry/views/insights/common/components/moduleUpsellHookWrapper';
  24. import {ToolRibbon} from 'sentry/views/insights/common/components/ribbon';
  25. import {DomainSelector} from 'sentry/views/insights/common/views/spans/selectors/domainSelector';
  26. import SubregionSelector from 'sentry/views/insights/common/views/spans/selectors/subregionSelector';
  27. import {FrontendHeader} from 'sentry/views/insights/pages/frontend/frontendPageHeader';
  28. import {ModuleName} from 'sentry/views/insights/types';
  29. const {SPAN_OP, SPAN_DOMAIN} = BrowserStarfishFields;
  30. function ResourcesLandingPage() {
  31. const filters = useResourceModuleFilters();
  32. return (
  33. <React.Fragment>
  34. <PageAlertProvider>
  35. <FrontendHeader
  36. headerTitle={
  37. <Fragment>
  38. {MODULE_TITLE}
  39. <PageHeadingQuestionTooltip
  40. docsUrl={MODULE_DOC_LINK}
  41. title={MODULE_DESCRIPTION}
  42. />
  43. </Fragment>
  44. }
  45. module={ModuleName.RESOURCE}
  46. />
  47. <ModuleBodyUpsellHook moduleName={ModuleName.RESOURCE}>
  48. <Layout.Body>
  49. <Layout.Main fullWidth>
  50. <PageAlert />
  51. <StyledHeaderContainer>
  52. <ToolRibbon>
  53. <ModulePageFilterBar
  54. moduleName={ModuleName.RESOURCE}
  55. extraFilters={
  56. <Fragment>
  57. <DomainSelector
  58. moduleName={ModuleName.RESOURCE}
  59. emptyOptionLocation="top"
  60. value={filters[SPAN_DOMAIN] || ''}
  61. additionalQuery={[
  62. ...DEFAULT_RESOURCE_FILTERS,
  63. `${SPAN_OP}:[${DEFAULT_RESOURCE_TYPES.join(',')}]`,
  64. ]}
  65. />
  66. <SubregionSelector />
  67. </Fragment>
  68. }
  69. />
  70. </ToolRibbon>
  71. </StyledHeaderContainer>
  72. <ModulesOnboarding moduleName={ModuleName.RESOURCE}>
  73. <ResourceView />
  74. </ModulesOnboarding>
  75. </Layout.Main>
  76. </Layout.Body>
  77. </ModuleBodyUpsellHook>
  78. </PageAlertProvider>
  79. </React.Fragment>
  80. );
  81. }
  82. function PageWithProviders() {
  83. return (
  84. <ModulePageProviders
  85. moduleName="resource"
  86. analyticEventName="insight.page_loads.assets"
  87. >
  88. <ResourcesLandingPage />
  89. </ModulePageProviders>
  90. );
  91. }
  92. const StyledHeaderContainer = styled(HeaderContainer)`
  93. margin-bottom: ${space(2)};
  94. `;
  95. export default PageWithProviders;
  96. export const PaddedContainer = styled('div')`
  97. margin-bottom: ${space(2)};
  98. `;