routes.tsx 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  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 {SamplingRuleType} from 'sentry/types/sampling';
  17. import errorHandler from 'sentry/utils/errorHandler';
  18. import App from 'sentry/views/app';
  19. import AuthLayout from 'sentry/views/auth/layout';
  20. import IssueListContainer from 'sentry/views/issueList/container';
  21. import IssueListOverview from 'sentry/views/issueList/overview';
  22. import OrganizationContextContainer from 'sentry/views/organizationContextContainer';
  23. import OrganizationDetails from 'sentry/views/organizationDetails';
  24. import {Tab} from 'sentry/views/organizationGroupDetails/types';
  25. import OrganizationRoot from 'sentry/views/organizationRoot';
  26. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  27. import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
  28. import RouteNotFound from 'sentry/views/routeNotFound';
  29. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  30. type CustomProps = {
  31. name?: string;
  32. };
  33. /**
  34. * We add some additional props to our routes
  35. */
  36. const Route = BaseRoute as React.ComponentClass<RouteProps & CustomProps>;
  37. const IndexRoute = BaseIndexRoute as React.ComponentClass<IndexRouteProps & CustomProps>;
  38. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  39. const SafeLazyLoad = errorHandler(LazyLoad);
  40. type PromisedImport<C> = Promise<{default: C}>;
  41. type ComponentType = React.ComponentType<any>;
  42. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  43. // pirvate routing tree.
  44. /**
  45. * Factory function to produce a component that will render the SafeLazyLoad
  46. * _with_ the required props.
  47. */
  48. export function makeLazyloadComponent<C extends ComponentType>(
  49. resolve: () => PromisedImport<C>
  50. ) {
  51. // XXX: Assign the component to a variable so it has a displayname
  52. const RouteLazyLoad: React.FC<React.ComponentProps<C>> = props => {
  53. return <SafeLazyLoad {...props} component={resolve} />;
  54. };
  55. return RouteLazyLoad;
  56. }
  57. // Shorthand to avoid extra line wrapping
  58. const make = makeLazyloadComponent;
  59. function buildRoutes() {
  60. // Read this to understand where to add new routes, how / why the routing
  61. // tree is structured the way it is, and how the lazy-loading /
  62. // code-splitting works for pages.
  63. //
  64. // ## Formatting
  65. //
  66. // NOTE that there are intentionally NO blank lines within route tree blocks.
  67. // This helps make it easier to navigate within the file by using your
  68. // editors shortcuts to jump between 'paragraphs' of code.
  69. //
  70. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  71. //
  72. //
  73. // ## Lazy loading
  74. //
  75. // * The `SafeLazyLoad` component
  76. //
  77. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  78. // errorHandler wrapped version). This means the rendered component for the
  79. // route will only be loaded when the route is loaded. This helps us
  80. // "code-split" the app.
  81. //
  82. // ## Hooks
  83. //
  84. // There are a number of `hook()` routes placed within the routing tree to
  85. // allow for additional routes to be augmented into the application via the
  86. // hookStore mechanism.
  87. //
  88. //
  89. // ## The structure
  90. //
  91. // * `experimentalSpaRoutes`
  92. //
  93. // These routes are specifically for the experimental single-page-app mode,
  94. // where Sentry is run separate from Django. These are NOT part of the root
  95. // <App /> component.
  96. //
  97. // Right now these are mainly used for authentication pages. In the future
  98. // they would be used for other pages like registration.
  99. //
  100. // * `rootRoutes`
  101. //
  102. // These routes live directly under the <App /> container, and generally
  103. // are not specific to an organization.
  104. //
  105. // * `settingsRoutes`
  106. //
  107. // This is the route tree for all of `/settings/`. This route tree is
  108. // composed of a few different sub-trees.
  109. //
  110. // - `accountSettingsRoutes` User specific settings
  111. // - `orgSettingsRoutes` Specific to a organization
  112. // - `projectSettingsRoutes` Specific to a project
  113. // - `legacySettingsRedirects` Routes that used to exist in settings
  114. //
  115. // * `organizationRoutes`
  116. //
  117. // This is where a majority of the app routes live. This is wrapped with
  118. // the <OrganizationDetails /> component, which provides the sidebar and
  119. // organization context.
  120. //
  121. // Within these routes are a variety of subroutes. They are not all
  122. // listed here as the subroutes will be added and removed, and most are
  123. // self explanatory.
  124. //
  125. // * `legacyRedirectRoutes`
  126. //
  127. // This route tree contains <Redirect /> routes for many old legacy paths.
  128. //
  129. // You may also find <Redirect />'s collocated next to the feature routes
  130. // they have redirects for. A good rule here is to place 'helper' redirects
  131. // next to the routes they redirect to, and place 'legacy route' redirects
  132. // for routes that have completely changed in this tree.
  133. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  134. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  135. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  136. </Route>
  137. ) : null;
  138. const rootRoutes = (
  139. <Fragment>
  140. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  141. <Route
  142. path="/accept/:memberId/:token/"
  143. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  144. />
  145. <Route
  146. path="/accept-transfer/"
  147. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  148. />
  149. <Route
  150. path="/extensions/external-install/:integrationSlug/:installationId"
  151. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  152. />
  153. <Route
  154. path="/extensions/:integrationSlug/link/"
  155. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  156. />
  157. <Route
  158. path="/sentry-apps/:sentryAppSlug/external-install/"
  159. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  160. />
  161. <Redirect from="/account/" to="/settings/account/details/" />
  162. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  163. <Route
  164. path="/share/issue/:shareId/"
  165. component={make(() => import('sentry/views/sharedGroupDetails'))}
  166. />
  167. <Route
  168. path="/organizations/new/"
  169. component={make(() => import('sentry/views/organizationCreate'))}
  170. />
  171. <Route
  172. path="/organizations/:orgId/data-export/:dataExportId"
  173. component={make(() => import('sentry/views/dataExport/dataDownload'))}
  174. />
  175. <Route
  176. path="/organizations/:orgId/disabled-member/"
  177. component={make(() => import('sentry/views/disabledMember'))}
  178. />
  179. <Route
  180. path="/join-request/:orgId/"
  181. component={make(() => import('sentry/views/organizationJoinRequest'))}
  182. />
  183. <Route
  184. path="/onboarding/:orgId/"
  185. component={errorHandler(OrganizationContextContainer)}
  186. >
  187. <IndexRedirect to="welcome/" />
  188. <Route
  189. path=":step/"
  190. component={make(() => import('sentry/views/onboarding/onboardingController'))}
  191. />
  192. </Route>
  193. </Fragment>
  194. );
  195. const accountSettingsRoutes = (
  196. <Route
  197. path="account/"
  198. name={t('Account')}
  199. component={make(
  200. () => import('sentry/views/settings/account/accountSettingsLayout')
  201. )}
  202. >
  203. <IndexRedirect to="details/" />
  204. <Route
  205. path="details/"
  206. name={t('Details')}
  207. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  208. />
  209. <Route path="notifications/" name={t('Notifications')}>
  210. <IndexRoute
  211. component={make(
  212. () =>
  213. import('sentry/views/settings/account/notifications/notificationSettings')
  214. )}
  215. />
  216. <Route
  217. path=":fineTuneType/"
  218. name={t('Fine Tune Alerts')}
  219. component={make(
  220. () => import('sentry/views/settings/account/accountNotificationFineTuning')
  221. )}
  222. />
  223. </Route>
  224. <Route
  225. path="emails/"
  226. name={t('Emails')}
  227. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  228. />
  229. <Route
  230. path="authorizations/"
  231. component={make(
  232. () => import('sentry/views/settings/account/accountAuthorizations')
  233. )}
  234. />
  235. <Route name={t('Security')} path="security/">
  236. <Route
  237. component={make(
  238. () =>
  239. import(
  240. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  241. )
  242. )}
  243. >
  244. <IndexRoute
  245. component={make(
  246. () => import('sentry/views/settings/account/accountSecurity')
  247. )}
  248. />
  249. <Route
  250. path="session-history/"
  251. name={t('Session History')}
  252. component={make(
  253. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  254. )}
  255. />
  256. <Route
  257. path="mfa/:authId/"
  258. name={t('Details')}
  259. component={make(
  260. () =>
  261. import(
  262. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  263. )
  264. )}
  265. />
  266. </Route>
  267. <Route
  268. path="mfa/:authId/enroll/"
  269. name={t('Enroll')}
  270. component={make(
  271. () =>
  272. import(
  273. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  274. )
  275. )}
  276. />
  277. </Route>
  278. <Route
  279. path="subscriptions/"
  280. name={t('Subscriptions')}
  281. component={make(
  282. () => import('sentry/views/settings/account/accountSubscriptions')
  283. )}
  284. />
  285. <Route
  286. path="identities/"
  287. name={t('Identities')}
  288. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  289. />
  290. <Route path="api/" name={t('API')}>
  291. <IndexRedirect to="auth-tokens/" />
  292. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  293. <IndexRoute
  294. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  295. />
  296. <Route
  297. path="new-token/"
  298. name={t('Create New Token')}
  299. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  300. />
  301. </Route>
  302. <Route path="applications/" name={t('Applications')}>
  303. <IndexRoute
  304. component={make(
  305. () => import('sentry/views/settings/account/apiApplications')
  306. )}
  307. />
  308. <Route
  309. path=":appId/"
  310. name={t('Details')}
  311. component={make(
  312. () => import('sentry/views/settings/account/apiApplications/details')
  313. )}
  314. />
  315. </Route>
  316. {hook('routes:api')}
  317. </Route>
  318. <Route
  319. path="close-account/"
  320. name={t('Close Account')}
  321. component={make(() => import('sentry/views/settings/account/accountClose'))}
  322. />
  323. </Route>
  324. );
  325. const projectSettingsRoutes = (
  326. <Route
  327. path="projects/:projectId/"
  328. name={t('Project')}
  329. component={make(
  330. () => import('sentry/views/settings/project/projectSettingsLayout')
  331. )}
  332. >
  333. <IndexRoute
  334. name={t('General')}
  335. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  336. />
  337. <Route
  338. path="teams/"
  339. name={t('Teams')}
  340. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  341. />
  342. <Route
  343. path="alerts/"
  344. name={t('Alerts')}
  345. component={make(() => import('sentry/views/settings/projectAlerts'))}
  346. >
  347. <IndexRoute
  348. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  349. />
  350. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  351. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  352. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  353. <Redirect
  354. from="metric-rules/new/"
  355. to="/organizations/:orgId/alerts/:projectId/new/"
  356. />
  357. <Redirect
  358. from="rules/:ruleId/"
  359. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  360. />
  361. <Redirect
  362. from="metric-rules/:ruleId/"
  363. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  364. />
  365. </Route>
  366. <Route
  367. path="environments/"
  368. name={t('Environments')}
  369. component={make(
  370. () => import('sentry/views/settings/project/projectEnvironments')
  371. )}
  372. >
  373. <IndexRoute />
  374. <Route path="hidden/" />
  375. </Route>
  376. <Route
  377. path="tags/"
  378. name={t('Tags')}
  379. component={make(() => import('sentry/views/settings/projectTags'))}
  380. />
  381. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  382. <Route
  383. path="release-tracking/"
  384. name={t('Release Tracking')}
  385. component={make(
  386. () => import('sentry/views/settings/project/projectReleaseTracking')
  387. )}
  388. />
  389. <Route
  390. path="ownership/"
  391. name={t('Issue Owners')}
  392. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  393. />
  394. <Route
  395. path="data-forwarding/"
  396. name={t('Data Forwarding')}
  397. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  398. />
  399. <Route
  400. path="security-and-privacy/"
  401. name={t('Security & Privacy')}
  402. component={make(() => import('sentry/views/settings/projectSecurityAndPrivacy'))}
  403. />
  404. <Route
  405. path="debug-symbols/"
  406. name={t('Debug Information Files')}
  407. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  408. />
  409. <Route
  410. path="proguard/"
  411. name={t('ProGuard Mappings')}
  412. component={make(() => import('sentry/views/settings/projectProguard'))}
  413. />
  414. <Route
  415. path="performance/"
  416. name={t('Performance')}
  417. component={make(() => import('sentry/views/settings/projectPerformance'))}
  418. />
  419. <Route
  420. path="source-maps/"
  421. name={t('Source Maps')}
  422. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  423. >
  424. <IndexRoute
  425. component={make(() => import('sentry/views/settings/projectSourceMaps/list'))}
  426. />
  427. <Route
  428. path=":name/"
  429. name={t('Archive')}
  430. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  431. />
  432. </Route>
  433. <Route
  434. path="processing-issues/"
  435. name={t('Processing Issues')}
  436. component={make(
  437. () => import('sentry/views/settings/project/projectProcessingIssues')
  438. )}
  439. />
  440. <Route
  441. path="filters/"
  442. name={t('Inbound Filters')}
  443. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  444. >
  445. <IndexRedirect to="data-filters/" />
  446. <Route path=":filterType/" />
  447. </Route>
  448. <Route
  449. path="sampling/"
  450. name={t('Sampling')}
  451. component={make(() => import('sentry/views/settings/project/sampling'))}
  452. >
  453. <IndexRedirect to={`${SamplingRuleType.TRACE}/`} />
  454. <Route path=":ruleType/" />
  455. </Route>
  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. );
  1013. const releasesRoutes = (
  1014. <Route path="/organizations/:orgId/releases/">
  1015. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1016. <Route
  1017. path=":release/"
  1018. component={make(() => import('sentry/views/releases/detail'))}
  1019. >
  1020. <IndexRoute
  1021. component={make(() => import('sentry/views/releases/detail/overview'))}
  1022. />
  1023. <Route
  1024. path="commits/"
  1025. component={make(
  1026. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1027. )}
  1028. />
  1029. <Route
  1030. path="files-changed/"
  1031. component={make(
  1032. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1033. )}
  1034. />
  1035. <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />
  1036. <Redirect from="all-events/" to="/organizations/:orgId/releases/:release/" />
  1037. </Route>
  1038. </Route>
  1039. );
  1040. const activityRoutes = (
  1041. <Route
  1042. path="/organizations/:orgId/activity/"
  1043. component={make(() => import('sentry/views/organizationActivity'))}
  1044. />
  1045. );
  1046. const statsRoutes = (
  1047. <Route path="/organizations/:orgId/stats/">
  1048. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1049. <Route
  1050. path="issues/"
  1051. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1052. >
  1053. <IndexRoute
  1054. component={make(
  1055. () => import('sentry/views/organizationStats/teamInsights/issues')
  1056. )}
  1057. />
  1058. </Route>
  1059. <Route
  1060. path="health/"
  1061. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1062. >
  1063. <IndexRoute
  1064. component={make(
  1065. () => import('sentry/views/organizationStats/teamInsights/health')
  1066. )}
  1067. />
  1068. </Route>
  1069. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1070. </Route>
  1071. );
  1072. // TODO(mark) Long term this /queries route should go away and /discover
  1073. // should be the canonical route for discover2. We have a redirect right now
  1074. // as /discover was for discover 1 and most of the application is linking to
  1075. // /discover/queries and not /discover
  1076. const discoverRoutes = (
  1077. <Route
  1078. path="/organizations/:orgId/discover/"
  1079. component={make(() => import('sentry/views/eventsV2'))}
  1080. >
  1081. <IndexRedirect to="queries/" />
  1082. <Route
  1083. path="queries/"
  1084. component={make(() => import('sentry/views/eventsV2/landing'))}
  1085. />
  1086. <Route
  1087. path="results/"
  1088. component={make(() => import('sentry/views/eventsV2/results'))}
  1089. />
  1090. <Route
  1091. path=":eventSlug/"
  1092. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1093. />
  1094. </Route>
  1095. );
  1096. const performanceRoutes = (
  1097. <Route
  1098. path="/organizations/:orgId/performance/"
  1099. component={make(() => import('sentry/views/performance'))}
  1100. >
  1101. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1102. <Route
  1103. path="trends/"
  1104. component={make(() => import('sentry/views/performance/trends'))}
  1105. />
  1106. <Route path="/organizations/:orgId/performance/summary/">
  1107. <IndexRoute
  1108. component={make(
  1109. () =>
  1110. import('sentry/views/performance/transactionSummary/transactionOverview')
  1111. )}
  1112. />
  1113. <Route
  1114. path="vitals/"
  1115. component={make(
  1116. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1117. )}
  1118. />
  1119. <Route
  1120. path="tags/"
  1121. component={make(
  1122. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1123. )}
  1124. />
  1125. <Route
  1126. path="events/"
  1127. component={make(
  1128. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1129. )}
  1130. />
  1131. <Route
  1132. path="anomalies/"
  1133. component={make(
  1134. () =>
  1135. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1136. )}
  1137. />
  1138. <Route path="spans/">
  1139. <IndexRoute
  1140. component={make(
  1141. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1142. )}
  1143. />
  1144. <Route
  1145. path=":spanSlug/"
  1146. component={make(
  1147. () =>
  1148. import(
  1149. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1150. )
  1151. )}
  1152. />
  1153. </Route>
  1154. </Route>
  1155. <Route
  1156. path="vitaldetail/"
  1157. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1158. />
  1159. <Route
  1160. path="trace/:traceSlug/"
  1161. component={make(() => import('sentry/views/performance/traceDetails'))}
  1162. />
  1163. <Route
  1164. path=":eventSlug/"
  1165. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1166. />
  1167. </Route>
  1168. );
  1169. const userFeedbackRoutes = (
  1170. <Route
  1171. path="/organizations/:orgId/user-feedback/"
  1172. component={make(() => import('sentry/views/userFeedback'))}
  1173. />
  1174. );
  1175. const issueListRoutes = (
  1176. <Route
  1177. path="/organizations/:orgId/issues/"
  1178. component={errorHandler(IssueListContainer)}
  1179. >
  1180. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1181. <IndexRoute component={errorHandler(IssueListOverview)} />
  1182. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1183. </Route>
  1184. );
  1185. // Once org issues is complete, these routes can be nested under
  1186. // /organizations/:orgId/issues
  1187. const issueDetailsRoutes = (
  1188. <Route
  1189. path="/organizations/:orgId/issues/:groupId/"
  1190. component={make(() => import('sentry/views/organizationGroupDetails'))}
  1191. >
  1192. <IndexRoute
  1193. component={make(
  1194. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1195. )}
  1196. props={{
  1197. currentTab: Tab.DETAILS,
  1198. isEventRoute: false,
  1199. }}
  1200. />
  1201. <Route
  1202. path="replays/"
  1203. component={make(
  1204. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1205. )}
  1206. props={{
  1207. currentTab: Tab.REPLAYS,
  1208. isEventRoute: false,
  1209. }}
  1210. />
  1211. <Route
  1212. path="activity/"
  1213. component={make(
  1214. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1215. )}
  1216. props={{
  1217. currentTab: Tab.ACTIVITY,
  1218. isEventRoute: false,
  1219. }}
  1220. />
  1221. <Route
  1222. path="events/"
  1223. component={make(
  1224. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1225. )}
  1226. props={{
  1227. currentTab: Tab.EVENTS,
  1228. isEventRoute: false,
  1229. }}
  1230. />
  1231. <Route
  1232. path="tags/"
  1233. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1234. props={{
  1235. currentTab: Tab.TAGS,
  1236. isEventRoute: false,
  1237. }}
  1238. />
  1239. <Route
  1240. path="tags/:tagKey/"
  1241. component={make(
  1242. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1243. )}
  1244. props={{
  1245. currentTab: Tab.TAGS,
  1246. isEventRoute: false,
  1247. }}
  1248. />
  1249. <Route
  1250. path="feedback/"
  1251. component={make(
  1252. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1253. )}
  1254. props={{
  1255. currentTab: Tab.USER_FEEDBACK,
  1256. isEventRoute: false,
  1257. }}
  1258. />
  1259. <Route
  1260. path="attachments/"
  1261. component={make(
  1262. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1263. )}
  1264. props={{
  1265. currentTab: Tab.ATTACHMENTS,
  1266. isEventRoute: false,
  1267. }}
  1268. />
  1269. <Route
  1270. path="similar/"
  1271. component={make(
  1272. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1273. )}
  1274. props={{
  1275. currentTab: Tab.SIMILAR_ISSUES,
  1276. isEventRoute: false,
  1277. }}
  1278. />
  1279. <Route
  1280. path="merged/"
  1281. component={make(
  1282. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1283. )}
  1284. props={{
  1285. currentTab: Tab.MERGED,
  1286. isEventRoute: false,
  1287. }}
  1288. />
  1289. <Route
  1290. path="grouping/"
  1291. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1292. props={{
  1293. currentTab: Tab.GROUPING,
  1294. isEventRoute: false,
  1295. }}
  1296. />
  1297. <Route path="events/:eventId/">
  1298. <IndexRoute
  1299. component={make(
  1300. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1301. )}
  1302. props={{
  1303. currentTab: Tab.DETAILS,
  1304. isEventRoute: true,
  1305. }}
  1306. />
  1307. <Route
  1308. path="activity/"
  1309. component={make(
  1310. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1311. )}
  1312. props={{
  1313. currentTab: Tab.ACTIVITY,
  1314. isEventRoute: true,
  1315. }}
  1316. />
  1317. <Route
  1318. path="events/"
  1319. component={make(
  1320. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1321. )}
  1322. props={{
  1323. currentTab: Tab.EVENTS,
  1324. isEventRoute: true,
  1325. }}
  1326. />
  1327. <Route
  1328. path="similar/"
  1329. component={make(
  1330. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1331. )}
  1332. props={{
  1333. currentTab: Tab.SIMILAR_ISSUES,
  1334. isEventRoute: true,
  1335. }}
  1336. />
  1337. <Route
  1338. path="tags/"
  1339. component={make(
  1340. () => import('sentry/views/organizationGroupDetails/groupTags')
  1341. )}
  1342. props={{
  1343. currentTab: Tab.TAGS,
  1344. isEventRoute: true,
  1345. }}
  1346. />
  1347. <Route
  1348. path="tags/:tagKey/"
  1349. component={make(
  1350. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1351. )}
  1352. props={{
  1353. currentTab: Tab.TAGS,
  1354. isEventRoute: true,
  1355. }}
  1356. />
  1357. <Route
  1358. path="feedback/"
  1359. component={make(
  1360. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1361. )}
  1362. props={{
  1363. currentTab: Tab.USER_FEEDBACK,
  1364. isEventRoute: true,
  1365. }}
  1366. />
  1367. <Route
  1368. path="attachments/"
  1369. component={make(
  1370. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1371. )}
  1372. props={{
  1373. currentTab: Tab.ATTACHMENTS,
  1374. isEventRoute: true,
  1375. }}
  1376. />
  1377. <Route
  1378. path="merged/"
  1379. component={make(
  1380. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1381. )}
  1382. props={{
  1383. currentTab: Tab.MERGED,
  1384. isEventRoute: true,
  1385. }}
  1386. />
  1387. <Route
  1388. path="grouping/"
  1389. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1390. props={{
  1391. currentTab: Tab.GROUPING,
  1392. isEventRoute: true,
  1393. }}
  1394. />
  1395. </Route>
  1396. </Route>
  1397. );
  1398. // These are the "manage" pages. For sentry.io, these are _different_ from
  1399. // the SaaS admin routes in getsentry.
  1400. const adminManageRoutes = (
  1401. <Route
  1402. path="/manage/"
  1403. component={make(() => import('sentry/views/admin/adminLayout'))}
  1404. >
  1405. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1406. <Route
  1407. path="buffer/"
  1408. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1409. />
  1410. <Route
  1411. path="relays/"
  1412. component={make(() => import('sentry/views/admin/adminRelays'))}
  1413. />
  1414. <Route
  1415. path="organizations/"
  1416. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1417. />
  1418. <Route
  1419. path="projects/"
  1420. component={make(() => import('sentry/views/admin/adminProjects'))}
  1421. />
  1422. <Route
  1423. path="queue/"
  1424. component={make(() => import('sentry/views/admin/adminQueue'))}
  1425. />
  1426. <Route
  1427. path="quotas/"
  1428. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1429. />
  1430. <Route
  1431. path="settings/"
  1432. component={make(() => import('sentry/views/admin/adminSettings'))}
  1433. />
  1434. <Route path="users/">
  1435. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1436. <Route
  1437. path=":id"
  1438. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1439. />
  1440. </Route>
  1441. <Route
  1442. path="status/mail/"
  1443. component={make(() => import('sentry/views/admin/adminMail'))}
  1444. />
  1445. <Route
  1446. path="status/environment/"
  1447. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1448. />
  1449. <Route
  1450. path="status/packages/"
  1451. component={make(() => import('sentry/views/admin/adminPackages'))}
  1452. />
  1453. <Route
  1454. path="status/warnings/"
  1455. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1456. />
  1457. {hook('routes:admin')}
  1458. </Route>
  1459. );
  1460. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1461. // me why we need the OrganizationRoot root container.
  1462. const legacyOrganizationRootRoutes = (
  1463. <Route component={errorHandler(OrganizationRoot)}>
  1464. <Route
  1465. path="/organizations/:orgId/teams/new/"
  1466. component={make(() => import('sentry/views/teamCreate'))}
  1467. />
  1468. <Route path="/organizations/:orgId/">
  1469. {hook('routes:organization')}
  1470. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1471. <Redirect
  1472. from="/organizations/:orgId/teams/your-teams/"
  1473. to="/settings/:orgId/teams/"
  1474. />
  1475. <Redirect
  1476. from="/organizations/:orgId/teams/all-teams/"
  1477. to="/settings/:orgId/teams/"
  1478. />
  1479. <Redirect
  1480. from="/organizations/:orgId/teams/:teamId/"
  1481. to="/settings/:orgId/teams/:teamId/"
  1482. />
  1483. <Redirect
  1484. from="/organizations/:orgId/teams/:teamId/members/"
  1485. to="/settings/:orgId/teams/:teamId/members/"
  1486. />
  1487. <Redirect
  1488. from="/organizations/:orgId/teams/:teamId/projects/"
  1489. to="/settings/:orgId/teams/:teamId/projects/"
  1490. />
  1491. <Redirect
  1492. from="/organizations/:orgId/teams/:teamId/settings/"
  1493. to="/settings/:orgId/teams/:teamId/settings/"
  1494. />
  1495. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1496. <Redirect
  1497. from="/organizations/:orgId/api-keys/"
  1498. to="/settings/:orgId/api-keys/"
  1499. />
  1500. <Redirect
  1501. from="/organizations/:orgId/api-keys/:apiKey/"
  1502. to="/settings/:orgId/api-keys/:apiKey/"
  1503. />
  1504. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1505. <Redirect
  1506. from="/organizations/:orgId/members/:memberId/"
  1507. to="/settings/:orgId/members/:memberId/"
  1508. />
  1509. <Redirect
  1510. from="/organizations/:orgId/rate-limits/"
  1511. to="/settings/:orgId/rate-limits/"
  1512. />
  1513. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1514. </Route>
  1515. </Route>
  1516. );
  1517. // XXX(epurkhiser): These also exist in the legacyOrganizationRootRoutes. Not
  1518. // sure which one here is more correct.
  1519. const legacyGettingStartedRoutes = (
  1520. <Route
  1521. path="/:orgId/:projectId/getting-started/"
  1522. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1523. >
  1524. <IndexRoute
  1525. component={make(() => import('sentry/views/projectInstall/overview'))}
  1526. />
  1527. <Route
  1528. path=":platform/"
  1529. component={make(
  1530. () => import('sentry/views/projectInstall/platformOrIntegration')
  1531. )}
  1532. />
  1533. </Route>
  1534. );
  1535. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1536. // canonical URLs.
  1537. //
  1538. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1539. // or do these need to be nested into the OrganizationDetails tree?
  1540. const legacyOrgRedirects = (
  1541. <Route path="/:orgId/:projectId/">
  1542. <IndexRoute
  1543. component={errorHandler(
  1544. redirectDeprecatedProjectRoute(
  1545. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1546. )
  1547. )}
  1548. />
  1549. <Route
  1550. path="issues/"
  1551. component={errorHandler(
  1552. redirectDeprecatedProjectRoute(
  1553. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1554. )
  1555. )}
  1556. />
  1557. <Route
  1558. path="dashboard/"
  1559. component={errorHandler(
  1560. redirectDeprecatedProjectRoute(
  1561. ({orgId, projectId}) =>
  1562. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1563. )
  1564. )}
  1565. />
  1566. <Route
  1567. path="user-feedback/"
  1568. component={errorHandler(
  1569. redirectDeprecatedProjectRoute(
  1570. ({orgId, projectId}) =>
  1571. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1572. )
  1573. )}
  1574. />
  1575. <Route
  1576. path="releases/"
  1577. component={errorHandler(
  1578. redirectDeprecatedProjectRoute(
  1579. ({orgId, projectId}) =>
  1580. `/organizations/${orgId}/releases/?project=${projectId}`
  1581. )
  1582. )}
  1583. />
  1584. <Route
  1585. path="releases/:version/"
  1586. component={errorHandler(
  1587. redirectDeprecatedProjectRoute(
  1588. ({orgId, projectId, router}) =>
  1589. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1590. )
  1591. )}
  1592. />
  1593. <Route
  1594. path="releases/:version/new-events/"
  1595. component={errorHandler(
  1596. redirectDeprecatedProjectRoute(
  1597. ({orgId, projectId, router}) =>
  1598. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1599. )
  1600. )}
  1601. />
  1602. <Route
  1603. path="releases/:version/all-events/"
  1604. component={errorHandler(
  1605. redirectDeprecatedProjectRoute(
  1606. ({orgId, projectId, router}) =>
  1607. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1608. )
  1609. )}
  1610. />
  1611. <Route
  1612. path="releases/:version/commits/"
  1613. component={errorHandler(
  1614. redirectDeprecatedProjectRoute(
  1615. ({orgId, projectId, router}) =>
  1616. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1617. )
  1618. )}
  1619. />
  1620. </Route>
  1621. );
  1622. const profilingRoutes = (
  1623. <Route
  1624. path="/organizations/:orgId/profiling/"
  1625. component={make(() => import('sentry/views/profiling'))}
  1626. >
  1627. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1628. <Route
  1629. path="summary/:projectId/"
  1630. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1631. />
  1632. <Route
  1633. path="profile/:projectId/:eventId"
  1634. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1635. >
  1636. <Route
  1637. path="details/"
  1638. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1639. />
  1640. <Route
  1641. path="flamegraph/"
  1642. component={make(() => import('sentry/views/profiling/profileFlamegraph'))}
  1643. />
  1644. </Route>
  1645. </Route>
  1646. );
  1647. const organizationRoutes = (
  1648. <Route component={errorHandler(OrganizationDetails)}>
  1649. {settingsRoutes}
  1650. {projectsRoutes}
  1651. {dashboardRoutes}
  1652. {userFeedbackRoutes}
  1653. {issueListRoutes}
  1654. {issueDetailsRoutes}
  1655. {alertRoutes}
  1656. {monitorsRoutes}
  1657. {replayRoutes}
  1658. {releasesRoutes}
  1659. {activityRoutes}
  1660. {statsRoutes}
  1661. {discoverRoutes}
  1662. {performanceRoutes}
  1663. {profilingRoutes}
  1664. {adminManageRoutes}
  1665. {legacyOrganizationRootRoutes}
  1666. {legacyGettingStartedRoutes}
  1667. {legacyOrgRedirects}
  1668. </Route>
  1669. );
  1670. const legacyRedirectRoutes = (
  1671. <Route path="/:orgId/">
  1672. <IndexRedirect to="/organizations/:orgId/" />
  1673. <Route path=":projectId/settings/">
  1674. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  1675. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  1676. <Redirect
  1677. from="alerts/rules/"
  1678. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  1679. />
  1680. <Redirect
  1681. from="alerts/rules/new/"
  1682. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  1683. />
  1684. <Redirect
  1685. from="alerts/rules/:ruleId/"
  1686. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  1687. />
  1688. <Redirect
  1689. from="environments/"
  1690. to="/settings/:orgId/projects/:projectId/environments/"
  1691. />
  1692. <Redirect
  1693. from="environments/hidden/"
  1694. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  1695. />
  1696. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  1697. <Redirect
  1698. from="issue-tracking/"
  1699. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  1700. />
  1701. <Redirect
  1702. from="release-tracking/"
  1703. to="/settings/:orgId/projects/:projectId/release-tracking/"
  1704. />
  1705. <Redirect
  1706. from="ownership/"
  1707. to="/settings/:orgId/projects/:projectId/ownership/"
  1708. />
  1709. <Redirect
  1710. from="data-forwarding/"
  1711. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  1712. />
  1713. <Redirect
  1714. from="debug-symbols/"
  1715. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  1716. />
  1717. <Redirect
  1718. from="processing-issues/"
  1719. to="/settings/:orgId/projects/:projectId/processing-issues/"
  1720. />
  1721. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  1722. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  1723. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  1724. <Redirect
  1725. from="keys/:keyId/"
  1726. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  1727. />
  1728. <Redirect
  1729. from="user-feedback/"
  1730. to="/settings/:orgId/projects/:projectId/user-feedback/"
  1731. />
  1732. <Redirect
  1733. from="security-headers/"
  1734. to="/settings/:orgId/projects/:projectId/security-headers/"
  1735. />
  1736. <Redirect
  1737. from="security-headers/csp/"
  1738. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  1739. />
  1740. <Redirect
  1741. from="security-headers/expect-ct/"
  1742. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  1743. />
  1744. <Redirect
  1745. from="security-headers/hpkp/"
  1746. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  1747. />
  1748. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  1749. <Redirect
  1750. from="plugins/:pluginId/"
  1751. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  1752. />
  1753. <Redirect
  1754. from="integrations/:providerKey/"
  1755. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  1756. />
  1757. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  1758. <Redirect
  1759. from="install/:platform'"
  1760. to="/settings/:orgId/projects/:projectId/install/:platform/"
  1761. />
  1762. </Route>
  1763. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  1764. <Redirect
  1765. from=":projectId/issues/:groupId/"
  1766. to="/organizations/:orgId/issues/:groupId/"
  1767. />
  1768. <Redirect
  1769. from=":projectId/issues/:groupId/events/"
  1770. to="/organizations/:orgId/issues/:groupId/events/"
  1771. />
  1772. <Redirect
  1773. from=":projectId/issues/:groupId/events/:eventId/"
  1774. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  1775. />
  1776. <Redirect
  1777. from=":projectId/issues/:groupId/tags/"
  1778. to="/organizations/:orgId/issues/:groupId/tags/"
  1779. />
  1780. <Redirect
  1781. from=":projectId/issues/:groupId/tags/:tagKey/"
  1782. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  1783. />
  1784. <Redirect
  1785. from=":projectId/issues/:groupId/feedback/"
  1786. to="/organizations/:orgId/issues/:groupId/feedback/"
  1787. />
  1788. <Redirect
  1789. from=":projectId/issues/:groupId/similar/"
  1790. to="/organizations/:orgId/issues/:groupId/similar/"
  1791. />
  1792. <Redirect
  1793. from=":projectId/issues/:groupId/merged/"
  1794. to="/organizations/:orgId/issues/:groupId/merged/"
  1795. />
  1796. <Route
  1797. path=":projectId/events/:eventId/"
  1798. component={errorHandler(ProjectEventRedirect)}
  1799. />
  1800. </Route>
  1801. );
  1802. const appRoutes = (
  1803. <Route>
  1804. {experimentalSpaRoutes}
  1805. <Route path="/" component={errorHandler(App)}>
  1806. {rootRoutes}
  1807. {organizationRoutes}
  1808. {legacyRedirectRoutes}
  1809. {hook('routes')}
  1810. <Route path="*" component={errorHandler(RouteNotFound)} />
  1811. </Route>
  1812. </Route>
  1813. );
  1814. return appRoutes;
  1815. }
  1816. // We load routes both when initlaizing the SDK (for routing integrations) and
  1817. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  1818. export const routes = memoize(buildRoutes);