routes.tsx 59 KB

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