routes.tsx 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239
  1. import React, {Fragment} from 'react';
  2. import {
  3. IndexRedirect,
  4. IndexRoute as BaseIndexRoute,
  5. IndexRouteProps,
  6. Redirect,
  7. Route as BaseRoute,
  8. RouteProps,
  9. } from 'react-router';
  10. import memoize from 'lodash/memoize';
  11. import LazyLoad from 'sentry/components/lazyLoad';
  12. import {EXPERIMENTAL_SPA, usingCustomerDomain} from 'sentry/constants';
  13. import {t} from 'sentry/locale';
  14. import HookStore from 'sentry/stores/hookStore';
  15. import {HookName} from 'sentry/types/hooks';
  16. import errorHandler from 'sentry/utils/errorHandler';
  17. import withDomainRedirect from 'sentry/utils/withDomainRedirect';
  18. import withDomainRequired from 'sentry/utils/withDomainRequired';
  19. import App from 'sentry/views/app';
  20. import AuthLayout from 'sentry/views/auth/layout';
  21. import IssueListContainer from 'sentry/views/issueList/container';
  22. import IssueListOverview from 'sentry/views/issueList/overview';
  23. import OrganizationContextContainer from 'sentry/views/organizationContextContainer';
  24. import OrganizationDetails from 'sentry/views/organizationDetails';
  25. import {Tab, TabPaths} from 'sentry/views/organizationGroupDetails/types';
  26. import OrganizationRoot from 'sentry/views/organizationRoot';
  27. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  28. import RouteNotFound from 'sentry/views/routeNotFound';
  29. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  30. type CustomProps = {
  31. name?: string;
  32. };
  33. /**
  34. * We add some additional props to our routes
  35. */
  36. const Route = BaseRoute as React.ComponentClass<RouteProps & CustomProps>;
  37. const IndexRoute = BaseIndexRoute as React.ComponentClass<IndexRouteProps & CustomProps>;
  38. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  39. const SafeLazyLoad = errorHandler(LazyLoad);
  40. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  41. // pirvate routing tree.
  42. /**
  43. * Factory function to produce a component that will render the SafeLazyLoad
  44. * _with_ the required props.
  45. */
  46. export function makeLazyloadComponent<C extends React.ComponentType<any>>(
  47. resolve: () => Promise<{default: C}>
  48. ) {
  49. // XXX: Assign the component to a variable so it has a displayname
  50. const RouteLazyLoad: React.FC<React.ComponentProps<C>> = props => {
  51. // we can use this hook to set the organization as it's
  52. // a child of the organization context
  53. return <SafeLazyLoad {...props} component={resolve} />;
  54. };
  55. return RouteLazyLoad;
  56. }
  57. // Shorthand to avoid extra line wrapping
  58. const make = makeLazyloadComponent;
  59. function buildRoutes() {
  60. // Read this to understand where to add new routes, how / why the routing
  61. // tree is structured the way it is, and how the lazy-loading /
  62. // code-splitting works for pages.
  63. //
  64. // ## Formatting
  65. //
  66. // NOTE that there are intentionally NO blank lines within route tree blocks.
  67. // This helps make it easier to navigate within the file by using your
  68. // editors shortcuts to jump between 'paragraphs' of code.
  69. //
  70. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  71. //
  72. //
  73. // ## Lazy loading
  74. //
  75. // * The `SafeLazyLoad` component
  76. //
  77. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  78. // errorHandler wrapped version). This means the rendered component for the
  79. // route will only be loaded when the route is loaded. This helps us
  80. // "code-split" the app.
  81. //
  82. // ## Hooks
  83. //
  84. // There are a number of `hook()` routes placed within the routing tree to
  85. // allow for additional routes to be augmented into the application via the
  86. // hookStore mechanism.
  87. //
  88. //
  89. // ## The structure
  90. //
  91. // * `experimentalSpaRoutes`
  92. //
  93. // These routes are specifically for the experimental single-page-app mode,
  94. // where Sentry is run separate from Django. These are NOT part of the root
  95. // <App /> component.
  96. //
  97. // Right now these are mainly used for authentication pages. In the future
  98. // they would be used for other pages like registration.
  99. //
  100. // * `rootRoutes`
  101. //
  102. // These routes live directly under the <App /> container, and generally
  103. // are not specific to an organization.
  104. //
  105. // * `settingsRoutes`
  106. //
  107. // This is the route tree for all of `/settings/`. This route tree is
  108. // composed of a few different sub-trees.
  109. //
  110. // - `accountSettingsRoutes` User specific settings
  111. // - `orgSettingsRoutes` Specific to a organization
  112. // - `projectSettingsRoutes` Specific to a project
  113. // - `legacySettingsRedirects` Routes that used to exist in settings
  114. //
  115. // * `organizationRoutes`
  116. //
  117. // This is where a majority of the app routes live. This is wrapped with
  118. // the <OrganizationDetails /> component, which provides the sidebar and
  119. // organization context.
  120. //
  121. // Within these routes are a variety of subroutes. They are not all
  122. // listed here as the subroutes will be added and removed, and most are
  123. // self explanatory.
  124. //
  125. // * `legacyRedirectRoutes`
  126. //
  127. // This route tree contains <Redirect /> routes for many old legacy paths.
  128. //
  129. // You may also find <Redirect />'s collocated next to the feature routes
  130. // they have redirects for. A good rule here is to place 'helper' redirects
  131. // next to the routes they redirect to, and place 'legacy route' redirects
  132. // for routes that have completely changed in this tree.
  133. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  134. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  135. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  136. <Route path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  137. </Route>
  138. ) : null;
  139. const rootRoutes = (
  140. <Fragment>
  141. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  142. <Route
  143. path="/accept/:orgId/:memberId/:token/"
  144. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  145. />
  146. <Route
  147. path="/accept/:memberId/:token/"
  148. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  149. />
  150. <Route
  151. path="/accept-transfer/"
  152. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  153. />
  154. <Route
  155. path="/extensions/external-install/:integrationSlug/:installationId"
  156. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  157. />
  158. <Route
  159. path="/extensions/:integrationSlug/link/"
  160. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  161. />
  162. <Route
  163. path="/sentry-apps/:sentryAppSlug/external-install/"
  164. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  165. />
  166. <Redirect from="/account/" to="/settings/account/details/" />
  167. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  168. <Route
  169. path="/share/issue/:shareId/"
  170. component={make(() => import('sentry/views/sharedGroupDetails'))}
  171. />
  172. <Route
  173. path="/organizations/new/"
  174. component={make(() => import('sentry/views/organizationCreate'))}
  175. />
  176. {usingCustomerDomain ? (
  177. <Route
  178. path="/data-export/:dataExportId"
  179. component={withDomainRequired(
  180. make(() => import('sentry/views/dataExport/dataDownload'))
  181. )}
  182. key="orgless-data-export-route"
  183. />
  184. ) : null}
  185. <Route
  186. path="/organizations/:orgId/data-export/:dataExportId"
  187. component={withDomainRedirect(
  188. make(() => import('sentry/views/dataExport/dataDownload'))
  189. )}
  190. key="org-data-export"
  191. />
  192. {usingCustomerDomain ? (
  193. <Route
  194. path="/disabled-member/"
  195. component={withDomainRequired(
  196. make(() => import('sentry/views/disabledMember'))
  197. )}
  198. key="orgless-disabled-member-route"
  199. />
  200. ) : null}
  201. <Route
  202. path="/organizations/:orgId/disabled-member/"
  203. component={withDomainRedirect(make(() => import('sentry/views/disabledMember')))}
  204. key="org-disabled-member"
  205. />
  206. {usingCustomerDomain ? (
  207. <Route
  208. path="/join-request/"
  209. component={withDomainRequired(
  210. make(() => import('sentry/views/organizationJoinRequest'))
  211. )}
  212. key="orgless-join-request"
  213. />
  214. ) : null}
  215. <Route
  216. path="/join-request/:orgId/"
  217. component={withDomainRedirect(
  218. make(() => import('sentry/views/organizationJoinRequest'))
  219. )}
  220. key="org-join-request"
  221. />
  222. {usingCustomerDomain ? (
  223. <Route
  224. path="/onboarding/"
  225. component={errorHandler(withDomainRequired(OrganizationContextContainer))}
  226. key="orgless-onboarding"
  227. >
  228. <Route
  229. path=":step/"
  230. component={make(() => import('sentry/views/onboarding/onboarding'))}
  231. />
  232. </Route>
  233. ) : null}
  234. <Route
  235. path="/onboarding/:orgId/"
  236. component={withDomainRedirect(errorHandler(OrganizationContextContainer))}
  237. key="org-onboarding"
  238. >
  239. <IndexRedirect to="welcome/" />
  240. <Route
  241. path=":step/"
  242. component={make(() => import('sentry/views/onboarding/onboarding'))}
  243. />
  244. </Route>
  245. </Fragment>
  246. );
  247. const accountSettingsRoutes = (
  248. <Route
  249. path="account/"
  250. name={t('Account')}
  251. component={make(
  252. () => import('sentry/views/settings/account/accountSettingsLayout')
  253. )}
  254. >
  255. <IndexRedirect to="details/" />
  256. <Route
  257. path="details/"
  258. name={t('Details')}
  259. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  260. />
  261. <Route path="notifications/" name={t('Notifications')}>
  262. <IndexRoute
  263. component={make(
  264. () =>
  265. import('sentry/views/settings/account/notifications/notificationSettings')
  266. )}
  267. />
  268. <Route
  269. path=":fineTuneType/"
  270. name={t('Fine Tune Alerts')}
  271. component={make(
  272. () => import('sentry/views/settings/account/accountNotificationFineTuning')
  273. )}
  274. />
  275. </Route>
  276. <Route
  277. path="emails/"
  278. name={t('Emails')}
  279. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  280. />
  281. <Route
  282. path="authorizations/"
  283. component={make(
  284. () => import('sentry/views/settings/account/accountAuthorizations')
  285. )}
  286. />
  287. <Route path="security/" name={t('Security')}>
  288. <Route
  289. component={make(
  290. () =>
  291. import(
  292. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  293. )
  294. )}
  295. >
  296. <IndexRoute
  297. component={make(
  298. () => import('sentry/views/settings/account/accountSecurity')
  299. )}
  300. />
  301. <Route
  302. path="session-history/"
  303. name={t('Session History')}
  304. component={make(
  305. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  306. )}
  307. />
  308. <Route
  309. path="mfa/:authId/"
  310. name={t('Details')}
  311. component={make(
  312. () =>
  313. import(
  314. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  315. )
  316. )}
  317. />
  318. </Route>
  319. <Route
  320. path="mfa/:authId/enroll/"
  321. name={t('Enroll')}
  322. component={make(
  323. () =>
  324. import(
  325. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  326. )
  327. )}
  328. />
  329. </Route>
  330. <Route
  331. path="subscriptions/"
  332. name={t('Subscriptions')}
  333. component={make(
  334. () => import('sentry/views/settings/account/accountSubscriptions')
  335. )}
  336. />
  337. <Route
  338. path="identities/"
  339. name={t('Identities')}
  340. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  341. />
  342. <Route path="api/" name={t('API')}>
  343. <IndexRedirect to="auth-tokens/" />
  344. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  345. <IndexRoute
  346. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  347. />
  348. <Route
  349. path="new-token/"
  350. name={t('Create New Token')}
  351. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  352. />
  353. </Route>
  354. <Route path="applications/" name={t('Applications')}>
  355. <IndexRoute
  356. component={make(
  357. () => import('sentry/views/settings/account/apiApplications')
  358. )}
  359. />
  360. <Route
  361. path=":appId/"
  362. name={t('Details')}
  363. component={make(
  364. () => import('sentry/views/settings/account/apiApplications/details')
  365. )}
  366. />
  367. </Route>
  368. {hook('routes:api')}
  369. </Route>
  370. <Route
  371. path="close-account/"
  372. name={t('Close Account')}
  373. component={make(() => import('sentry/views/settings/account/accountClose'))}
  374. />
  375. </Route>
  376. );
  377. const projectSettingsRoutes = (
  378. <Route
  379. path="projects/:projectId/"
  380. name={t('Project')}
  381. component={make(
  382. () => import('sentry/views/settings/project/projectSettingsLayout')
  383. )}
  384. >
  385. <IndexRoute
  386. name={t('General')}
  387. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  388. />
  389. <Route
  390. path="teams/"
  391. name={t('Teams')}
  392. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  393. />
  394. <Route
  395. path="alerts/"
  396. name={t('Alerts')}
  397. component={make(() => import('sentry/views/settings/projectAlerts'))}
  398. >
  399. <IndexRoute
  400. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  401. />
  402. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  403. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  404. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  405. <Redirect
  406. from="metric-rules/new/"
  407. to="/organizations/:orgId/alerts/:projectId/new/"
  408. />
  409. <Redirect
  410. from="rules/:ruleId/"
  411. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  412. />
  413. <Redirect
  414. from="metric-rules/:ruleId/"
  415. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  416. />
  417. </Route>
  418. <Route
  419. path="environments/"
  420. name={t('Environments')}
  421. component={make(
  422. () => import('sentry/views/settings/project/projectEnvironments')
  423. )}
  424. >
  425. <IndexRoute />
  426. <Route path="hidden/" />
  427. </Route>
  428. <Route
  429. path="tags/"
  430. name={t('Tags')}
  431. component={make(() => import('sentry/views/settings/projectTags'))}
  432. />
  433. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  434. <Route
  435. path="release-tracking/"
  436. name={t('Release Tracking')}
  437. component={make(
  438. () => import('sentry/views/settings/project/projectReleaseTracking')
  439. )}
  440. />
  441. <Route
  442. path="ownership/"
  443. name={t('Issue Owners')}
  444. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  445. />
  446. <Route
  447. path="data-forwarding/"
  448. name={t('Data Forwarding')}
  449. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  450. />
  451. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  452. <IndexRoute
  453. component={make(
  454. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  455. )}
  456. />
  457. <Route
  458. path="advanced-data-scrubbing/:scrubbingId/"
  459. component={make(
  460. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  461. )}
  462. />
  463. </Route>
  464. <Route
  465. path="debug-symbols/"
  466. name={t('Debug Information Files')}
  467. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  468. />
  469. <Route
  470. path="proguard/"
  471. name={t('ProGuard Mappings')}
  472. component={make(() => import('sentry/views/settings/projectProguard'))}
  473. />
  474. <Route
  475. path="performance/"
  476. name={t('Performance')}
  477. component={make(() => import('sentry/views/settings/projectPerformance'))}
  478. />
  479. <Route
  480. path="source-maps/"
  481. name={t('Source Maps')}
  482. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  483. >
  484. <IndexRoute
  485. component={make(() => import('sentry/views/settings/projectSourceMaps/list'))}
  486. />
  487. <Route
  488. path=":name/"
  489. name={t('Archive')}
  490. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  491. />
  492. </Route>
  493. <Route
  494. path="processing-issues/"
  495. name={t('Processing Issues')}
  496. component={make(
  497. () => import('sentry/views/settings/project/projectProcessingIssues')
  498. )}
  499. />
  500. <Route
  501. path="filters/"
  502. name={t('Inbound Filters')}
  503. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  504. >
  505. <IndexRedirect to="data-filters/" />
  506. <Route path=":filterType/" />
  507. </Route>
  508. <Route path="dynamic-sampling/" name={t('Dynamic Sampling')}>
  509. <IndexRoute
  510. component={make(() => import('sentry/views/settings/project/dynamicSampling'))}
  511. />
  512. <Route
  513. path="rules/:rule/"
  514. component={make(() => import('sentry/views/settings/project/dynamicSampling'))}
  515. />
  516. </Route>
  517. <Route
  518. path="issue-grouping/"
  519. name={t('Issue Grouping')}
  520. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  521. />
  522. <Route
  523. path="hooks/"
  524. name={t('Service Hooks')}
  525. component={make(
  526. () => import('sentry/views/settings/project/projectServiceHooks')
  527. )}
  528. />
  529. <Route
  530. path="hooks/new/"
  531. name={t('Create Service Hook')}
  532. component={make(
  533. () => import('sentry/views/settings/project/projectCreateServiceHook')
  534. )}
  535. />
  536. <Route
  537. path="hooks/:hookId/"
  538. name={t('Service Hook Details')}
  539. component={make(
  540. () => import('sentry/views/settings/project/projectServiceHookDetails')
  541. )}
  542. />
  543. <Route path="keys/" name={t('Client Keys')}>
  544. <IndexRoute
  545. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  546. />
  547. <Route
  548. path=":keyId/"
  549. name={t('Details')}
  550. component={make(
  551. () => import('sentry/views/settings/project/projectKeys/details')
  552. )}
  553. />
  554. </Route>
  555. <Route
  556. path="user-feedback/"
  557. name={t('User Feedback')}
  558. component={make(
  559. () => import('sentry/views/settings/project/projectUserFeedback')
  560. )}
  561. />
  562. <Redirect from="csp/" to="security-headers/" />
  563. <Route path="security-headers/" name={t('Security Headers')}>
  564. <IndexRoute
  565. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  566. />
  567. <Route
  568. path="csp/"
  569. name={t('Content Security Policy')}
  570. component={make(
  571. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  572. )}
  573. />
  574. <Route
  575. path="expect-ct/"
  576. name={t('Certificate Transparency')}
  577. component={make(
  578. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  579. )}
  580. />
  581. <Route
  582. path="hpkp/"
  583. name={t('HPKP')}
  584. component={make(
  585. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  586. )}
  587. />
  588. </Route>
  589. <Route path="plugins/" name={t('Legacy Integrations')}>
  590. <IndexRoute
  591. component={make(() => import('sentry/views/settings/projectPlugins'))}
  592. />
  593. <Route
  594. path=":pluginId/"
  595. name={t('Integration Details')}
  596. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  597. />
  598. </Route>
  599. <Route path="install/" name={t('Configuration')}>
  600. <IndexRoute
  601. component={make(() => import('sentry/views/projectInstall/overview'))}
  602. />
  603. <Route
  604. path=":platform/"
  605. name={t('Docs')}
  606. component={make(
  607. () => import('sentry/views/projectInstall/platformOrIntegration')
  608. )}
  609. />
  610. </Route>
  611. </Route>
  612. );
  613. const orgSettingsRoutes = (
  614. <Route
  615. component={make(
  616. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  617. )}
  618. >
  619. {hook('routes:organization')}
  620. {usingCustomerDomain ? null : (
  621. <IndexRoute
  622. name={t('General')}
  623. component={make(
  624. () => import('sentry/views/settings/organizationGeneralSettings')
  625. )}
  626. />
  627. )}
  628. {usingCustomerDomain ? (
  629. <Route
  630. path="/settings/organization/"
  631. name={t('General')}
  632. component={make(
  633. () => import('sentry/views/settings/organizationGeneralSettings')
  634. )}
  635. />
  636. ) : null}
  637. <Route
  638. path="projects/"
  639. name={t('Projects')}
  640. component={make(() => import('sentry/views/settings/organizationProjects'))}
  641. />
  642. <Route path="api-keys/" name={t('API Key')}>
  643. <IndexRoute
  644. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  645. />
  646. <Route
  647. path=":apiKey/"
  648. name={t('Details')}
  649. component={make(
  650. () =>
  651. import(
  652. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  653. )
  654. )}
  655. />
  656. </Route>
  657. <Route
  658. path="audit-log/"
  659. name={t('Audit Log')}
  660. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  661. />
  662. <Route
  663. path="auth/"
  664. name={t('Auth Providers')}
  665. component={make(() => import('sentry/views/settings/organizationAuth'))}
  666. />
  667. <Redirect from="members/requests" to="members/" />
  668. <Route path="members/" name={t('Members')}>
  669. <Route
  670. component={make(
  671. () =>
  672. import(
  673. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  674. )
  675. )}
  676. >
  677. <IndexRoute
  678. component={make(
  679. () =>
  680. import(
  681. 'sentry/views/settings/organizationMembers/organizationMembersList'
  682. )
  683. )}
  684. />
  685. </Route>
  686. <Route
  687. path=":memberId/"
  688. name={t('Details')}
  689. component={make(
  690. () =>
  691. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  692. )}
  693. />
  694. </Route>
  695. <Route
  696. path="rate-limits/"
  697. name={t('Rate Limits')}
  698. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  699. />
  700. <Route
  701. path="relay/"
  702. name={t('Relay')}
  703. component={make(() => import('sentry/views/settings/organizationRelay'))}
  704. />
  705. <Route
  706. path="repos/"
  707. name={t('Repositories')}
  708. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  709. />
  710. <Route
  711. path="settings/"
  712. component={make(
  713. () => import('sentry/views/settings/organizationGeneralSettings')
  714. )}
  715. />
  716. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  717. <IndexRoute
  718. component={make(
  719. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  720. )}
  721. />
  722. <Route
  723. path="advanced-data-scrubbing/:scrubbingId/"
  724. component={make(
  725. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  726. )}
  727. />
  728. </Route>
  729. <Route path="teams/" name={t('Teams')}>
  730. <IndexRoute
  731. component={make(() => import('sentry/views/settings/organizationTeams'))}
  732. />
  733. <Route
  734. path=":teamId/"
  735. name={t('Team')}
  736. component={make(
  737. () => import('sentry/views/settings/organizationTeams/teamDetails')
  738. )}
  739. >
  740. <IndexRedirect to="members/" />
  741. <Route
  742. path="members/"
  743. name={t('Members')}
  744. component={make(
  745. () => import('sentry/views/settings/organizationTeams/teamMembers')
  746. )}
  747. />
  748. <Route
  749. path="notifications/"
  750. name={t('Notifications')}
  751. component={make(
  752. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  753. )}
  754. />
  755. <Route
  756. path="projects/"
  757. name={t('Projects')}
  758. component={make(
  759. () => import('sentry/views/settings/organizationTeams/teamProjects')
  760. )}
  761. />
  762. <Route
  763. path="settings/"
  764. name={t('Settings')}
  765. component={make(
  766. () => import('sentry/views/settings/organizationTeams/teamSettings')
  767. )}
  768. />
  769. </Route>
  770. </Route>
  771. <Redirect from="plugins/" to="integrations/" />
  772. <Route path="plugins/" name={t('Integrations')}>
  773. <Route
  774. path=":integrationSlug/"
  775. name={t('Integration Details')}
  776. component={make(
  777. () => import('sentry/views/organizationIntegrations/pluginDetailedView')
  778. )}
  779. />
  780. </Route>
  781. <Redirect from="sentry-apps/" to="integrations/" />
  782. <Route path="sentry-apps/" name={t('Integrations')}>
  783. <Route
  784. path=":integrationSlug"
  785. name={t('Details')}
  786. component={make(
  787. () => import('sentry/views/organizationIntegrations/sentryAppDetailedView')
  788. )}
  789. />
  790. </Route>
  791. <Redirect from="document-integrations/" to="integrations/" />
  792. <Route path="document-integrations/" name={t('Integrations')}>
  793. <Route
  794. path=":integrationSlug"
  795. name={t('Details')}
  796. component={make(
  797. () =>
  798. import('sentry/views/organizationIntegrations/docIntegrationDetailedView')
  799. )}
  800. />
  801. </Route>
  802. <Route path="integrations/" name={t('Integrations')}>
  803. <IndexRoute
  804. component={make(
  805. () => import('sentry/views/organizationIntegrations/integrationListDirectory')
  806. )}
  807. />
  808. <Route
  809. path=":integrationSlug"
  810. name={t('Integration Details')}
  811. component={make(
  812. () => import('sentry/views/organizationIntegrations/integrationDetailedView')
  813. )}
  814. />
  815. <Route
  816. path=":providerKey/:integrationId/"
  817. name={t('Configure Integration')}
  818. component={make(
  819. () =>
  820. import(
  821. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  822. )
  823. )}
  824. />
  825. </Route>
  826. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  827. <Route path="developer-settings/" name={t('Developer Settings')}>
  828. <IndexRoute
  829. component={make(
  830. () => import('sentry/views/settings/organizationDeveloperSettings')
  831. )}
  832. />
  833. <Route
  834. path="new-public/"
  835. name={t('Create Integration')}
  836. component={make(
  837. () =>
  838. import(
  839. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  840. )
  841. )}
  842. />
  843. <Route
  844. path="new-internal/"
  845. name={t('Create Integration')}
  846. component={make(
  847. () =>
  848. import(
  849. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  850. )
  851. )}
  852. />
  853. <Route
  854. path=":appSlug/"
  855. name={t('Edit Integration')}
  856. component={make(
  857. () =>
  858. import(
  859. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  860. )
  861. )}
  862. />
  863. <Route
  864. path=":appSlug/dashboard/"
  865. name={t('Integration Dashboard')}
  866. component={make(
  867. () =>
  868. import(
  869. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  870. )
  871. )}
  872. />
  873. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  874. <Route
  875. path="new/"
  876. name={t('Create Sentry Function')}
  877. component={make(
  878. () =>
  879. import(
  880. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  881. )
  882. )}
  883. />
  884. <Route
  885. path=":functionSlug/"
  886. name={t('Edit Sentry Function')}
  887. component={make(
  888. () =>
  889. import(
  890. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  891. )
  892. )}
  893. />
  894. </Route>
  895. </Route>
  896. </Route>
  897. );
  898. const legacySettingsRedirects = (
  899. <Fragment>
  900. <Redirect from=":projectId/" to="projects/:projectId/" />
  901. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  902. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  903. <Redirect
  904. from=":projectId/alerts/rules/:ruleId/"
  905. to="projects/:projectId/alerts/rules/:ruleId/"
  906. />
  907. </Fragment>
  908. );
  909. const settingsRoutes = (
  910. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  911. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  912. {accountSettingsRoutes}
  913. <Fragment>
  914. {usingCustomerDomain ? (
  915. <Route
  916. name={t('Organization')}
  917. component={withDomainRequired(NoOp)}
  918. key="orgless-settings-route"
  919. >
  920. {orgSettingsRoutes}
  921. {projectSettingsRoutes}
  922. </Route>
  923. ) : null}
  924. <Route
  925. path=":orgId/"
  926. name={t('Organization')}
  927. component={withDomainRedirect(NoOp, {
  928. redirect: [
  929. {
  930. // If /settings/:orgId/ is encountered, then redirect to /settings/organization/ rather than redirecting
  931. // to /settings/.
  932. from: '/settings/:orgId/',
  933. to: '/settings/organization/',
  934. },
  935. ],
  936. })}
  937. key="org-settings"
  938. >
  939. {orgSettingsRoutes}
  940. {projectSettingsRoutes}
  941. {legacySettingsRedirects}
  942. </Route>
  943. </Fragment>
  944. </Route>
  945. );
  946. const projectsChildRoutes = (
  947. <Fragment>
  948. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  949. <Route
  950. path="new/"
  951. component={make(() => import('sentry/views/projectInstall/newProject'))}
  952. />
  953. <Route
  954. path=":projectId/getting-started/"
  955. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  956. >
  957. <IndexRoute
  958. component={make(() => import('sentry/views/projectInstall/overview'))}
  959. />
  960. <Route
  961. path=":platform/"
  962. component={make(
  963. () => import('sentry/views/projectInstall/platformOrIntegration')
  964. )}
  965. />
  966. </Route>
  967. <Route
  968. path=":projectId/"
  969. component={make(() => import('sentry/views/projectDetail'))}
  970. />
  971. <Route
  972. path=":projectId/events/:eventId/"
  973. component={errorHandler(ProjectEventRedirect)}
  974. />
  975. </Fragment>
  976. );
  977. const projectsRoutes = (
  978. <Fragment>
  979. {usingCustomerDomain ? (
  980. <Route
  981. path="/projects/"
  982. component={withDomainRequired(NoOp)}
  983. key="orgless-projects-route"
  984. >
  985. {projectsChildRoutes}
  986. </Route>
  987. ) : null}
  988. <Route
  989. path="/organizations/:orgId/projects/"
  990. component={withDomainRedirect(NoOp)}
  991. key="org-projects"
  992. >
  993. {projectsChildRoutes}
  994. </Route>
  995. </Fragment>
  996. );
  997. const dashboardWidgetRoutes = (
  998. <Fragment>
  999. <Route
  1000. path="widget/:widgetIndex/edit/"
  1001. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  1002. />
  1003. <Route
  1004. path="widget/new/"
  1005. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  1006. />
  1007. <Route
  1008. path="widget/:widgetId/"
  1009. component={make(() => import('sentry/views/dashboardsV2/view'))}
  1010. />
  1011. </Fragment>
  1012. );
  1013. const dashboardRoutes = (
  1014. <Fragment>
  1015. <Fragment>
  1016. {usingCustomerDomain ? (
  1017. <Route
  1018. path="/dashboards/"
  1019. component={withDomainRequired(
  1020. make(() => import('sentry/views/dashboardsV2'))
  1021. )}
  1022. key="orgless-dashboards-route"
  1023. >
  1024. <IndexRoute
  1025. component={make(() => import('sentry/views/dashboardsV2/manage'))}
  1026. />
  1027. </Route>
  1028. ) : null}
  1029. <Route
  1030. path="/organizations/:orgId/dashboards/"
  1031. component={withDomainRedirect(make(() => import('sentry/views/dashboardsV2')))}
  1032. key="org-dashboards"
  1033. >
  1034. <IndexRoute
  1035. component={make(() => import('sentry/views/dashboardsV2/manage'))}
  1036. />
  1037. </Route>
  1038. </Fragment>
  1039. <Fragment>
  1040. {usingCustomerDomain ? (
  1041. <Route
  1042. path="/dashboards/new/"
  1043. component={withDomainRequired(
  1044. make(() => import('sentry/views/dashboardsV2/create'))
  1045. )}
  1046. key="orgless-dashboards-new-route"
  1047. >
  1048. <Route
  1049. path="widget/:widgetIndex/edit/"
  1050. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  1051. />
  1052. <Route
  1053. path="widget/new/"
  1054. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  1055. />
  1056. </Route>
  1057. ) : null}
  1058. <Route
  1059. path="/organizations/:orgId/dashboards/new/"
  1060. component={withDomainRedirect(
  1061. make(() => import('sentry/views/dashboardsV2/create'))
  1062. )}
  1063. key="org-dashboards-new"
  1064. >
  1065. <Route
  1066. path="widget/:widgetIndex/edit/"
  1067. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  1068. />
  1069. <Route
  1070. path="widget/new/"
  1071. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  1072. />
  1073. </Route>
  1074. </Fragment>
  1075. <Fragment>
  1076. {usingCustomerDomain ? (
  1077. <Route
  1078. path="/dashboards/new/:templateId"
  1079. component={withDomainRequired(
  1080. make(() => import('sentry/views/dashboardsV2/create'))
  1081. )}
  1082. key="orgless-dashboards-new-template-route"
  1083. >
  1084. <Route
  1085. path="widget/:widgetId/"
  1086. component={make(() => import('sentry/views/dashboardsV2/create'))}
  1087. />
  1088. </Route>
  1089. ) : null}
  1090. <Route
  1091. path="/organizations/:orgId/dashboards/new/:templateId"
  1092. component={withDomainRedirect(
  1093. make(() => import('sentry/views/dashboardsV2/create'))
  1094. )}
  1095. key="org-dashboards-new-template"
  1096. >
  1097. <Route
  1098. path="widget/:widgetId/"
  1099. component={make(() => import('sentry/views/dashboardsV2/create'))}
  1100. />
  1101. </Route>
  1102. </Fragment>
  1103. <Redirect
  1104. from="/organizations/:orgId/dashboards/:dashboardId/"
  1105. to="/organizations/:orgId/dashboard/:dashboardId/"
  1106. />
  1107. {usingCustomerDomain ? (
  1108. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1109. ) : null}
  1110. <Fragment>
  1111. {usingCustomerDomain ? (
  1112. <Route
  1113. path="/dashboard/:dashboardId/"
  1114. component={withDomainRequired(
  1115. make(() => import('sentry/views/dashboardsV2/view'))
  1116. )}
  1117. key="orgless-dashboards-dashboard-id-route"
  1118. >
  1119. {dashboardWidgetRoutes}
  1120. </Route>
  1121. ) : null}
  1122. <Route
  1123. path="/organizations/:orgId/dashboard/:dashboardId/"
  1124. component={withDomainRedirect(
  1125. make(() => import('sentry/views/dashboardsV2/view'))
  1126. )}
  1127. key="org-dashboards-dashboard-id"
  1128. >
  1129. {dashboardWidgetRoutes}
  1130. </Route>
  1131. </Fragment>
  1132. </Fragment>
  1133. );
  1134. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1135. return (
  1136. <Fragment>
  1137. <IndexRoute
  1138. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1139. />
  1140. <Route path="rules/">
  1141. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  1142. <Route
  1143. path="details/:ruleId/"
  1144. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1145. />
  1146. <Route
  1147. path=":projectId/"
  1148. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1149. >
  1150. <IndexRedirect
  1151. to={
  1152. forCustomerDomain
  1153. ? '/alerts/rules/'
  1154. : '/organizations/:orgId/alerts/rules/'
  1155. }
  1156. />
  1157. <Route
  1158. path=":ruleId/"
  1159. component={make(() => import('sentry/views/alerts/edit'))}
  1160. />
  1161. </Route>
  1162. <Route
  1163. path=":projectId/:ruleId/details/"
  1164. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  1165. >
  1166. <IndexRoute
  1167. component={make(
  1168. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1169. )}
  1170. />
  1171. </Route>
  1172. </Route>
  1173. <Route path="metric-rules/">
  1174. <IndexRedirect
  1175. to={
  1176. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1177. }
  1178. />
  1179. <Route
  1180. path=":projectId/"
  1181. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1182. >
  1183. <IndexRedirect
  1184. to={
  1185. forCustomerDomain
  1186. ? '/alerts/rules/'
  1187. : '/organizations/:orgId/alerts/rules/'
  1188. }
  1189. />
  1190. <Route
  1191. path=":ruleId/"
  1192. component={make(() => import('sentry/views/alerts/edit'))}
  1193. />
  1194. </Route>
  1195. </Route>
  1196. <Route
  1197. path="wizard/"
  1198. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1199. >
  1200. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1201. </Route>
  1202. <Route
  1203. path="new/"
  1204. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1205. >
  1206. <IndexRedirect
  1207. to={
  1208. forCustomerDomain
  1209. ? '/alerts/wizard/'
  1210. : '/organizations/:orgId/alerts/wizard/'
  1211. }
  1212. />
  1213. <Route
  1214. path=":alertType/"
  1215. component={make(() => import('sentry/views/alerts/create'))}
  1216. />
  1217. </Route>
  1218. <Route
  1219. path=":alertId/"
  1220. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1221. />
  1222. <Route
  1223. path=":projectId/"
  1224. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1225. >
  1226. <Route
  1227. path="new/"
  1228. component={make(() => import('sentry/views/alerts/create'))}
  1229. />
  1230. <Route
  1231. path="wizard/"
  1232. component={make(() => import('sentry/views/alerts/wizard'))}
  1233. />
  1234. </Route>
  1235. </Fragment>
  1236. );
  1237. };
  1238. const alertRoutes = (
  1239. <Fragment>
  1240. {usingCustomerDomain ? (
  1241. <Route
  1242. path="/alerts/"
  1243. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1244. key="orgless-alerts-route"
  1245. >
  1246. {alertChildRoutes({forCustomerDomain: true})}
  1247. </Route>
  1248. ) : null}
  1249. <Route
  1250. path="/organizations/:orgId/alerts/"
  1251. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1252. key="org-alerts"
  1253. >
  1254. {alertChildRoutes({forCustomerDomain: false})}
  1255. </Route>
  1256. </Fragment>
  1257. );
  1258. const monitorsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1259. return (
  1260. <Fragment>
  1261. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1262. <Route
  1263. path={
  1264. forCustomerDomain
  1265. ? '/monitors/create/'
  1266. : '/organizations/:orgId/monitors/create/'
  1267. }
  1268. component={make(() => import('sentry/views/monitors/create'))}
  1269. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1270. />
  1271. <Route
  1272. path={
  1273. forCustomerDomain
  1274. ? '/monitors/:monitorId/'
  1275. : '/organizations/:orgId/monitors/:monitorId/'
  1276. }
  1277. component={make(() => import('sentry/views/monitors/details'))}
  1278. key={
  1279. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1280. }
  1281. />
  1282. <Route
  1283. path={
  1284. forCustomerDomain
  1285. ? '/monitors/:monitorId/edit/'
  1286. : '/organizations/:orgId/monitors/:monitorId/edit/'
  1287. }
  1288. component={make(() => import('sentry/views/monitors/edit'))}
  1289. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1290. />
  1291. </Fragment>
  1292. );
  1293. };
  1294. const monitorsRoutes = (
  1295. <Fragment>
  1296. {usingCustomerDomain ? (
  1297. <Route
  1298. path="/monitors/"
  1299. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1300. key="orgless-monitors-route"
  1301. >
  1302. {monitorsChildRoutes({forCustomerDomain: true})}
  1303. </Route>
  1304. ) : null}
  1305. <Route
  1306. path="/organizations/:orgId/monitors/"
  1307. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1308. key="org-monitors"
  1309. >
  1310. {monitorsChildRoutes({forCustomerDomain: false})}
  1311. </Route>
  1312. </Fragment>
  1313. );
  1314. const replayChildRoutes = (
  1315. <Fragment>
  1316. <IndexRoute component={make(() => import('sentry/views/replays/replays'))} />
  1317. <Route
  1318. path=":replaySlug/"
  1319. component={make(() => import('sentry/views/replays/details'))}
  1320. />
  1321. </Fragment>
  1322. );
  1323. const replayRoutes = (
  1324. <Fragment>
  1325. {usingCustomerDomain ? (
  1326. <Route
  1327. path="/replays/"
  1328. component={withDomainRequired(make(() => import('sentry/views/replays')))}
  1329. key="orgless-replays-route"
  1330. >
  1331. {replayChildRoutes}
  1332. </Route>
  1333. ) : null}
  1334. <Route
  1335. path="/organizations/:orgId/replays/"
  1336. component={withDomainRedirect(make(() => import('sentry/views/replays')))}
  1337. key="org-replays"
  1338. >
  1339. {replayChildRoutes}
  1340. </Route>
  1341. </Fragment>
  1342. );
  1343. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1344. return (
  1345. <Fragment>
  1346. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1347. <Route
  1348. path=":release/"
  1349. component={make(() => import('sentry/views/releases/detail'))}
  1350. >
  1351. <IndexRoute
  1352. component={make(() => import('sentry/views/releases/detail/overview'))}
  1353. />
  1354. <Route
  1355. path="commits/"
  1356. component={make(
  1357. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1358. )}
  1359. />
  1360. <Route
  1361. path="files-changed/"
  1362. component={make(
  1363. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1364. )}
  1365. />
  1366. {forCustomerDomain ? null : (
  1367. <Fragment>
  1368. <Redirect
  1369. from="new-events/"
  1370. to="/organizations/:orgId/releases/:release/"
  1371. />
  1372. <Redirect
  1373. from="all-events/"
  1374. to="/organizations/:orgId/releases/:release/"
  1375. />
  1376. </Fragment>
  1377. )}
  1378. </Route>
  1379. </Fragment>
  1380. );
  1381. };
  1382. const releasesRoutes = (
  1383. <Fragment>
  1384. {usingCustomerDomain ? (
  1385. <Route
  1386. path="/releases/"
  1387. component={withDomainRequired(NoOp)}
  1388. key="orgless-releases-route"
  1389. >
  1390. {releasesChildRoutes({forCustomerDomain: true})}
  1391. </Route>
  1392. ) : null}
  1393. <Route
  1394. path="/organizations/:orgId/releases/"
  1395. component={withDomainRedirect(NoOp)}
  1396. key="org-releases"
  1397. >
  1398. {releasesChildRoutes({forCustomerDomain: false})}
  1399. </Route>
  1400. </Fragment>
  1401. );
  1402. const activityRoutes = (
  1403. <Fragment>
  1404. {usingCustomerDomain ? (
  1405. <Route
  1406. path="/activity/"
  1407. component={withDomainRequired(
  1408. make(() => import('sentry/views/organizationActivity'))
  1409. )}
  1410. key="orgless-activity-route"
  1411. />
  1412. ) : null}
  1413. <Route
  1414. path="/organizations/:orgId/activity/"
  1415. component={withDomainRedirect(
  1416. make(() => import('sentry/views/organizationActivity'))
  1417. )}
  1418. key="org-activity"
  1419. />
  1420. </Fragment>
  1421. );
  1422. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1423. return (
  1424. <Fragment>
  1425. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1426. <Route
  1427. path="issues/"
  1428. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1429. >
  1430. <IndexRoute
  1431. component={make(
  1432. () => import('sentry/views/organizationStats/teamInsights/issues')
  1433. )}
  1434. />
  1435. </Route>
  1436. <Route
  1437. path="health/"
  1438. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1439. >
  1440. <IndexRoute
  1441. component={make(
  1442. () => import('sentry/views/organizationStats/teamInsights/health')
  1443. )}
  1444. />
  1445. </Route>
  1446. {forCustomerDomain ? null : (
  1447. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1448. )}
  1449. </Fragment>
  1450. );
  1451. };
  1452. const statsRoutes = (
  1453. <Fragment>
  1454. {usingCustomerDomain ? (
  1455. <Route
  1456. path="/stats/"
  1457. component={withDomainRequired(NoOp)}
  1458. key="orgless-stats-route"
  1459. >
  1460. {statsChildRoutes({forCustomerDomain: true})}
  1461. </Route>
  1462. ) : null}
  1463. <Route
  1464. path="/organizations/:orgId/stats/"
  1465. component={withDomainRedirect(NoOp)}
  1466. key="org-stats"
  1467. >
  1468. {statsChildRoutes({forCustomerDomain: false})}
  1469. </Route>
  1470. </Fragment>
  1471. );
  1472. // TODO(mark) Long term this /queries route should go away and /discover
  1473. // should be the canonical route for discover2. We have a redirect right now
  1474. // as /discover was for discover 1 and most of the application is linking to
  1475. // /discover/queries and not /discover
  1476. const discoverChildRoutes = (
  1477. <Fragment>
  1478. <IndexRedirect to="queries/" />
  1479. <Route
  1480. path="homepage/"
  1481. component={make(() => import('sentry/views/eventsV2/homepage'))}
  1482. />
  1483. <Route
  1484. path="queries/"
  1485. component={make(() => import('sentry/views/eventsV2/landing'))}
  1486. />
  1487. <Route
  1488. path="results/"
  1489. component={make(() => import('sentry/views/eventsV2/results'))}
  1490. />
  1491. <Route
  1492. path=":eventSlug/"
  1493. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1494. />
  1495. </Fragment>
  1496. );
  1497. const discoverRoutes = (
  1498. <Fragment>
  1499. {usingCustomerDomain ? (
  1500. <Route
  1501. path="/discover/"
  1502. component={withDomainRequired(make(() => import('sentry/views/eventsV2')))}
  1503. key="orgless-discover-route"
  1504. >
  1505. {discoverChildRoutes}
  1506. </Route>
  1507. ) : null}
  1508. <Route
  1509. path="/organizations/:orgId/discover/"
  1510. component={withDomainRedirect(make(() => import('sentry/views/eventsV2')))}
  1511. key="org-discover-route"
  1512. >
  1513. {discoverChildRoutes}
  1514. </Route>
  1515. </Fragment>
  1516. );
  1517. const performanceChildRoutes = (
  1518. <Fragment>
  1519. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1520. <Route
  1521. path="trends/"
  1522. component={make(() => import('sentry/views/performance/trends'))}
  1523. />
  1524. <Route path="summary/">
  1525. <IndexRoute
  1526. component={make(
  1527. () =>
  1528. import('sentry/views/performance/transactionSummary/transactionOverview')
  1529. )}
  1530. />
  1531. <Route
  1532. path="replays/"
  1533. component={make(
  1534. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1535. )}
  1536. />
  1537. <Route
  1538. path="vitals/"
  1539. component={make(
  1540. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1541. )}
  1542. />
  1543. <Route
  1544. path="tags/"
  1545. component={make(
  1546. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1547. )}
  1548. />
  1549. <Route
  1550. path="events/"
  1551. component={make(
  1552. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1553. )}
  1554. />
  1555. <Route
  1556. path="anomalies/"
  1557. component={make(
  1558. () =>
  1559. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1560. )}
  1561. />
  1562. <Route
  1563. path="profiles/"
  1564. component={make(
  1565. () =>
  1566. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1567. )}
  1568. />
  1569. <Route path="spans/">
  1570. <IndexRoute
  1571. component={make(
  1572. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1573. )}
  1574. />
  1575. <Route
  1576. path=":spanSlug/"
  1577. component={make(
  1578. () =>
  1579. import(
  1580. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1581. )
  1582. )}
  1583. />
  1584. </Route>
  1585. </Route>
  1586. <Route
  1587. path="vitaldetail/"
  1588. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1589. />
  1590. <Route
  1591. path="trace/:traceSlug/"
  1592. component={make(() => import('sentry/views/performance/traceDetails'))}
  1593. />
  1594. <Route
  1595. path=":eventSlug/"
  1596. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1597. />
  1598. </Fragment>
  1599. );
  1600. const performanceRoutes = (
  1601. <Fragment>
  1602. {usingCustomerDomain ? (
  1603. <Route
  1604. path="/performance/"
  1605. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1606. key="orgless-performance-route"
  1607. >
  1608. {performanceChildRoutes}
  1609. </Route>
  1610. ) : null}
  1611. <Route
  1612. path="/organizations/:orgId/performance/"
  1613. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1614. key="org-performance"
  1615. >
  1616. {performanceChildRoutes}
  1617. </Route>
  1618. </Fragment>
  1619. );
  1620. const userFeedbackRoutes = (
  1621. <Fragment>
  1622. {usingCustomerDomain ? (
  1623. <Route
  1624. path="/user-feedback/"
  1625. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1626. key="orgless-user-feedback-route"
  1627. />
  1628. ) : null}
  1629. <Route
  1630. path="/organizations/:orgId/user-feedback/"
  1631. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1632. key="org-user-feedback"
  1633. />
  1634. </Fragment>
  1635. );
  1636. const issueListRoutes = (
  1637. <Fragment>
  1638. {usingCustomerDomain ? (
  1639. <Route
  1640. path="/issues/(searches/:searchId/)"
  1641. component={withDomainRequired(errorHandler(IssueListContainer))}
  1642. key="orgless-issues-route"
  1643. >
  1644. <IndexRoute component={errorHandler(IssueListOverview)} />
  1645. </Route>
  1646. ) : null}
  1647. <Route
  1648. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1649. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1650. key="org-issues"
  1651. >
  1652. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1653. <IndexRoute component={errorHandler(IssueListOverview)} />
  1654. </Route>
  1655. </Fragment>
  1656. );
  1657. // Once org issues is complete, these routes can be nested under
  1658. // /organizations/:orgId/issues
  1659. const issueDetailsChildRoutes = (
  1660. <Fragment>
  1661. <IndexRoute
  1662. component={make(
  1663. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1664. )}
  1665. />
  1666. <Route
  1667. path={TabPaths[Tab.REPLAYS]}
  1668. component={make(
  1669. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1670. )}
  1671. />
  1672. <Route
  1673. path={TabPaths[Tab.ACTIVITY]}
  1674. component={make(
  1675. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1676. )}
  1677. />
  1678. <Route
  1679. path={TabPaths[Tab.EVENTS]}
  1680. component={make(
  1681. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1682. )}
  1683. />
  1684. <Route
  1685. path={TabPaths[Tab.TAGS]}
  1686. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1687. />
  1688. <Route
  1689. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1690. component={make(
  1691. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1692. )}
  1693. />
  1694. <Route
  1695. path={TabPaths[Tab.USER_FEEDBACK]}
  1696. component={make(
  1697. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1698. )}
  1699. />
  1700. <Route
  1701. path={TabPaths[Tab.ATTACHMENTS]}
  1702. component={make(
  1703. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1704. )}
  1705. />
  1706. <Route
  1707. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1708. component={make(
  1709. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1710. )}
  1711. />
  1712. <Route
  1713. path={TabPaths[Tab.MERGED]}
  1714. component={make(
  1715. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1716. )}
  1717. />
  1718. <Route
  1719. path={TabPaths[Tab.GROUPING]}
  1720. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1721. />
  1722. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1723. <IndexRoute
  1724. component={make(
  1725. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1726. )}
  1727. />
  1728. <Route
  1729. path={TabPaths[Tab.REPLAYS]}
  1730. component={make(
  1731. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1732. )}
  1733. />
  1734. <Route
  1735. path={TabPaths[Tab.ACTIVITY]}
  1736. component={make(
  1737. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1738. )}
  1739. />
  1740. <Route
  1741. path={TabPaths[Tab.EVENTS]}
  1742. component={make(
  1743. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1744. )}
  1745. />
  1746. <Route
  1747. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1748. component={make(
  1749. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1750. )}
  1751. />
  1752. <Route
  1753. path={TabPaths[Tab.TAGS]}
  1754. component={make(
  1755. () => import('sentry/views/organizationGroupDetails/groupTags')
  1756. )}
  1757. />
  1758. <Route
  1759. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1760. component={make(
  1761. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1762. )}
  1763. />
  1764. <Route
  1765. path={TabPaths[Tab.USER_FEEDBACK]}
  1766. component={make(
  1767. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1768. )}
  1769. />
  1770. <Route
  1771. path={TabPaths[Tab.ATTACHMENTS]}
  1772. component={make(
  1773. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1774. )}
  1775. />
  1776. <Route
  1777. path={TabPaths[Tab.MERGED]}
  1778. component={make(
  1779. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1780. )}
  1781. />
  1782. <Route
  1783. path={TabPaths[Tab.GROUPING]}
  1784. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1785. />
  1786. </Route>
  1787. </Fragment>
  1788. );
  1789. const issueDetailsRoutes = (
  1790. <Fragment>
  1791. <Route
  1792. path="/organizations/:orgId/issues/:groupId/"
  1793. component={withDomainRedirect(
  1794. make(() => import('sentry/views/organizationGroupDetails'))
  1795. )}
  1796. key="org-issues-group-id"
  1797. >
  1798. {issueDetailsChildRoutes}
  1799. </Route>
  1800. {usingCustomerDomain ? (
  1801. <Route
  1802. path="/issues/:groupId/"
  1803. component={withDomainRequired(
  1804. make(() => import('sentry/views/organizationGroupDetails'))
  1805. )}
  1806. key="orgless-issues-group-id-route"
  1807. >
  1808. {issueDetailsChildRoutes}
  1809. </Route>
  1810. ) : null}
  1811. </Fragment>
  1812. );
  1813. // These are the "manage" pages. For sentry.io, these are _different_ from
  1814. // the SaaS admin routes in getsentry.
  1815. const adminManageRoutes = (
  1816. <Route
  1817. path="/manage/"
  1818. component={make(() => import('sentry/views/admin/adminLayout'))}
  1819. >
  1820. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1821. <Route
  1822. path="buffer/"
  1823. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1824. />
  1825. <Route
  1826. path="relays/"
  1827. component={make(() => import('sentry/views/admin/adminRelays'))}
  1828. />
  1829. <Route
  1830. path="organizations/"
  1831. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1832. />
  1833. <Route
  1834. path="projects/"
  1835. component={make(() => import('sentry/views/admin/adminProjects'))}
  1836. />
  1837. <Route
  1838. path="queue/"
  1839. component={make(() => import('sentry/views/admin/adminQueue'))}
  1840. />
  1841. <Route
  1842. path="quotas/"
  1843. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1844. />
  1845. <Route
  1846. path="settings/"
  1847. component={make(() => import('sentry/views/admin/adminSettings'))}
  1848. />
  1849. <Route path="users/">
  1850. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1851. <Route
  1852. path=":id"
  1853. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1854. />
  1855. </Route>
  1856. <Route
  1857. path="status/mail/"
  1858. component={make(() => import('sentry/views/admin/adminMail'))}
  1859. />
  1860. <Route
  1861. path="status/environment/"
  1862. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1863. />
  1864. <Route
  1865. path="status/packages/"
  1866. component={make(() => import('sentry/views/admin/adminPackages'))}
  1867. />
  1868. <Route
  1869. path="status/warnings/"
  1870. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1871. />
  1872. </Route>
  1873. );
  1874. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1875. // me why we need the OrganizationRoot root container.
  1876. const legacyOrganizationRootRoutes = (
  1877. <Route component={errorHandler(OrganizationRoot)}>
  1878. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1879. <Route path="/organizations/:orgId/">
  1880. {hook('routes:organization')}
  1881. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1882. <Redirect
  1883. from="/organizations/:orgId/teams/your-teams/"
  1884. to="/settings/:orgId/teams/"
  1885. />
  1886. <Redirect
  1887. from="/organizations/:orgId/teams/all-teams/"
  1888. to="/settings/:orgId/teams/"
  1889. />
  1890. <Redirect
  1891. from="/organizations/:orgId/teams/:teamId/"
  1892. to="/settings/:orgId/teams/:teamId/"
  1893. />
  1894. <Redirect
  1895. from="/organizations/:orgId/teams/:teamId/members/"
  1896. to="/settings/:orgId/teams/:teamId/members/"
  1897. />
  1898. <Redirect
  1899. from="/organizations/:orgId/teams/:teamId/projects/"
  1900. to="/settings/:orgId/teams/:teamId/projects/"
  1901. />
  1902. <Redirect
  1903. from="/organizations/:orgId/teams/:teamId/settings/"
  1904. to="/settings/:orgId/teams/:teamId/settings/"
  1905. />
  1906. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1907. <Redirect
  1908. from="/organizations/:orgId/api-keys/"
  1909. to="/settings/:orgId/api-keys/"
  1910. />
  1911. <Redirect
  1912. from="/organizations/:orgId/api-keys/:apiKey/"
  1913. to="/settings/:orgId/api-keys/:apiKey/"
  1914. />
  1915. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1916. <Redirect
  1917. from="/organizations/:orgId/members/:memberId/"
  1918. to="/settings/:orgId/members/:memberId/"
  1919. />
  1920. <Redirect
  1921. from="/organizations/:orgId/rate-limits/"
  1922. to="/settings/:orgId/rate-limits/"
  1923. />
  1924. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1925. </Route>
  1926. </Route>
  1927. );
  1928. const gettingStartedChildRoutes = (
  1929. <Fragment>
  1930. <IndexRoute
  1931. component={make(() => import('sentry/views/projectInstall/overview'))}
  1932. />
  1933. <Route
  1934. path=":platform/"
  1935. component={make(
  1936. () => import('sentry/views/projectInstall/platformOrIntegration')
  1937. )}
  1938. />
  1939. </Fragment>
  1940. );
  1941. const gettingStartedRoutes = (
  1942. <Fragment>
  1943. {usingCustomerDomain ? (
  1944. <Route
  1945. path="/getting-started/:projectId/"
  1946. component={withDomainRequired(
  1947. make(() => import('sentry/views/projectInstall/gettingStarted'))
  1948. )}
  1949. key="orgless-getting-started-route"
  1950. >
  1951. {gettingStartedChildRoutes}
  1952. </Route>
  1953. ) : null}
  1954. <Route
  1955. path="/:orgId/:projectId/getting-started/"
  1956. component={withDomainRedirect(
  1957. make(() => import('sentry/views/projectInstall/gettingStarted')),
  1958. {
  1959. redirect: [
  1960. {
  1961. // If /:orgId/:projectId/getting-started/* is encountered, then redirect to /getting-started/:projectId/*
  1962. from: '/:orgId/:projectId/getting-started/',
  1963. to: '/getting-started/:projectId/',
  1964. },
  1965. ],
  1966. }
  1967. )}
  1968. key="org-getting-started"
  1969. >
  1970. {gettingStartedChildRoutes}
  1971. </Route>
  1972. </Fragment>
  1973. );
  1974. const profilingChildRoutes = (
  1975. <Fragment>
  1976. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1977. <Route
  1978. path="summary/:projectId/"
  1979. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1980. />
  1981. <Route
  1982. path="profile/:projectId/:eventId/"
  1983. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1984. >
  1985. <Route
  1986. path="details/"
  1987. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1988. />
  1989. <Route
  1990. path="flamechart/"
  1991. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1992. />
  1993. </Route>
  1994. </Fragment>
  1995. );
  1996. const profilingRoutes = (
  1997. <Fragment>
  1998. {usingCustomerDomain ? (
  1999. <Route
  2000. path="/profiling/"
  2001. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2002. key="orgless-profiling-route"
  2003. >
  2004. {profilingChildRoutes}
  2005. </Route>
  2006. ) : null}
  2007. <Route
  2008. path="/organizations/:orgId/profiling/"
  2009. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2010. key="org-profiling"
  2011. >
  2012. {profilingChildRoutes}
  2013. </Route>
  2014. </Fragment>
  2015. );
  2016. const organizationRoutes = (
  2017. <Route component={errorHandler(OrganizationDetails)}>
  2018. {settingsRoutes}
  2019. {projectsRoutes}
  2020. {dashboardRoutes}
  2021. {userFeedbackRoutes}
  2022. {issueListRoutes}
  2023. {issueDetailsRoutes}
  2024. {alertRoutes}
  2025. {monitorsRoutes}
  2026. {replayRoutes}
  2027. {releasesRoutes}
  2028. {activityRoutes}
  2029. {statsRoutes}
  2030. {discoverRoutes}
  2031. {performanceRoutes}
  2032. {profilingRoutes}
  2033. {adminManageRoutes}
  2034. {gettingStartedRoutes}
  2035. {legacyOrganizationRootRoutes}
  2036. </Route>
  2037. );
  2038. const legacyRedirectRoutes = (
  2039. <Route path="/:orgId/">
  2040. <IndexRedirect to="/organizations/:orgId/" />
  2041. <Route path=":projectId/settings/">
  2042. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2043. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2044. <Redirect
  2045. from="alerts/rules/"
  2046. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2047. />
  2048. <Redirect
  2049. from="alerts/rules/new/"
  2050. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2051. />
  2052. <Redirect
  2053. from="alerts/rules/:ruleId/"
  2054. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2055. />
  2056. <Redirect
  2057. from="environments/"
  2058. to="/settings/:orgId/projects/:projectId/environments/"
  2059. />
  2060. <Redirect
  2061. from="environments/hidden/"
  2062. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2063. />
  2064. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2065. <Redirect
  2066. from="issue-tracking/"
  2067. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2068. />
  2069. <Redirect
  2070. from="release-tracking/"
  2071. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2072. />
  2073. <Redirect
  2074. from="ownership/"
  2075. to="/settings/:orgId/projects/:projectId/ownership/"
  2076. />
  2077. <Redirect
  2078. from="data-forwarding/"
  2079. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2080. />
  2081. <Redirect
  2082. from="debug-symbols/"
  2083. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2084. />
  2085. <Redirect
  2086. from="processing-issues/"
  2087. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2088. />
  2089. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2090. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2091. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2092. <Redirect
  2093. from="keys/:keyId/"
  2094. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2095. />
  2096. <Redirect
  2097. from="user-feedback/"
  2098. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2099. />
  2100. <Redirect
  2101. from="security-headers/"
  2102. to="/settings/:orgId/projects/:projectId/security-headers/"
  2103. />
  2104. <Redirect
  2105. from="security-headers/csp/"
  2106. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2107. />
  2108. <Redirect
  2109. from="security-headers/expect-ct/"
  2110. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2111. />
  2112. <Redirect
  2113. from="security-headers/hpkp/"
  2114. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2115. />
  2116. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2117. <Redirect
  2118. from="plugins/:pluginId/"
  2119. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2120. />
  2121. <Redirect
  2122. from="integrations/:providerKey/"
  2123. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2124. />
  2125. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  2126. <Redirect
  2127. from="install/:platform'"
  2128. to="/settings/:orgId/projects/:projectId/install/:platform/"
  2129. />
  2130. </Route>
  2131. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2132. <Redirect
  2133. from=":projectId/issues/:groupId/"
  2134. to="/organizations/:orgId/issues/:groupId/"
  2135. />
  2136. <Redirect
  2137. from=":projectId/issues/:groupId/events/"
  2138. to="/organizations/:orgId/issues/:groupId/events/"
  2139. />
  2140. <Redirect
  2141. from=":projectId/issues/:groupId/events/:eventId/"
  2142. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2143. />
  2144. <Redirect
  2145. from=":projectId/issues/:groupId/tags/"
  2146. to="/organizations/:orgId/issues/:groupId/tags/"
  2147. />
  2148. <Redirect
  2149. from=":projectId/issues/:groupId/tags/:tagKey/"
  2150. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2151. />
  2152. <Redirect
  2153. from=":projectId/issues/:groupId/feedback/"
  2154. to="/organizations/:orgId/issues/:groupId/feedback/"
  2155. />
  2156. <Redirect
  2157. from=":projectId/issues/:groupId/similar/"
  2158. to="/organizations/:orgId/issues/:groupId/similar/"
  2159. />
  2160. <Redirect
  2161. from=":projectId/issues/:groupId/merged/"
  2162. to="/organizations/:orgId/issues/:groupId/merged/"
  2163. />
  2164. <Route
  2165. path=":projectId/events/:eventId/"
  2166. component={errorHandler(ProjectEventRedirect)}
  2167. />
  2168. </Route>
  2169. );
  2170. const appRoutes = (
  2171. <Route>
  2172. {experimentalSpaRoutes}
  2173. <Route path="/" component={errorHandler(App)}>
  2174. {rootRoutes}
  2175. {organizationRoutes}
  2176. {legacyRedirectRoutes}
  2177. <Route path="*" component={errorHandler(RouteNotFound)} />
  2178. </Route>
  2179. </Route>
  2180. );
  2181. return appRoutes;
  2182. }
  2183. // We load routes both when initlaizing the SDK (for routing integrations) and
  2184. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2185. export const routes = memoize(buildRoutes);
  2186. function NoOp(props) {
  2187. return <Fragment>{props.children}</Fragment>;
  2188. }