routes.tsx 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888
  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 path="sentry-functions/" name={t('Sentry Functions')}>
  795. <Route
  796. path="new/"
  797. name={t('Create Sentry Function')}
  798. component={make(
  799. () =>
  800. import(
  801. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  802. )
  803. )}
  804. />
  805. </Route>
  806. </Route>
  807. </Route>
  808. );
  809. const legacySettingsRedirects = (
  810. <Fragment>
  811. <Redirect from=":projectId/" to="projects/:projectId/" />
  812. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  813. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  814. <Redirect
  815. from=":projectId/alerts/rules/:ruleId/"
  816. to="projects/:projectId/alerts/rules/:ruleId/"
  817. />
  818. </Fragment>
  819. );
  820. const settingsRoutes = (
  821. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  822. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  823. {accountSettingsRoutes}
  824. <Route name={t('Organization')} path=":orgId/">
  825. {orgSettingsRoutes}
  826. {projectSettingsRoutes}
  827. {legacySettingsRedirects}
  828. </Route>
  829. </Route>
  830. );
  831. const projectsRoutes = (
  832. <Route path="/organizations/:orgId/projects/">
  833. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  834. <Route
  835. path="new/"
  836. component={make(() => import('sentry/views/projectInstall/newProject'))}
  837. />
  838. <Route
  839. path=":projectId/getting-started/"
  840. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  841. >
  842. <IndexRoute
  843. component={make(() => import('sentry/views/projectInstall/overview'))}
  844. />
  845. <Route
  846. path=":platform/"
  847. component={make(
  848. () => import('sentry/views/projectInstall/platformOrIntegration')
  849. )}
  850. />
  851. </Route>
  852. <Route
  853. path=":projectId/"
  854. component={make(() => import('sentry/views/projectDetail'))}
  855. />
  856. <Route
  857. path=":projectId/events/:eventId/"
  858. component={errorHandler(ProjectEventRedirect)}
  859. />
  860. </Route>
  861. );
  862. const dashboardRoutes = (
  863. <Fragment>
  864. <Route
  865. path="/organizations/:orgId/dashboards/"
  866. component={make(() => import('sentry/views/dashboardsV2'))}
  867. >
  868. <IndexRoute component={make(() => import('sentry/views/dashboardsV2/manage'))} />
  869. </Route>
  870. <Route
  871. path="/organizations/:orgId/dashboards/new/"
  872. component={make(() => import('sentry/views/dashboardsV2/create'))}
  873. >
  874. <Route
  875. path="widget/:widgetIndex/edit/"
  876. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  877. />
  878. <Route
  879. path="widget/new/"
  880. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  881. />
  882. </Route>
  883. <Route
  884. path="/organizations/:orgId/dashboards/new/:templateId"
  885. component={make(() => import('sentry/views/dashboardsV2/create'))}
  886. >
  887. <Route
  888. path="widget/:widgetId/"
  889. component={make(() => import('sentry/views/dashboardsV2/create'))}
  890. />
  891. </Route>
  892. <Redirect
  893. from="/organizations/:orgId/dashboards/:dashboardId/"
  894. to="/organizations/:orgId/dashboard/:dashboardId/"
  895. />
  896. <Route
  897. path="/organizations/:orgId/dashboard/:dashboardId/"
  898. component={make(() => import('sentry/views/dashboardsV2/view'))}
  899. >
  900. <Route
  901. path="widget/:widgetIndex/edit/"
  902. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  903. />
  904. <Route
  905. path="widget/new/"
  906. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  907. />
  908. <Route
  909. path="widget/:widgetId/"
  910. component={make(() => import('sentry/views/dashboardsV2/view'))}
  911. />
  912. </Route>
  913. </Fragment>
  914. );
  915. const alertRoutes = (
  916. <Route
  917. path="/organizations/:orgId/alerts/"
  918. component={make(() => import('sentry/views/alerts'))}
  919. >
  920. <IndexRoute component={make(() => import('sentry/views/alerts/list/incidents'))} />
  921. <Route path="rules/">
  922. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  923. <Route
  924. path="details/:ruleId/"
  925. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  926. />
  927. <Route
  928. path=":projectId/"
  929. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  930. >
  931. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  932. <Route
  933. path=":ruleId/"
  934. component={make(() => import('sentry/views/alerts/edit'))}
  935. />
  936. </Route>
  937. <Route
  938. path=":projectId/:ruleId/details/"
  939. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  940. >
  941. <IndexRoute
  942. component={make(
  943. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  944. )}
  945. />
  946. </Route>
  947. </Route>
  948. <Route path="metric-rules/">
  949. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  950. <Route
  951. path=":projectId/"
  952. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  953. >
  954. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  955. <Route
  956. path=":ruleId/"
  957. component={make(() => import('sentry/views/alerts/edit'))}
  958. />
  959. </Route>
  960. </Route>
  961. <Route
  962. path="wizard/"
  963. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  964. >
  965. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  966. </Route>
  967. <Route
  968. path="new/"
  969. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  970. >
  971. <IndexRedirect to="/organizations/:orgId/alerts/wizard/" />
  972. <Route
  973. path=":alertType/"
  974. component={make(() => import('sentry/views/alerts/create'))}
  975. />
  976. </Route>
  977. <Route
  978. path=":alertId/"
  979. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  980. />
  981. <Route
  982. path=":projectId/"
  983. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  984. >
  985. <Route path="new/" component={make(() => import('sentry/views/alerts/create'))} />
  986. <Route
  987. path="wizard/"
  988. component={make(() => import('sentry/views/alerts/wizard'))}
  989. />
  990. </Route>
  991. </Route>
  992. );
  993. const monitorsRoutes = (
  994. <Route
  995. path="/organizations/:orgId/monitors/"
  996. component={make(() => import('sentry/views/monitors'))}
  997. >
  998. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  999. <Route
  1000. path="/organizations/:orgId/monitors/create/"
  1001. component={make(() => import('sentry/views/monitors/create'))}
  1002. />
  1003. <Route
  1004. path="/organizations/:orgId/monitors/:monitorId/"
  1005. component={make(() => import('sentry/views/monitors/details'))}
  1006. />
  1007. <Route
  1008. path="/organizations/:orgId/monitors/:monitorId/edit/"
  1009. component={make(() => import('sentry/views/monitors/edit'))}
  1010. />
  1011. </Route>
  1012. );
  1013. const replayRoutes = (
  1014. <Route
  1015. path="/organizations/:orgId/replays/"
  1016. component={make(() => import('sentry/views/replays'))}
  1017. >
  1018. <IndexRoute component={make(() => import('sentry/views/replays/replays'))} />
  1019. <Route
  1020. path=":eventSlug/"
  1021. component={make(() => import('sentry/views/replays/details'))}
  1022. />
  1023. </Route>
  1024. );
  1025. const releasesRoutes = (
  1026. <Route path="/organizations/:orgId/releases/">
  1027. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1028. <Route
  1029. path=":release/"
  1030. component={make(() => import('sentry/views/releases/detail'))}
  1031. >
  1032. <IndexRoute
  1033. component={make(() => import('sentry/views/releases/detail/overview'))}
  1034. />
  1035. <Route
  1036. path="activity/"
  1037. component={make(() => import('sentry/views/releases/detail/activity'))}
  1038. />
  1039. <Route
  1040. path="commits/"
  1041. component={make(
  1042. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1043. )}
  1044. />
  1045. <Route
  1046. path="files-changed/"
  1047. component={make(
  1048. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1049. )}
  1050. />
  1051. <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />
  1052. <Redirect from="all-events/" to="/organizations/:orgId/releases/:release/" />
  1053. </Route>
  1054. </Route>
  1055. );
  1056. const activityRoutes = (
  1057. <Route
  1058. path="/organizations/:orgId/activity/"
  1059. component={make(() => import('sentry/views/organizationActivity'))}
  1060. />
  1061. );
  1062. const statsRoutes = (
  1063. <Route path="/organizations/:orgId/stats/">
  1064. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1065. <Route
  1066. path="issues/"
  1067. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1068. >
  1069. <IndexRoute
  1070. component={make(
  1071. () => import('sentry/views/organizationStats/teamInsights/issues')
  1072. )}
  1073. />
  1074. </Route>
  1075. <Route
  1076. path="health/"
  1077. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1078. >
  1079. <IndexRoute
  1080. component={make(
  1081. () => import('sentry/views/organizationStats/teamInsights/health')
  1082. )}
  1083. />
  1084. </Route>
  1085. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1086. </Route>
  1087. );
  1088. // TODO(mark) Long term this /queries route should go away and /discover
  1089. // should be the canonical route for discover2. We have a redirect right now
  1090. // as /discover was for discover 1 and most of the application is linking to
  1091. // /discover/queries and not /discover
  1092. const discoverRoutes = (
  1093. <Route
  1094. path="/organizations/:orgId/discover/"
  1095. component={make(() => import('sentry/views/eventsV2'))}
  1096. >
  1097. <IndexRedirect to="queries/" />
  1098. <Route
  1099. path="queries/"
  1100. component={make(() => import('sentry/views/eventsV2/landing'))}
  1101. />
  1102. <Route
  1103. path="results/"
  1104. component={make(() => import('sentry/views/eventsV2/results'))}
  1105. />
  1106. <Route
  1107. path=":eventSlug/"
  1108. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1109. />
  1110. </Route>
  1111. );
  1112. const performanceRoutes = (
  1113. <Route
  1114. path="/organizations/:orgId/performance/"
  1115. component={make(() => import('sentry/views/performance'))}
  1116. >
  1117. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1118. <Route
  1119. path="trends/"
  1120. component={make(() => import('sentry/views/performance/trends'))}
  1121. />
  1122. <Route path="/organizations/:orgId/performance/summary/">
  1123. <IndexRoute
  1124. component={make(
  1125. () =>
  1126. import('sentry/views/performance/transactionSummary/transactionOverview')
  1127. )}
  1128. />
  1129. <Route
  1130. path="vitals/"
  1131. component={make(
  1132. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1133. )}
  1134. />
  1135. <Route
  1136. path="tags/"
  1137. component={make(
  1138. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1139. )}
  1140. />
  1141. <Route
  1142. path="events/"
  1143. component={make(
  1144. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1145. )}
  1146. />
  1147. <Route
  1148. path="anomalies/"
  1149. component={make(
  1150. () =>
  1151. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1152. )}
  1153. />
  1154. <Route path="spans/">
  1155. <IndexRoute
  1156. component={make(
  1157. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1158. )}
  1159. />
  1160. <Route
  1161. path=":spanSlug/"
  1162. component={make(
  1163. () =>
  1164. import(
  1165. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1166. )
  1167. )}
  1168. />
  1169. </Route>
  1170. </Route>
  1171. <Route
  1172. path="vitaldetail/"
  1173. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1174. />
  1175. <Route
  1176. path="trace/:traceSlug/"
  1177. component={make(() => import('sentry/views/performance/traceDetails'))}
  1178. />
  1179. <Route
  1180. path=":eventSlug/"
  1181. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1182. />
  1183. </Route>
  1184. );
  1185. const userFeedbackRoutes = (
  1186. <Route
  1187. path="/organizations/:orgId/user-feedback/"
  1188. component={make(() => import('sentry/views/userFeedback'))}
  1189. />
  1190. );
  1191. const issueListRoutes = (
  1192. <Route
  1193. path="/organizations/:orgId/issues/"
  1194. component={errorHandler(IssueListContainer)}
  1195. >
  1196. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1197. <IndexRoute component={errorHandler(IssueListOverview)} />
  1198. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1199. </Route>
  1200. );
  1201. // Once org issues is complete, these routes can be nested under
  1202. // /organizations/:orgId/issues
  1203. const issueDetailsRoutes = (
  1204. <Route
  1205. path="/organizations/:orgId/issues/:groupId/"
  1206. component={make(() => import('sentry/views/organizationGroupDetails'))}
  1207. >
  1208. <IndexRoute
  1209. component={make(
  1210. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1211. )}
  1212. props={{
  1213. currentTab: Tab.DETAILS,
  1214. isEventRoute: false,
  1215. }}
  1216. />
  1217. <Route
  1218. path="replays/"
  1219. component={make(
  1220. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1221. )}
  1222. props={{
  1223. currentTab: Tab.REPLAYS,
  1224. isEventRoute: false,
  1225. }}
  1226. />
  1227. <Route
  1228. path="activity/"
  1229. component={make(
  1230. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1231. )}
  1232. props={{
  1233. currentTab: Tab.ACTIVITY,
  1234. isEventRoute: false,
  1235. }}
  1236. />
  1237. <Route
  1238. path="events/"
  1239. component={make(
  1240. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1241. )}
  1242. props={{
  1243. currentTab: Tab.EVENTS,
  1244. isEventRoute: false,
  1245. }}
  1246. />
  1247. <Route
  1248. path="tags/"
  1249. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1250. props={{
  1251. currentTab: Tab.TAGS,
  1252. isEventRoute: false,
  1253. }}
  1254. />
  1255. <Route
  1256. path="tags/:tagKey/"
  1257. component={make(
  1258. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1259. )}
  1260. props={{
  1261. currentTab: Tab.TAGS,
  1262. isEventRoute: false,
  1263. }}
  1264. />
  1265. <Route
  1266. path="feedback/"
  1267. component={make(
  1268. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1269. )}
  1270. props={{
  1271. currentTab: Tab.USER_FEEDBACK,
  1272. isEventRoute: false,
  1273. }}
  1274. />
  1275. <Route
  1276. path="attachments/"
  1277. component={make(
  1278. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1279. )}
  1280. props={{
  1281. currentTab: Tab.ATTACHMENTS,
  1282. isEventRoute: false,
  1283. }}
  1284. />
  1285. <Route
  1286. path="similar/"
  1287. component={make(
  1288. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1289. )}
  1290. props={{
  1291. currentTab: Tab.SIMILAR_ISSUES,
  1292. isEventRoute: false,
  1293. }}
  1294. />
  1295. <Route
  1296. path="merged/"
  1297. component={make(
  1298. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1299. )}
  1300. props={{
  1301. currentTab: Tab.MERGED,
  1302. isEventRoute: false,
  1303. }}
  1304. />
  1305. <Route
  1306. path="grouping/"
  1307. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1308. props={{
  1309. currentTab: Tab.GROUPING,
  1310. isEventRoute: false,
  1311. }}
  1312. />
  1313. <Route path="events/:eventId/">
  1314. <IndexRoute
  1315. component={make(
  1316. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1317. )}
  1318. props={{
  1319. currentTab: Tab.DETAILS,
  1320. isEventRoute: true,
  1321. }}
  1322. />
  1323. <Route
  1324. path="replays/"
  1325. component={make(
  1326. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1327. )}
  1328. props={{
  1329. currentTab: Tab.REPLAYS,
  1330. isEventRoute: true,
  1331. }}
  1332. />
  1333. <Route
  1334. path="activity/"
  1335. component={make(
  1336. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1337. )}
  1338. props={{
  1339. currentTab: Tab.ACTIVITY,
  1340. isEventRoute: true,
  1341. }}
  1342. />
  1343. <Route
  1344. path="events/"
  1345. component={make(
  1346. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1347. )}
  1348. props={{
  1349. currentTab: Tab.EVENTS,
  1350. isEventRoute: true,
  1351. }}
  1352. />
  1353. <Route
  1354. path="similar/"
  1355. component={make(
  1356. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1357. )}
  1358. props={{
  1359. currentTab: Tab.SIMILAR_ISSUES,
  1360. isEventRoute: true,
  1361. }}
  1362. />
  1363. <Route
  1364. path="tags/"
  1365. component={make(
  1366. () => import('sentry/views/organizationGroupDetails/groupTags')
  1367. )}
  1368. props={{
  1369. currentTab: Tab.TAGS,
  1370. isEventRoute: true,
  1371. }}
  1372. />
  1373. <Route
  1374. path="tags/:tagKey/"
  1375. component={make(
  1376. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1377. )}
  1378. props={{
  1379. currentTab: Tab.TAGS,
  1380. isEventRoute: true,
  1381. }}
  1382. />
  1383. <Route
  1384. path="feedback/"
  1385. component={make(
  1386. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1387. )}
  1388. props={{
  1389. currentTab: Tab.USER_FEEDBACK,
  1390. isEventRoute: true,
  1391. }}
  1392. />
  1393. <Route
  1394. path="attachments/"
  1395. component={make(
  1396. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1397. )}
  1398. props={{
  1399. currentTab: Tab.ATTACHMENTS,
  1400. isEventRoute: true,
  1401. }}
  1402. />
  1403. <Route
  1404. path="merged/"
  1405. component={make(
  1406. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1407. )}
  1408. props={{
  1409. currentTab: Tab.MERGED,
  1410. isEventRoute: true,
  1411. }}
  1412. />
  1413. <Route
  1414. path="grouping/"
  1415. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1416. props={{
  1417. currentTab: Tab.GROUPING,
  1418. isEventRoute: true,
  1419. }}
  1420. />
  1421. </Route>
  1422. </Route>
  1423. );
  1424. // These are the "manage" pages. For sentry.io, these are _different_ from
  1425. // the SaaS admin routes in getsentry.
  1426. const adminManageRoutes = (
  1427. <Route
  1428. path="/manage/"
  1429. component={make(() => import('sentry/views/admin/adminLayout'))}
  1430. >
  1431. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1432. <Route
  1433. path="buffer/"
  1434. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1435. />
  1436. <Route
  1437. path="relays/"
  1438. component={make(() => import('sentry/views/admin/adminRelays'))}
  1439. />
  1440. <Route
  1441. path="organizations/"
  1442. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1443. />
  1444. <Route
  1445. path="projects/"
  1446. component={make(() => import('sentry/views/admin/adminProjects'))}
  1447. />
  1448. <Route
  1449. path="queue/"
  1450. component={make(() => import('sentry/views/admin/adminQueue'))}
  1451. />
  1452. <Route
  1453. path="quotas/"
  1454. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1455. />
  1456. <Route
  1457. path="settings/"
  1458. component={make(() => import('sentry/views/admin/adminSettings'))}
  1459. />
  1460. <Route path="users/">
  1461. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1462. <Route
  1463. path=":id"
  1464. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1465. />
  1466. </Route>
  1467. <Route
  1468. path="status/mail/"
  1469. component={make(() => import('sentry/views/admin/adminMail'))}
  1470. />
  1471. <Route
  1472. path="status/environment/"
  1473. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1474. />
  1475. <Route
  1476. path="status/packages/"
  1477. component={make(() => import('sentry/views/admin/adminPackages'))}
  1478. />
  1479. <Route
  1480. path="status/warnings/"
  1481. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1482. />
  1483. {hook('routes:admin')}
  1484. </Route>
  1485. );
  1486. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1487. // me why we need the OrganizationRoot root container.
  1488. const legacyOrganizationRootRoutes = (
  1489. <Route component={errorHandler(OrganizationRoot)}>
  1490. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1491. <Route path="/organizations/:orgId/">
  1492. {hook('routes:organization')}
  1493. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1494. <Redirect
  1495. from="/organizations/:orgId/teams/your-teams/"
  1496. to="/settings/:orgId/teams/"
  1497. />
  1498. <Redirect
  1499. from="/organizations/:orgId/teams/all-teams/"
  1500. to="/settings/:orgId/teams/"
  1501. />
  1502. <Redirect
  1503. from="/organizations/:orgId/teams/:teamId/"
  1504. to="/settings/:orgId/teams/:teamId/"
  1505. />
  1506. <Redirect
  1507. from="/organizations/:orgId/teams/:teamId/members/"
  1508. to="/settings/:orgId/teams/:teamId/members/"
  1509. />
  1510. <Redirect
  1511. from="/organizations/:orgId/teams/:teamId/projects/"
  1512. to="/settings/:orgId/teams/:teamId/projects/"
  1513. />
  1514. <Redirect
  1515. from="/organizations/:orgId/teams/:teamId/settings/"
  1516. to="/settings/:orgId/teams/:teamId/settings/"
  1517. />
  1518. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1519. <Redirect
  1520. from="/organizations/:orgId/api-keys/"
  1521. to="/settings/:orgId/api-keys/"
  1522. />
  1523. <Redirect
  1524. from="/organizations/:orgId/api-keys/:apiKey/"
  1525. to="/settings/:orgId/api-keys/:apiKey/"
  1526. />
  1527. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1528. <Redirect
  1529. from="/organizations/:orgId/members/:memberId/"
  1530. to="/settings/:orgId/members/:memberId/"
  1531. />
  1532. <Redirect
  1533. from="/organizations/:orgId/rate-limits/"
  1534. to="/settings/:orgId/rate-limits/"
  1535. />
  1536. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1537. </Route>
  1538. </Route>
  1539. );
  1540. // XXX(epurkhiser): These also exist in the legacyOrganizationRootRoutes. Not
  1541. // sure which one here is more correct.
  1542. const legacyGettingStartedRoutes = (
  1543. <Route
  1544. path="/:orgId/:projectId/getting-started/"
  1545. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1546. >
  1547. <IndexRoute
  1548. component={make(() => import('sentry/views/projectInstall/overview'))}
  1549. />
  1550. <Route
  1551. path=":platform/"
  1552. component={make(
  1553. () => import('sentry/views/projectInstall/platformOrIntegration')
  1554. )}
  1555. />
  1556. </Route>
  1557. );
  1558. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1559. // canonical URLs.
  1560. //
  1561. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1562. // or do these need to be nested into the OrganizationDetails tree?
  1563. const legacyOrgRedirects = (
  1564. <Route path="/:orgId/:projectId/">
  1565. <IndexRoute
  1566. component={errorHandler(
  1567. redirectDeprecatedProjectRoute(
  1568. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1569. )
  1570. )}
  1571. />
  1572. <Route
  1573. path="issues/"
  1574. component={errorHandler(
  1575. redirectDeprecatedProjectRoute(
  1576. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1577. )
  1578. )}
  1579. />
  1580. <Route
  1581. path="dashboard/"
  1582. component={errorHandler(
  1583. redirectDeprecatedProjectRoute(
  1584. ({orgId, projectId}) =>
  1585. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1586. )
  1587. )}
  1588. />
  1589. <Route
  1590. path="user-feedback/"
  1591. component={errorHandler(
  1592. redirectDeprecatedProjectRoute(
  1593. ({orgId, projectId}) =>
  1594. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1595. )
  1596. )}
  1597. />
  1598. <Route
  1599. path="releases/"
  1600. component={errorHandler(
  1601. redirectDeprecatedProjectRoute(
  1602. ({orgId, projectId}) =>
  1603. `/organizations/${orgId}/releases/?project=${projectId}`
  1604. )
  1605. )}
  1606. />
  1607. <Route
  1608. path="releases/:version/"
  1609. component={errorHandler(
  1610. redirectDeprecatedProjectRoute(
  1611. ({orgId, projectId, router}) =>
  1612. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1613. )
  1614. )}
  1615. />
  1616. <Route
  1617. path="releases/:version/new-events/"
  1618. component={errorHandler(
  1619. redirectDeprecatedProjectRoute(
  1620. ({orgId, projectId, router}) =>
  1621. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1622. )
  1623. )}
  1624. />
  1625. <Route
  1626. path="releases/:version/all-events/"
  1627. component={errorHandler(
  1628. redirectDeprecatedProjectRoute(
  1629. ({orgId, projectId, router}) =>
  1630. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1631. )
  1632. )}
  1633. />
  1634. <Route
  1635. path="releases/:version/commits/"
  1636. component={errorHandler(
  1637. redirectDeprecatedProjectRoute(
  1638. ({orgId, projectId, router}) =>
  1639. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1640. )
  1641. )}
  1642. />
  1643. </Route>
  1644. );
  1645. const profilingRoutes = (
  1646. <Route
  1647. path="/organizations/:orgId/profiling/"
  1648. component={make(() => import('sentry/views/profiling'))}
  1649. >
  1650. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1651. <Route
  1652. path="onboarding/"
  1653. component={make(() => import('sentry/views/profiling/onboarding'))}
  1654. />
  1655. <Route
  1656. path="summary/:projectId/"
  1657. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1658. />
  1659. <Route
  1660. path="profile/:projectId/:eventId"
  1661. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1662. >
  1663. <Route
  1664. path="details/"
  1665. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1666. />
  1667. <Route
  1668. path="flamegraph/"
  1669. component={make(() => import('sentry/views/profiling/profileFlamegraph'))}
  1670. />
  1671. </Route>
  1672. </Route>
  1673. );
  1674. const organizationRoutes = (
  1675. <Route component={errorHandler(OrganizationDetails)}>
  1676. {settingsRoutes}
  1677. {projectsRoutes}
  1678. {dashboardRoutes}
  1679. {userFeedbackRoutes}
  1680. {issueListRoutes}
  1681. {issueDetailsRoutes}
  1682. {alertRoutes}
  1683. {monitorsRoutes}
  1684. {replayRoutes}
  1685. {releasesRoutes}
  1686. {activityRoutes}
  1687. {statsRoutes}
  1688. {discoverRoutes}
  1689. {performanceRoutes}
  1690. {profilingRoutes}
  1691. {adminManageRoutes}
  1692. {legacyOrganizationRootRoutes}
  1693. {legacyGettingStartedRoutes}
  1694. {legacyOrgRedirects}
  1695. </Route>
  1696. );
  1697. const legacyRedirectRoutes = (
  1698. <Route path="/:orgId/">
  1699. <IndexRedirect to="/organizations/:orgId/" />
  1700. <Route path=":projectId/settings/">
  1701. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  1702. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  1703. <Redirect
  1704. from="alerts/rules/"
  1705. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  1706. />
  1707. <Redirect
  1708. from="alerts/rules/new/"
  1709. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  1710. />
  1711. <Redirect
  1712. from="alerts/rules/:ruleId/"
  1713. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  1714. />
  1715. <Redirect
  1716. from="environments/"
  1717. to="/settings/:orgId/projects/:projectId/environments/"
  1718. />
  1719. <Redirect
  1720. from="environments/hidden/"
  1721. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  1722. />
  1723. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  1724. <Redirect
  1725. from="issue-tracking/"
  1726. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  1727. />
  1728. <Redirect
  1729. from="release-tracking/"
  1730. to="/settings/:orgId/projects/:projectId/release-tracking/"
  1731. />
  1732. <Redirect
  1733. from="ownership/"
  1734. to="/settings/:orgId/projects/:projectId/ownership/"
  1735. />
  1736. <Redirect
  1737. from="data-forwarding/"
  1738. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  1739. />
  1740. <Redirect
  1741. from="debug-symbols/"
  1742. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  1743. />
  1744. <Redirect
  1745. from="processing-issues/"
  1746. to="/settings/:orgId/projects/:projectId/processing-issues/"
  1747. />
  1748. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  1749. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  1750. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  1751. <Redirect
  1752. from="keys/:keyId/"
  1753. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  1754. />
  1755. <Redirect
  1756. from="user-feedback/"
  1757. to="/settings/:orgId/projects/:projectId/user-feedback/"
  1758. />
  1759. <Redirect
  1760. from="security-headers/"
  1761. to="/settings/:orgId/projects/:projectId/security-headers/"
  1762. />
  1763. <Redirect
  1764. from="security-headers/csp/"
  1765. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  1766. />
  1767. <Redirect
  1768. from="security-headers/expect-ct/"
  1769. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  1770. />
  1771. <Redirect
  1772. from="security-headers/hpkp/"
  1773. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  1774. />
  1775. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  1776. <Redirect
  1777. from="plugins/:pluginId/"
  1778. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  1779. />
  1780. <Redirect
  1781. from="integrations/:providerKey/"
  1782. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  1783. />
  1784. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  1785. <Redirect
  1786. from="install/:platform'"
  1787. to="/settings/:orgId/projects/:projectId/install/:platform/"
  1788. />
  1789. </Route>
  1790. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  1791. <Redirect
  1792. from=":projectId/issues/:groupId/"
  1793. to="/organizations/:orgId/issues/:groupId/"
  1794. />
  1795. <Redirect
  1796. from=":projectId/issues/:groupId/events/"
  1797. to="/organizations/:orgId/issues/:groupId/events/"
  1798. />
  1799. <Redirect
  1800. from=":projectId/issues/:groupId/events/:eventId/"
  1801. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  1802. />
  1803. <Redirect
  1804. from=":projectId/issues/:groupId/tags/"
  1805. to="/organizations/:orgId/issues/:groupId/tags/"
  1806. />
  1807. <Redirect
  1808. from=":projectId/issues/:groupId/tags/:tagKey/"
  1809. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  1810. />
  1811. <Redirect
  1812. from=":projectId/issues/:groupId/feedback/"
  1813. to="/organizations/:orgId/issues/:groupId/feedback/"
  1814. />
  1815. <Redirect
  1816. from=":projectId/issues/:groupId/similar/"
  1817. to="/organizations/:orgId/issues/:groupId/similar/"
  1818. />
  1819. <Redirect
  1820. from=":projectId/issues/:groupId/merged/"
  1821. to="/organizations/:orgId/issues/:groupId/merged/"
  1822. />
  1823. <Route
  1824. path=":projectId/events/:eventId/"
  1825. component={errorHandler(ProjectEventRedirect)}
  1826. />
  1827. </Route>
  1828. );
  1829. const appRoutes = (
  1830. <Route>
  1831. {experimentalSpaRoutes}
  1832. <Route path="/" component={errorHandler(App)}>
  1833. {rootRoutes}
  1834. {organizationRoutes}
  1835. {legacyRedirectRoutes}
  1836. {hook('routes')}
  1837. <Route path="*" component={errorHandler(RouteNotFound)} />
  1838. </Route>
  1839. </Route>
  1840. );
  1841. return appRoutes;
  1842. }
  1843. // We load routes both when initlaizing the SDK (for routing integrations) and
  1844. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  1845. export const routes = memoize(buildRoutes);