import {Fragment, lazy} from 'react'; import memoize from 'lodash/memoize'; import LazyLoad from 'sentry/components/lazyLoad'; import {EXPERIMENTAL_SPA, USING_CUSTOMER_DOMAIN} from 'sentry/constants'; import {t} from 'sentry/locale'; import HookStore from 'sentry/stores/hookStore'; import type {HookName} from 'sentry/types/hooks'; import errorHandler from 'sentry/utils/errorHandler'; import retryableImport from 'sentry/utils/retryableImport'; import withDomainRedirect from 'sentry/utils/withDomainRedirect'; import withDomainRequired from 'sentry/utils/withDomainRequired'; import App from 'sentry/views/app'; import AuthLayout from 'sentry/views/auth/layout'; import {MODULE_BASE_URLS} from 'sentry/views/insights/common/utils/useModuleURL'; import {SUMMARY_PAGE_BASE_URL} from 'sentry/views/insights/mobile/screenRendering/settings'; import {AI_LANDING_SUB_PATH} from 'sentry/views/insights/pages/ai/settings'; import {BACKEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/backend/settings'; import {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings'; import {MOBILE_LANDING_SUB_PATH} from 'sentry/views/insights/pages/mobile/settings'; import {DOMAIN_VIEW_BASE_URL} from 'sentry/views/insights/pages/settings'; import {getModuleView} from 'sentry/views/insights/pages/utils'; import {INSIGHTS_BASE_URL} from 'sentry/views/insights/settings'; import {ModuleName} from 'sentry/views/insights/types'; import {GroupEventDetailsLoading} from 'sentry/views/issueDetails/groupEventDetails/groupEventDetailsLoading'; import {Tab, TabPaths} from 'sentry/views/issueDetails/types'; import IssueListContainer from 'sentry/views/issueList'; import IssueListOverview from 'sentry/views/issueList/overview'; import OrganizationContainer from 'sentry/views/organizationContainer'; import OrganizationLayout from 'sentry/views/organizationLayout'; import OrganizationRoot from 'sentry/views/organizationRoot'; import ProjectEventRedirect from 'sentry/views/projectEventRedirect'; import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute'; import RouteNotFound from 'sentry/views/routeNotFound'; import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper'; import {IndexRedirect, IndexRoute, Redirect, Route} from './components/route'; const hook = (name: HookName) => HookStore.get(name).map(cb => cb()); // LazyExoticComponent Props get crazy when wrapped in an additional layer const SafeLazyLoad = errorHandler(LazyLoad) as unknown as React.ComponentType< typeof LazyLoad >; // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry) // pirvate routing tree. /** * Factory function to produce a component that will render the SafeLazyLoad * _with_ the required props. */ export function makeLazyloadComponent>( resolve: () => Promise<{default: C}>, loadingFallback?: React.ReactNode ) { const LazyComponent = lazy(() => retryableImport(resolve)); // XXX: Assign the component to a variable so it has a displayname function RouteLazyLoad(props: React.ComponentProps) { // we can use this hook to set the organization as it's // a child of the organization context return ( ); } return RouteLazyLoad; } // Shorthand to avoid extra line wrapping const make = makeLazyloadComponent; function buildRoutes() { // Read this to understand where to add new routes, how / why the routing // tree is structured the way it is, and how the lazy-loading / // code-splitting works for pages. // // ## Formatting // // NOTE that there are intentionally NO blank lines within route tree blocks. // This helps make it easier to navigate within the file by using your // editors shortcuts to jump between 'paragraphs' of code. // // [!!] Do NOT add blank lines within route blocks to preserve this behavior! // // // ## Lazy loading // // * The `SafeLazyLoad` component // // Most routes are rendered as LazyLoad components (SafeLazyLoad is the // errorHandler wrapped version). This means the rendered component for the // route will only be loaded when the route is loaded. This helps us // "code-split" the app. // // ## Hooks // // There are a number of `hook()` routes placed within the routing tree to // allow for additional routes to be augmented into the application via the // hookStore mechanism. // // // ## The structure // // * `experimentalSpaRoutes` // // These routes are specifically for the experimental single-page-app mode, // where Sentry is run separate from Django. These are NOT part of the root // component. // // Right now these are mainly used for authentication pages. In the future // they would be used for other pages like registration. // // * `rootRoutes` // // These routes live directly under the container, and generally // are not specific to an organization. // // * `settingsRoutes` // // This is the route tree for all of `/settings/`. This route tree is // composed of a few different sub-trees. // // - `accountSettingsRoutes` User specific settings // - `orgSettingsRoutes` Specific to a organization // - `projectSettingsRoutes` Specific to a project // - `legacySettingsRedirects` Routes that used to exist in settings // // * `organizationRoutes` // // This is where a majority of the app routes live. This is wrapped with // the component, which renders the sidebar and // loads the organiztion into context (though in some cases, there may be // no organiztion) // // When adding new top-level organization routes, be sure the top level // route includes withOrgPath to support installs that are not using // customer domains. // // Within these routes are a variety of subroutes. They are not all // listed here as the subroutes will be added and removed, and most are // self explanatory. // // * `legacyRedirectRoutes` // // This route tree contains routes for many old legacy paths. // // You may also find 's collocated next to the feature routes // they have redirects for. A good rule here is to place 'helper' redirects // next to the routes they redirect to, and place 'legacy route' redirects // for routes that have completely changed in this tree. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? ( import('sentry/views/auth/login'))} /> import('sentry/views/auth/login'))} /> ) : null; const rootRoutes = ( import('sentry/views/app/root'))} /> {hook('routes:root')} import('sentry/views/acceptOrganizationInvite'))} /> import('sentry/views/acceptOrganizationInvite'))} /> import('sentry/views/acceptProjectTransfer'))} /> import('sentry/views/integrationOrganizationLink'))} /> import('sentry/views/integrationOrganizationLink'))} /> import('sentry/views/sentryAppExternalInstallation'))} /> {/* TODO: remove share/issue orgless url */} import('sentry/views/sharedGroupDetails'))} /> import('sentry/views/sharedGroupDetails'))} /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/unsubscribe/project'))} /> )} import('sentry/views/unsubscribe/project'))} /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/unsubscribe/issue'))} /> )} import('sentry/views/unsubscribe/issue'))} /> import('sentry/views/organizationCreate'))} /> import('sentry/views/dataExport/dataDownload'))} withOrgPath /> import('sentry/views/disabledMember'))} withOrgPath /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/organizationRestore'))} /> )} import('sentry/views/organizationRestore'))} /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/organizationJoinRequest')) )} key="orgless-join-request" /> )} import('sentry/views/organizationJoinRequest')) )} key="org-join-request" /> import('sentry/views/relocation'))} key="orgless-relocation" > import('sentry/views/relocation'))} /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/onboarding'))} /> )} import('sentry/views/onboarding'))} /> import('sentry/views/stories/index'))} withOrgPath /> ); const accountSettingsRoutes = ( import('sentry/views/settings/account/accountSettingsLayout') )} > import('sentry/views/settings/account/accountDetails'))} /> import( 'sentry/views/settings/account/notifications/notificationSettingsController' ) )} /> import( 'sentry/views/settings/account/accountNotificationFineTuningController' ) )} /> import('sentry/views/settings/account/accountEmails'))} /> import('sentry/views/settings/account/accountAuthorizations') )} /> import( 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper' ) )} > import('sentry/views/settings/account/accountSecurity') )} /> import('sentry/views/settings/account/accountSecurity/sessionHistory') )} /> import( 'sentry/views/settings/account/accountSecurity/accountSecurityDetails' ) )} /> import( 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll' ) )} /> import('sentry/views/settings/account/accountSubscriptions') )} /> import('sentry/views/settings/account/accountIdentities'))} /> import('sentry/views/settings/account/apiTokens'))} /> import('sentry/views/settings/account/apiNewToken'))} /> import('sentry/views/settings/account/apiTokenDetails') )} /> import('sentry/views/settings/account/apiApplications') )} /> import('sentry/views/settings/account/apiApplications/details') )} /> import('sentry/views/settings/account/accountClose'))} /> ); const projectSettingsRoutes = ( import('sentry/views/settings/project/projectSettingsLayout') )} > import('sentry/views/settings/projectGeneralSettings'))} /> import('sentry/views/settings/project/projectTeams'))} /> import('sentry/views/settings/projectAlerts'))} > import('sentry/views/settings/projectAlerts/settings'))} /> import('sentry/views/settings/project/projectEnvironments') )} > import('sentry/views/settings/projectTags'))} /> import('sentry/views/settings/project/projectReleaseTracking') )} /> import('sentry/views/settings/project/projectOwnership'))} /> import('sentry/views/settings/projectDataForwarding'))} /> import('sentry/views/settings/projectUserFeedback'))} /> import('sentry/views/settings/projectSecurityAndPrivacy') )} /> import('sentry/views/settings/projectSecurityAndPrivacy') )} /> import('sentry/views/settings/projectDebugFiles'))} /> import('sentry/views/settings/projectProguard'))} /> import('sentry/views/settings/projectPerformance'))} /> import('sentry/views/settings/projectMetrics'))} /> import('sentry/views/settings/projectMetrics/projectMetricsDetails') )} /> import('sentry/views/settings/project/projectReplays'))} /> import('sentry/views/settings/project/projectToolbar'))} /> import('sentry/views/settings/projectSourceMaps'))} /> import('sentry/views/settings/projectSourceMaps'))} /> import('sentry/views/settings/project/projectFilters'))} > import('sentry/views/settings/projectIssueGrouping'))} /> import('sentry/views/settings/project/projectServiceHooks') )} /> import('sentry/views/settings/project/projectCreateServiceHook') )} /> import('sentry/views/settings/project/projectServiceHookDetails') )} /> import('sentry/views/settings/project/projectKeys/list'))} /> import('sentry/views/settings/project/projectKeys/details') )} /> import('sentry/views/settings/project/loaderScript'))} /> import('sentry/views/settings/projectSecurityHeaders'))} /> import('sentry/views/settings/projectSecurityHeaders/csp') )} /> import('sentry/views/settings/projectSecurityHeaders/expectCt') )} /> import('sentry/views/settings/projectSecurityHeaders/hpkp') )} /> import('sentry/views/settings/projectPlugins'))} /> import('sentry/views/settings/projectPlugins/details'))} /> ); const orgSettingsRoutes = ( import('sentry/views/settings/organization/organizationSettingsLayout') )} > {hook('routes:settings')} {!USING_CUSTOMER_DOMAIN && ( import('sentry/views/settings/organizationGeneralSettings') )} /> )} import('sentry/views/settings/organizationGeneralSettings') )} /> import('sentry/views/settings/organizationProjects'))} /> import('sentry/views/settings/organizationApiKeys'))} /> import( 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails' ) )} /> import('sentry/views/settings/organizationAuditLog'))} /> import('sentry/views/settings/organizationAuth'))} /> import('sentry/views/settings/organizationMembers/organizationMembersList') )} /> import('sentry/views/settings/organizationMembers/organizationMemberDetail') )} /> import('sentry/views/settings/organizationRateLimits'))} /> import('sentry/views/settings/organizationRelay'))} /> import('sentry/views/settings/organizationRepositories'))} /> import('sentry/views/settings/organizationGeneralSettings') )} /> import('sentry/views/settings/organizationSecurityAndPrivacy') )} /> import('sentry/views/settings/organizationSecurityAndPrivacy') )} /> import('sentry/views/settings/organizationTeams'))} /> import('sentry/views/settings/organizationTeams/teamDetails') )} > import('sentry/views/settings/organizationTeams/teamMembers') )} /> import('sentry/views/settings/organizationTeams/teamNotifications') )} /> import('sentry/views/settings/organizationTeams/teamProjects') )} /> import('sentry/views/settings/organizationTeams/teamSettings') )} /> import('sentry/views/settings/organizationIntegrations/pluginDetailedView') )} /> import( 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView' ) )} /> import( 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView' ) )} /> import( 'sentry/views/settings/organizationIntegrations/integrationListDirectory' ) )} /> import( 'sentry/views/settings/organizationIntegrations/integrationDetailedView' ) )} /> import( 'sentry/views/settings/organizationIntegrations/configureIntegration' ) )} /> import('sentry/views/settings/organizationDeveloperSettings') )} /> import( 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails' ) )} /> import( 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails' ) )} /> import( 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails' ) )} /> import( 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard' ) )} /> import('sentry/views/settings/organizationAuthTokens'))} /> import('sentry/views/settings/organizationAuthTokens/newAuthToken') )} /> import('sentry/views/settings/organizationAuthTokens/authTokenDetails') )} /> import('sentry/views/settings/earlyFeatures'))} /> import('sentry/views/settings/dynamicSampling'))} /> ); const legacySettingsRedirects = ( ); const settingsRoutes = ( import('sentry/views/settings/settingsIndex'))} /> {accountSettingsRoutes} {USING_CUSTOMER_DOMAIN && ( {orgSettingsRoutes} {projectSettingsRoutes} )} {orgSettingsRoutes} {projectSettingsRoutes} {legacySettingsRedirects} ); const projectsRoutes = ( import('sentry/views/projects/'))} withOrgPath > import('sentry/views/projectsDashboard'))} /> import('sentry/views/projectInstall/newProject'))} /> import('sentry/views/projectDetail'))} /> import('sentry/views/projectInstall/platformOrIntegration') )} /> ); const dashboardRoutes = ( {USING_CUSTOMER_DOMAIN && ( import('sentry/views/dashboards')))} key="orgless-dashboards-route" > import('sentry/views/dashboards/manage'))} /> )} import('sentry/views/dashboards')))} key="org-dashboards" > import('sentry/views/dashboards/manage'))} /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/dashboards/create')) )} key="orgless-dashboards-new-route" > {/* New widget builder routes */} import('sentry/views/dashboards/view'))} /> import('sentry/views/dashboards/view'))} /> {/* Old widget builder routes */} import('sentry/views/dashboards/widgetBuilder'))} /> import('sentry/views/dashboards/widgetBuilder'))} /> )} import('sentry/views/dashboards/create')) )} key="org-dashboards-new" > {/* New widget builder routes */} import('sentry/views/dashboards/view'))} /> import('sentry/views/dashboards/view'))} /> {/* Old widget builder routes */} import('sentry/views/dashboards/widgetBuilder'))} /> import('sentry/views/dashboards/widgetBuilder'))} /> {USING_CUSTOMER_DOMAIN && ( import('sentry/views/dashboards/create')) )} key="orgless-dashboards-new-template-route" > import('sentry/views/dashboards/create'))} /> )} import('sentry/views/dashboards/create')) )} key="org-dashboards-new-template" > import('sentry/views/dashboards/create'))} /> {USING_CUSTOMER_DOMAIN && ( )} import('sentry/views/dashboards/view'))} withOrgPath > {/* New widget builder routes */} import('sentry/views/dashboards/view'))} /> import('sentry/views/dashboards/view'))} /> {/* Old widget builder routes */} import('sentry/views/dashboards/widgetBuilder'))} /> import('sentry/views/dashboards/widgetBuilder'))} /> import('sentry/views/dashboards/view'))} /> ); const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => { // ALERT CHILD ROUTES return ( import('sentry/views/alerts/list/incidents'))} /> import('sentry/views/alerts/list/rules/alertRulesList') )} /> import('sentry/views/alerts/rules/metric/details'))} /> import('sentry/views/alerts/builder/projectProvider'))} > import('sentry/views/alerts/edit'))} /> import('sentry/views/alerts/rules/issue/details/ruleDetails') )} /> import('sentry/views/alerts/rules/uptime'))} > import('sentry/views/alerts/rules/uptime/details'))} /> import('sentry/views/alerts/builder/projectProvider'))} > import('sentry/views/alerts/edit'))} /> import('sentry/views/alerts/builder/projectProvider'))} > import('sentry/views/alerts/edit'))} /> import('sentry/views/alerts/builder/projectProvider'))} > import('sentry/views/alerts/wizard'))} /> import('sentry/views/alerts/builder/projectProvider'))} > import('sentry/views/alerts/create'))} /> import('sentry/views/alerts/incidentRedirect'))} /> import('sentry/views/alerts/builder/projectProvider'))} > import('sentry/views/alerts/create'))} /> import('sentry/views/alerts/wizard'))} /> ); }; // ALERT ROUTES const alertRoutes = ( {USING_CUSTOMER_DOMAIN && ( import('sentry/views/alerts')))} key="orgless-alerts-route" > {alertChildRoutes({forCustomerDomain: true})} )} import('sentry/views/alerts')))} key="org-alerts" > {alertChildRoutes({forCustomerDomain: false})} ); const cronsRoutes = ( import('sentry/views/monitors'))} withOrgPath > import('sentry/views/monitors/overview'))} /> import('sentry/views/monitors/create'))} /> import('sentry/views/monitors/details'))} /> import('sentry/views/monitors/edit'))} /> ); const replayRoutes = ( import('sentry/views/replays/index'))} withOrgPath > import('sentry/views/replays/list'))} /> import('sentry/views/replays/deadRageClick/deadRageClickList') )} /> import('sentry/views/replays/details'))} /> ); const releasesRoutes = ( import('sentry/views/releases/list'))} /> import('sentry/views/releases/detail'))} > import('sentry/views/releases/detail/overview'))} /> import('sentry/views/releases/detail/commitsAndFiles/commits') )} /> import('sentry/views/releases/detail/commitsAndFiles/filesChanged') )} /> ); const statsRoutes = ( import('sentry/views/organizationStats'))} /> import('sentry/views/organizationStats/teamInsights'))} > import('sentry/views/organizationStats/teamInsights/issues') )} /> import('sentry/views/organizationStats/teamInsights/health') )} /> ); // TODO(mark) Long term this /queries route should go away and /discover // should be the canonical route for discover2. We have a redirect right now // as /discover was for discover 1 and most of the application is linking to // /discover/queries and not /discover const discoverRoutes = ( import('sentry/views/discover'))} withOrgPath > import('sentry/views/discover/homepage'))} /> import('sentry/views/discover/landing'))} /> import('sentry/views/discover/results'))} /> import('sentry/views/discover/eventDetails'))} /> ); const llmMonitoringRedirects = USING_CUSTOMER_DOMAIN ? ( ) : ( ); const moduleUrlToModule: Record = { 'mobile-screens': ModuleName.MOBILE_SCREENS, 'mobile-ui': ModuleName.MOBILE_UI, 'screen-rendering': ModuleName.SCREEN_RENDERING, ai: ModuleName.AI, app_start: ModuleName.APP_START, cache: ModuleName.CACHE, db: ModuleName.DB, http: ModuleName.HTTP, queue: ModuleName.QUEUE, resource: ModuleName.RESOURCE, screen_load: ModuleName.SCREEN_LOAD, other: ModuleName.OTHER, vital: ModuleName.VITAL, }; const insightsRedirects = Object.values(MODULE_BASE_URLS) .map( moduleBaseURL => moduleBaseURL && ( ) ) .filter(Boolean); const transactionSummaryRoutes = ( import('sentry/views/performance/transactionSummary/transactionOverview') )} /> import('sentry/views/performance/transactionSummary/transactionReplays') )} /> import('sentry/views/performance/transactionSummary/transactionVitals') )} /> import('sentry/views/performance/transactionSummary/transactionTags') )} /> import('sentry/views/performance/transactionSummary/transactionEvents') )} /> import('sentry/views/performance/transactionSummary/transactionProfiles') )} /> import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall') )} /> import('sentry/views/performance/transactionSummary/transactionSpans') )} /> import( 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails' ) )} /> ); const domainViewRoutes = ( import('sentry/views/insights/pages/frontend/frontendOverviewPage') )} /> {transactionSummaryRoutes} import('sentry/views/performance/traceDetails'))} /> import('sentry/views/performance/trends'))} /> import('sentry/views/insights/http/views/httpLandingPage') )} /> import('sentry/views/insights/http/views/httpDomainSummaryPage') )} /> import( 'sentry/views/insights/browser/webVitals/views/webVitalsLandingPage' ) )} /> import('sentry/views/insights/browser/webVitals/views/pageOverview') )} /> import( 'sentry/views/insights/browser/resources/views/resourcesLandingPage' ) )} /> import( 'sentry/views/insights/browser/resources/views/resourceSummaryPage' ) )} /> import('sentry/views/insights/pages/backend/backendOverviewPage') )} /> {transactionSummaryRoutes} import('sentry/views/performance/traceDetails'))} /> import('sentry/views/performance/trends'))} /> import('sentry/views/insights/database/views/databaseLandingPage') )} /> import('sentry/views/insights/database/views/databaseSpanSummaryPage') )} /> import('sentry/views/insights/http/views/httpLandingPage') )} /> import('sentry/views/insights/http/views/httpDomainSummaryPage') )} /> import('sentry/views/insights/cache/views/cacheLandingPage') )} /> import('sentry/views/insights/queues/views/queuesLandingPage') )} /> import('sentry/views/insights/queues/views/destinationSummaryPage') )} /> import('sentry/views/insights/pages/mobile/mobileOverviewPage') )} /> {transactionSummaryRoutes} import('sentry/views/performance/traceDetails'))} /> import('sentry/views/performance/trends'))} /> import('sentry/views/insights/mobile/screens/views/screensLandingPage') )} /> import('sentry/views/insights/mobile/screens/views/screenDetailsPage') )} /> import( 'sentry/views/insights/mobile/screenRendering/screenRenderingLandingPage' ) )} /> import( 'sentry/views/insights/mobile/screenRendering/screenRenderingSummaryPage' ) )} /> import( 'sentry/views/insights/mobile/appStarts/views/appStartsLandingPage' ) )} /> import('sentry/views/insights/mobile/appStarts/views/screenSummaryPage') )} /> import('sentry/views/insights/mobile/ui/views/uiLandingPage') )} /> import('sentry/views/insights/mobile/ui/views/screenSummaryPage') )} /> import( 'sentry/views/insights/mobile/screenload/views/screenloadLandingPage' ) )} /> import( 'sentry/views/insights/mobile/screenload/views/screenLoadSpansPage' ) )} /> import('sentry/views/insights/pages/ai/aiOverviewPage'))} /> {transactionSummaryRoutes} import('sentry/views/performance/traceDetails'))} /> import('sentry/views/performance/trends'))} /> import( 'sentry/views/insights/llmMonitoring/views/llmMonitoringLandingPage' ) )} /> import( 'sentry/views/insights/llmMonitoring/views/llmMonitoringDetailsPage' ) )} /> ); const performanceRoutes = ( import('sentry/views/performance'))} withOrgPath > import('sentry/views/performance/content'))} /> import('sentry/views/performance/trends'))} /> {transactionSummaryRoutes} import('sentry/views/performance/vitalDetail'))} /> import('sentry/views/performance/traceDetails'))} /> {insightsRedirects} import('sentry/views/performance/transactionDetails'))} /> ); const tracesRoutes = ( import('sentry/views/traces'))} withOrgPath > import('sentry/views/traces/content'))} /> ); const userFeedbackRoutes = ( import('sentry/views/userFeedback'))} withOrgPath /> ); const feedbackv2Routes = ( import('sentry/views/feedback/index'))} withOrgPath > import('sentry/views/feedback/feedbackListPage'))} /> ); const issueListRoutes = ( ); // Once org issues is complete, these routes can be nested under // /organizations/:orgId/issues const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => { const hoc = forCustomerDomain ? withDomainRequired : x => x; return ( import('sentry/views/issueDetails/groupEventDetails/groupEventDetails'), ) )} /> import('sentry/views/issueDetails/groupReplays')))} /> import('sentry/views/issueDetails/groupActivity')))} /> import('sentry/views/issueDetails/groupEvents')))} /> import('sentry/views/issueDetails/groupTags/groupTagsTab')) )} /> import('sentry/views/issueDetails/groupTagValues'))} /> import('sentry/views/issueDetails/groupUserFeedback')) )} /> import('sentry/views/issueDetails/groupEventAttachments')) )} /> import( 'sentry/views/issueDetails/groupSimilarIssues/groupSimilarIssuesTab' ) ) )} /> import('sentry/views/issueDetails/groupMerged/groupMergedTab')) )} /> ); }; const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => ( {issueTabs({forCustomerDomain})} {issueTabs({forCustomerDomain})} ); const issueDetailsRoutes = ( import('sentry/views/issueDetails/groupDetails')) )} key="org-issues-group-id" > {issueDetailsChildRoutes({forCustomerDomain: false})} {USING_CUSTOMER_DOMAIN && ( import('sentry/views/issueDetails/groupDetails')) )} key="orgless-issues-group-id-route" > {issueDetailsChildRoutes({forCustomerDomain: true})} )} ); // These are the "manage" pages. For sentry.io, these are _different_ from // the SaaS admin routes in getsentry. const adminManageRoutes = ( import('sentry/views/admin/adminLayout'))} > import('sentry/views/admin/adminOverview'))} /> import('sentry/views/admin/adminBuffer'))} /> import('sentry/views/admin/adminRelays'))} /> import('sentry/views/admin/adminOrganizations'))} /> import('sentry/views/admin/adminProjects'))} /> import('sentry/views/admin/adminQueue'))} /> import('sentry/views/admin/adminQuotas'))} /> import('sentry/views/admin/adminSettings'))} /> import('sentry/views/admin/adminUsers'))} /> import('sentry/views/admin/adminUserEdit'))} /> import('sentry/views/admin/adminMail'))} /> import('sentry/views/admin/adminEnvironment'))} /> import('sentry/views/admin/adminPackages'))} /> import('sentry/views/admin/adminWarnings'))} /> ); // XXX(epurkhiser): This should probably go away. It's not totally clear to // me why we need the OrganizationRoot root container. const legacyOrganizationRootRoutes = ( {hook('routes:legacy-organization-redirects')} ); const gettingStartedRoutes = ( {USING_CUSTOMER_DOMAIN && ( )} ); const profilingRoutes = ( import('sentry/views/profiling'))} withOrgPath > import('sentry/views/profiling/content'))} /> import('sentry/views/profiling/profileSummary'))} /> import('sentry/views/profiling/differentialFlamegraph'))} /> import('sentry/views/profiling/continuousProfileProvider'))} > import('sentry/views/profiling/continuousProfileFlamegraph') )} /> import('sentry/views/profiling/profilesProvider'))} > import('sentry/views/profiling/profileFlamechart'))} /> ); const metricsRoutes = ( import('sentry/views/metrics'))} withOrgPath > import('sentry/views/metrics/metrics'))} /> {/* TODO(ddm): fade this out */} ); // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new // canonical URLs. // // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes, // or do these need to be nested into the OrganizationLayout tree? const legacyOrgRedirects = ( `/organizations/${orgId}/issues/?project=${projectId}` ) )} /> `/organizations/${orgId}/issues/?project=${projectId}` ) )} /> `/organizations/${orgId}/dashboards/?project=${projectId}` ) )} /> `/organizations/${orgId}/user-feedback/?project=${projectId}` ) )} /> `/organizations/${orgId}/releases/?project=${projectId}` ) )} /> `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}` ) )} /> `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}` ) )} /> `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}` ) )} /> `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}` ) )} /> ); const organizationRoutes = ( {settingsRoutes} {projectsRoutes} {dashboardRoutes} {userFeedbackRoutes} {feedbackv2Routes} {issueListRoutes} {issueDetailsRoutes} {alertRoutes} {cronsRoutes} {replayRoutes} {releasesRoutes} {statsRoutes} {discoverRoutes} {performanceRoutes} {domainViewRoutes} {tracesRoutes} {llmMonitoringRedirects} {profilingRoutes} {metricsRoutes} {gettingStartedRoutes} {adminManageRoutes} {legacyOrganizationRootRoutes} {legacyOrgRedirects} ); const legacyRedirectRoutes = ( ); const appRoutes = ( {experimentalSpaRoutes} {rootRoutes} {organizationRoutes} {legacyRedirectRoutes} ); return appRoutes; } // We load routes both when initializing the SDK (for routing integrations) and // when the app renders Main. Memoize to avoid rebuilding the route tree. export const routes = memoize(buildRoutes); // Exported for use in tests. export {buildRoutes}; function NoOp({children}: {children: JSX.Element}) { return children; }