appStartup.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import {useCallback} from 'react';
  2. import {browserHistory} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import omit from 'lodash/omit';
  5. import Feature from 'sentry/components/acl/feature';
  6. import {Breadcrumbs} from 'sentry/components/breadcrumbs';
  7. import ErrorBoundary from 'sentry/components/errorBoundary';
  8. import FloatingFeedbackWidget from 'sentry/components/feedback/widget/floatingFeedbackWidget';
  9. import * as Layout from 'sentry/components/layouts/thirds';
  10. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  11. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  12. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  13. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  14. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  15. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  16. import {t} from 'sentry/locale';
  17. import {space} from 'sentry/styles/space';
  18. import {PageAlert, PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
  19. import {useLocation} from 'sentry/utils/useLocation';
  20. import useOrganization from 'sentry/utils/useOrganization';
  21. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  22. import {useOnboardingProject} from 'sentry/views/performance/browser/webVitals/utils/useOnboardingProject';
  23. import Onboarding from 'sentry/views/performance/onboarding';
  24. import {ReleaseComparisonSelector} from 'sentry/views/starfish/components/releaseSelector';
  25. import {ROUTE_NAMES} from 'sentry/views/starfish/utils/routeNames';
  26. import AppStartup from 'sentry/views/starfish/views/appStartup';
  27. import {StartTypeSelector} from 'sentry/views/starfish/views/appStartup/screenSummary/startTypeSelector';
  28. export default function InitializationModule() {
  29. const organization = useOrganization();
  30. const onboardingProject = useOnboardingProject();
  31. const location = useLocation();
  32. const handleProjectChange = useCallback(() => {
  33. browserHistory.replace({
  34. ...location,
  35. query: {
  36. ...omit(location.query, ['primaryRelease', 'secondaryRelease']),
  37. },
  38. });
  39. }, [location]);
  40. return (
  41. <Feature features="starfish-mobile-appstart" organization={organization}>
  42. <SentryDocumentTitle title={ROUTE_NAMES['app-startup']} orgSlug={organization.slug}>
  43. <Layout.Page>
  44. <PageAlertProvider>
  45. <Layout.Header>
  46. <Layout.HeaderContent>
  47. <Breadcrumbs
  48. crumbs={[
  49. {
  50. label: t('Performance'),
  51. to: normalizeUrl(
  52. `/organizations/${organization.slug}/performance/`
  53. ),
  54. preservePageFilters: true,
  55. },
  56. {
  57. label: ROUTE_NAMES['app-startup'],
  58. },
  59. ]}
  60. />
  61. <Layout.Title>{ROUTE_NAMES['app-startup']}</Layout.Title>
  62. </Layout.HeaderContent>
  63. </Layout.Header>
  64. <Layout.Body>
  65. <FloatingFeedbackWidget />
  66. <Layout.Main fullWidth>
  67. <PageAlert />
  68. <PageFiltersContainer>
  69. <Container>
  70. <PageFilterBar condensed>
  71. <ProjectPageFilter onChange={handleProjectChange} />
  72. <EnvironmentPageFilter />
  73. <DatePageFilter />
  74. </PageFilterBar>
  75. <ReleaseComparisonSelector />
  76. <StartTypeSelector />
  77. </Container>
  78. </PageFiltersContainer>
  79. <ErrorBoundary mini>
  80. {onboardingProject && (
  81. <Onboarding organization={organization} project={onboardingProject} />
  82. )}
  83. {!onboardingProject && <AppStartup chartHeight={200} />}
  84. </ErrorBoundary>
  85. </Layout.Main>
  86. </Layout.Body>
  87. </PageAlertProvider>
  88. </Layout.Page>
  89. </SentryDocumentTitle>
  90. </Feature>
  91. );
  92. }
  93. const Container = styled('div')`
  94. display: flex;
  95. gap: ${space(2)};
  96. margin-bottom: ${space(2)};
  97. flex-wrap: wrap;
  98. `;