routes.tsx 59 KB

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