routes.tsx 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918
  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. import Feature from './components/acl/feature';
  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 path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  137. </Route>
  138. ) : null;
  139. const rootRoutes = (
  140. <Fragment>
  141. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  142. <Route
  143. path="/accept/:memberId/:token/"
  144. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  145. />
  146. <Route
  147. path="/accept-transfer/"
  148. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  149. />
  150. <Route
  151. path="/extensions/external-install/:integrationSlug/:installationId"
  152. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  153. />
  154. <Route
  155. path="/extensions/:integrationSlug/link/"
  156. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  157. />
  158. <Route
  159. path="/sentry-apps/:sentryAppSlug/external-install/"
  160. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  161. />
  162. <Redirect from="/account/" to="/settings/account/details/" />
  163. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  164. <Route
  165. path="/share/issue/:shareId/"
  166. component={make(() => import('sentry/views/sharedGroupDetails'))}
  167. />
  168. <Route
  169. path="/organizations/new/"
  170. component={make(() => import('sentry/views/organizationCreate'))}
  171. />
  172. <Route
  173. path="/organizations/:orgId/data-export/:dataExportId"
  174. component={make(() => import('sentry/views/dataExport/dataDownload'))}
  175. />
  176. <Route
  177. path="/organizations/:orgId/disabled-member/"
  178. component={make(() => import('sentry/views/disabledMember'))}
  179. />
  180. <Route
  181. path="/join-request/:orgId/"
  182. component={make(() => import('sentry/views/organizationJoinRequest'))}
  183. />
  184. <Route
  185. path="/onboarding/:orgId/"
  186. component={errorHandler(OrganizationContextContainer)}
  187. >
  188. <IndexRedirect to="welcome/" />
  189. <Route
  190. path=":step/"
  191. component={make(() => import('sentry/views/onboarding/onboarding'))}
  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 path="security-and-privacy/" name={t('Security & Privacy')}>
  401. <IndexRoute
  402. component={make(
  403. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  404. )}
  405. />
  406. <Route
  407. path="advanced-data-scrubbing/:scrubbingId/"
  408. component={make(
  409. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  410. )}
  411. />
  412. </Route>
  413. <Route
  414. path="debug-symbols/"
  415. name={t('Debug Information Files')}
  416. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  417. />
  418. <Route
  419. path="proguard/"
  420. name={t('ProGuard Mappings')}
  421. component={make(() => import('sentry/views/settings/projectProguard'))}
  422. />
  423. <Route
  424. path="performance/"
  425. name={t('Performance')}
  426. component={make(() => import('sentry/views/settings/projectPerformance'))}
  427. />
  428. <Route
  429. path="source-maps/"
  430. name={t('Source Maps')}
  431. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  432. >
  433. <IndexRoute
  434. component={make(() => import('sentry/views/settings/projectSourceMaps/list'))}
  435. />
  436. <Route
  437. path=":name/"
  438. name={t('Archive')}
  439. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  440. />
  441. </Route>
  442. <Route
  443. path="processing-issues/"
  444. name={t('Processing Issues')}
  445. component={make(
  446. () => import('sentry/views/settings/project/projectProcessingIssues')
  447. )}
  448. />
  449. <Route
  450. path="filters/"
  451. name={t('Inbound Filters')}
  452. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  453. >
  454. <IndexRedirect to="data-filters/" />
  455. <Route path=":filterType/" />
  456. </Route>
  457. <Route
  458. path="dynamic-sampling/"
  459. name={t('Dynamic Sampling')}
  460. component={make(
  461. () => import('sentry/views/settings/project/server-side-sampling')
  462. )}
  463. />
  464. <Redirect from="server-side-sampling/" to="dynamic-sampling/" />
  465. <Route
  466. path="issue-grouping/"
  467. name={t('Issue Grouping')}
  468. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  469. />
  470. <Route
  471. path="hooks/"
  472. name={t('Service Hooks')}
  473. component={make(
  474. () => import('sentry/views/settings/project/projectServiceHooks')
  475. )}
  476. />
  477. <Route
  478. path="hooks/new/"
  479. name={t('Create Service Hook')}
  480. component={make(
  481. () => import('sentry/views/settings/project/projectCreateServiceHook')
  482. )}
  483. />
  484. <Route
  485. path="hooks/:hookId/"
  486. name={t('Service Hook Details')}
  487. component={make(
  488. () => import('sentry/views/settings/project/projectServiceHookDetails')
  489. )}
  490. />
  491. <Route path="keys/" name={t('Client Keys')}>
  492. <IndexRoute
  493. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  494. />
  495. <Route
  496. path=":keyId/"
  497. name={t('Details')}
  498. component={make(
  499. () => import('sentry/views/settings/project/projectKeys/details')
  500. )}
  501. />
  502. </Route>
  503. <Route
  504. path="user-feedback/"
  505. name={t('User Feedback')}
  506. component={make(
  507. () => import('sentry/views/settings/project/projectUserFeedback')
  508. )}
  509. />
  510. <Redirect from="csp/" to="security-headers/" />
  511. <Route path="security-headers/" name={t('Security Headers')}>
  512. <IndexRoute
  513. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  514. />
  515. <Route
  516. path="csp/"
  517. name={t('Content Security Policy')}
  518. component={make(
  519. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  520. )}
  521. />
  522. <Route
  523. path="expect-ct/"
  524. name={t('Certificate Transparency')}
  525. component={make(
  526. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  527. )}
  528. />
  529. <Route
  530. path="hpkp/"
  531. name={t('HPKP')}
  532. component={make(
  533. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  534. )}
  535. />
  536. </Route>
  537. <Route path="plugins/" name={t('Legacy Integrations')}>
  538. <IndexRoute
  539. component={make(() => import('sentry/views/settings/projectPlugins'))}
  540. />
  541. <Route
  542. path=":pluginId/"
  543. name={t('Integration Details')}
  544. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  545. />
  546. </Route>
  547. <Route path="install/" name={t('Configuration')}>
  548. <IndexRoute
  549. component={make(() => import('sentry/views/projectInstall/overview'))}
  550. />
  551. <Route
  552. path=":platform/"
  553. name={t('Docs')}
  554. component={make(
  555. () => import('sentry/views/projectInstall/platformOrIntegration')
  556. )}
  557. />
  558. </Route>
  559. </Route>
  560. );
  561. const orgSettingsRoutes = (
  562. <Route
  563. component={make(
  564. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  565. )}
  566. >
  567. {hook('routes:organization')}
  568. <IndexRoute
  569. name={t('General')}
  570. component={make(
  571. () => import('sentry/views/settings/organizationGeneralSettings')
  572. )}
  573. />
  574. <Route
  575. path="projects/"
  576. name={t('Projects')}
  577. component={make(() => import('sentry/views/settings/organizationProjects'))}
  578. />
  579. <Route path="api-keys/" name={t('API Key')}>
  580. <IndexRoute
  581. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  582. />
  583. <Route
  584. path=":apiKey/"
  585. name={t('Details')}
  586. component={make(
  587. () =>
  588. import(
  589. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  590. )
  591. )}
  592. />
  593. </Route>
  594. <Route
  595. path="audit-log/"
  596. name={t('Audit Log')}
  597. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  598. />
  599. <Route
  600. path="auth/"
  601. name={t('Auth Providers')}
  602. component={make(() => import('sentry/views/settings/organizationAuth'))}
  603. />
  604. <Redirect from="members/requests" to="members/" />
  605. <Route path="members/" name={t('Members')}>
  606. <Route
  607. component={make(
  608. () =>
  609. import(
  610. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  611. )
  612. )}
  613. >
  614. <IndexRoute
  615. component={make(
  616. () =>
  617. import(
  618. 'sentry/views/settings/organizationMembers/organizationMembersList'
  619. )
  620. )}
  621. />
  622. </Route>
  623. <Route
  624. path=":memberId/"
  625. name={t('Details')}
  626. component={make(
  627. () =>
  628. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  629. )}
  630. />
  631. </Route>
  632. <Route
  633. path="rate-limits/"
  634. name={t('Rate Limits')}
  635. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  636. />
  637. <Route
  638. path="relay/"
  639. name={t('Relay')}
  640. component={make(() => import('sentry/views/settings/organizationRelay'))}
  641. />
  642. <Route
  643. path="repos/"
  644. name={t('Repositories')}
  645. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  646. />
  647. <Route
  648. path="settings/"
  649. component={make(
  650. () => import('sentry/views/settings/organizationGeneralSettings')
  651. )}
  652. />
  653. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  654. <IndexRoute
  655. component={make(
  656. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  657. )}
  658. />
  659. <Route
  660. path="advanced-data-scrubbing/:scrubbingId/"
  661. component={make(
  662. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  663. )}
  664. />
  665. </Route>
  666. <Route name={t('Teams')} path="teams/">
  667. <IndexRoute
  668. component={make(() => import('sentry/views/settings/organizationTeams'))}
  669. />
  670. <Route
  671. path=":teamId/"
  672. name={t('Team')}
  673. component={make(
  674. () => import('sentry/views/settings/organizationTeams/teamDetails')
  675. )}
  676. >
  677. <IndexRedirect to="members/" />
  678. <Route
  679. path="members/"
  680. name={t('Members')}
  681. component={make(
  682. () => import('sentry/views/settings/organizationTeams/teamMembers')
  683. )}
  684. />
  685. <Route
  686. path="notifications/"
  687. name={t('Notifications')}
  688. component={make(
  689. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  690. )}
  691. />
  692. <Route
  693. path="projects/"
  694. name={t('Projects')}
  695. component={make(
  696. () => import('sentry/views/settings/organizationTeams/teamProjects')
  697. )}
  698. />
  699. <Route
  700. path="settings/"
  701. name={t('Settings')}
  702. component={make(
  703. () => import('sentry/views/settings/organizationTeams/teamSettings')
  704. )}
  705. />
  706. </Route>
  707. </Route>
  708. <Redirect from="plugins/" to="integrations/" />
  709. <Route name={t('Integrations')} path="plugins/">
  710. <Route
  711. path=":integrationSlug/"
  712. name={t('Integration Details')}
  713. component={make(
  714. () => import('sentry/views/organizationIntegrations/pluginDetailedView')
  715. )}
  716. />
  717. </Route>
  718. <Redirect from="sentry-apps/" to="integrations/" />
  719. <Route name={t('Integrations')} path="sentry-apps/">
  720. <Route
  721. path=":integrationSlug"
  722. name={t('Details')}
  723. component={make(
  724. () => import('sentry/views/organizationIntegrations/sentryAppDetailedView')
  725. )}
  726. />
  727. </Route>
  728. <Redirect from="document-integrations/" to="integrations/" />
  729. <Route name={t('Integrations')} path="document-integrations/">
  730. <Route
  731. path=":integrationSlug"
  732. name={t('Details')}
  733. component={make(
  734. () =>
  735. import('sentry/views/organizationIntegrations/docIntegrationDetailedView')
  736. )}
  737. />
  738. </Route>
  739. <Route name={t('Integrations')} path="integrations/">
  740. <IndexRoute
  741. component={make(
  742. () => import('sentry/views/organizationIntegrations/integrationListDirectory')
  743. )}
  744. />
  745. <Route
  746. path=":integrationSlug"
  747. name={t('Integration Details')}
  748. component={make(
  749. () => import('sentry/views/organizationIntegrations/integrationDetailedView')
  750. )}
  751. />
  752. <Route
  753. path=":providerKey/:integrationId/"
  754. name={t('Configure Integration')}
  755. component={make(
  756. () =>
  757. import(
  758. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  759. )
  760. )}
  761. />
  762. </Route>
  763. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  764. <Route name={t('Developer Settings')} path="developer-settings/">
  765. <IndexRoute
  766. component={make(
  767. () => import('sentry/views/settings/organizationDeveloperSettings')
  768. )}
  769. />
  770. <Route
  771. path="new-public/"
  772. name={t('Create Integration')}
  773. component={make(
  774. () =>
  775. import(
  776. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  777. )
  778. )}
  779. />
  780. <Route
  781. path="new-internal/"
  782. name={t('Create Integration')}
  783. component={make(
  784. () =>
  785. import(
  786. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  787. )
  788. )}
  789. />
  790. <Route
  791. path=":appSlug/"
  792. name={t('Edit Integration')}
  793. component={make(
  794. () =>
  795. import(
  796. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  797. )
  798. )}
  799. />
  800. <Route
  801. path=":appSlug/dashboard/"
  802. name={t('Integration Dashboard')}
  803. component={make(
  804. () =>
  805. import(
  806. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  807. )
  808. )}
  809. />
  810. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  811. <Route
  812. path="new/"
  813. name={t('Create Sentry Function')}
  814. component={make(
  815. () =>
  816. import(
  817. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  818. )
  819. )}
  820. />
  821. <Route
  822. path=":functionSlug/"
  823. name={t('Edit Sentry Function')}
  824. component={make(
  825. () =>
  826. import(
  827. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  828. )
  829. )}
  830. />
  831. </Route>
  832. </Route>
  833. </Route>
  834. );
  835. const legacySettingsRedirects = (
  836. <Fragment>
  837. <Redirect from=":projectId/" to="projects/:projectId/" />
  838. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  839. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  840. <Redirect
  841. from=":projectId/alerts/rules/:ruleId/"
  842. to="projects/:projectId/alerts/rules/:ruleId/"
  843. />
  844. </Fragment>
  845. );
  846. const settingsRoutes = (
  847. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  848. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  849. {accountSettingsRoutes}
  850. <Route name={t('Organization')} path=":orgId/">
  851. {orgSettingsRoutes}
  852. {projectSettingsRoutes}
  853. {legacySettingsRedirects}
  854. </Route>
  855. </Route>
  856. );
  857. const projectsRoutes = (
  858. <Route path="/organizations/:orgId/projects/">
  859. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  860. <Route
  861. path="new/"
  862. component={make(() => import('sentry/views/projectInstall/newProject'))}
  863. />
  864. <Route
  865. path=":projectId/getting-started/"
  866. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  867. >
  868. <IndexRoute
  869. component={make(() => import('sentry/views/projectInstall/overview'))}
  870. />
  871. <Route
  872. path=":platform/"
  873. component={make(
  874. () => import('sentry/views/projectInstall/platformOrIntegration')
  875. )}
  876. />
  877. </Route>
  878. <Route
  879. path=":projectId/"
  880. component={make(() => import('sentry/views/projectDetail'))}
  881. />
  882. <Route
  883. path=":projectId/events/:eventId/"
  884. component={errorHandler(ProjectEventRedirect)}
  885. />
  886. </Route>
  887. );
  888. const dashboardRoutes = (
  889. <Fragment>
  890. <Route
  891. path="/organizations/:orgId/dashboards/"
  892. component={make(() => import('sentry/views/dashboardsV2'))}
  893. >
  894. <IndexRoute component={make(() => import('sentry/views/dashboardsV2/manage'))} />
  895. </Route>
  896. <Route
  897. path="/organizations/:orgId/dashboards/new/"
  898. component={make(() => import('sentry/views/dashboardsV2/create'))}
  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. <Route
  910. path="/organizations/:orgId/dashboards/new/:templateId"
  911. component={make(() => import('sentry/views/dashboardsV2/create'))}
  912. >
  913. <Route
  914. path="widget/:widgetId/"
  915. component={make(() => import('sentry/views/dashboardsV2/create'))}
  916. />
  917. </Route>
  918. <Redirect
  919. from="/organizations/:orgId/dashboards/:dashboardId/"
  920. to="/organizations/:orgId/dashboard/:dashboardId/"
  921. />
  922. <Route
  923. path="/organizations/:orgId/dashboard/:dashboardId/"
  924. component={make(() => import('sentry/views/dashboardsV2/view'))}
  925. >
  926. <Route
  927. path="widget/:widgetIndex/edit/"
  928. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  929. />
  930. <Route
  931. path="widget/new/"
  932. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  933. />
  934. <Route
  935. path="widget/:widgetId/"
  936. component={make(() => import('sentry/views/dashboardsV2/view'))}
  937. />
  938. </Route>
  939. </Fragment>
  940. );
  941. const alertRoutes = (
  942. <Route
  943. path="/organizations/:orgId/alerts/"
  944. component={make(() => import('sentry/views/alerts'))}
  945. >
  946. <IndexRoute component={make(() => import('sentry/views/alerts/list/incidents'))} />
  947. <Route path="rules/">
  948. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  949. <Route
  950. path="details/:ruleId/"
  951. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  952. />
  953. <Route
  954. path=":projectId/"
  955. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  956. >
  957. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  958. <Route
  959. path=":ruleId/"
  960. component={make(() => import('sentry/views/alerts/edit'))}
  961. />
  962. </Route>
  963. <Route
  964. path=":projectId/:ruleId/details/"
  965. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  966. >
  967. <IndexRoute
  968. component={make(
  969. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  970. )}
  971. />
  972. </Route>
  973. </Route>
  974. <Route path="metric-rules/">
  975. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  976. <Route
  977. path=":projectId/"
  978. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  979. >
  980. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  981. <Route
  982. path=":ruleId/"
  983. component={make(() => import('sentry/views/alerts/edit'))}
  984. />
  985. </Route>
  986. </Route>
  987. <Route
  988. path="wizard/"
  989. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  990. >
  991. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  992. </Route>
  993. <Route
  994. path="new/"
  995. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  996. >
  997. <IndexRedirect to="/organizations/:orgId/alerts/wizard/" />
  998. <Route
  999. path=":alertType/"
  1000. component={make(() => import('sentry/views/alerts/create'))}
  1001. />
  1002. </Route>
  1003. <Route
  1004. path=":alertId/"
  1005. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1006. />
  1007. <Route
  1008. path=":projectId/"
  1009. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1010. >
  1011. <Route path="new/" component={make(() => import('sentry/views/alerts/create'))} />
  1012. <Route
  1013. path="wizard/"
  1014. component={make(() => import('sentry/views/alerts/wizard'))}
  1015. />
  1016. </Route>
  1017. </Route>
  1018. );
  1019. const monitorsRoutes = (
  1020. <Route
  1021. path="/organizations/:orgId/monitors/"
  1022. component={make(() => import('sentry/views/monitors'))}
  1023. >
  1024. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1025. <Route
  1026. path="/organizations/:orgId/monitors/create/"
  1027. component={make(() => import('sentry/views/monitors/create'))}
  1028. />
  1029. <Route
  1030. path="/organizations/:orgId/monitors/:monitorId/"
  1031. component={make(() => import('sentry/views/monitors/details'))}
  1032. />
  1033. <Route
  1034. path="/organizations/:orgId/monitors/:monitorId/edit/"
  1035. component={make(() => import('sentry/views/monitors/edit'))}
  1036. />
  1037. </Route>
  1038. );
  1039. const replayRoutes = (
  1040. <Route
  1041. path="/organizations/:orgId/replays/"
  1042. component={make(() => import('sentry/views/replays'))}
  1043. >
  1044. <IndexRoute component={make(() => import('sentry/views/replays/replays'))} />
  1045. <Route
  1046. path=":replaySlug/"
  1047. component={make(() => import('sentry/views/replays/details'))}
  1048. />
  1049. </Route>
  1050. );
  1051. const releasesRoutes = (
  1052. <Route path="/organizations/:orgId/releases/">
  1053. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1054. <Route
  1055. path=":release/"
  1056. component={make(() => import('sentry/views/releases/detail'))}
  1057. >
  1058. <IndexRoute
  1059. component={make(() => import('sentry/views/releases/detail/overview'))}
  1060. />
  1061. <Route
  1062. path="commits/"
  1063. component={make(
  1064. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1065. )}
  1066. />
  1067. <Route
  1068. path="files-changed/"
  1069. component={make(
  1070. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1071. )}
  1072. />
  1073. <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />
  1074. <Redirect from="all-events/" to="/organizations/:orgId/releases/:release/" />
  1075. </Route>
  1076. </Route>
  1077. );
  1078. const activityRoutes = (
  1079. <Route
  1080. path="/organizations/:orgId/activity/"
  1081. component={make(() => import('sentry/views/organizationActivity'))}
  1082. />
  1083. );
  1084. const statsRoutes = (
  1085. <Route path="/organizations/:orgId/stats/">
  1086. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1087. <Route
  1088. path="issues/"
  1089. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1090. >
  1091. <IndexRoute
  1092. component={make(
  1093. () => import('sentry/views/organizationStats/teamInsights/issues')
  1094. )}
  1095. />
  1096. </Route>
  1097. <Route
  1098. path="health/"
  1099. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1100. >
  1101. <IndexRoute
  1102. component={make(
  1103. () => import('sentry/views/organizationStats/teamInsights/health')
  1104. )}
  1105. />
  1106. </Route>
  1107. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1108. </Route>
  1109. );
  1110. // TODO(mark) Long term this /queries route should go away and /discover
  1111. // should be the canonical route for discover2. We have a redirect right now
  1112. // as /discover was for discover 1 and most of the application is linking to
  1113. // /discover/queries and not /discover
  1114. const discoverRoutes = (
  1115. <Route
  1116. path="/organizations/:orgId/discover/"
  1117. component={make(() => import('sentry/views/eventsV2'))}
  1118. >
  1119. <Feature features={['discover-query-builder-as-landing-page']}>
  1120. <IndexRedirect to="results/" />
  1121. </Feature>
  1122. <IndexRedirect to="queries/" />
  1123. <Route
  1124. path="queries/"
  1125. component={make(() => import('sentry/views/eventsV2/landing'))}
  1126. />
  1127. <Route
  1128. path="results/"
  1129. component={make(() => import('sentry/views/eventsV2/results'))}
  1130. />
  1131. <Route
  1132. path=":eventSlug/"
  1133. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1134. />
  1135. </Route>
  1136. );
  1137. const performanceRoutes = (
  1138. <Route
  1139. path="/organizations/:orgId/performance/"
  1140. component={make(() => import('sentry/views/performance'))}
  1141. >
  1142. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1143. <Route
  1144. path="trends/"
  1145. component={make(() => import('sentry/views/performance/trends'))}
  1146. />
  1147. <Route path="/organizations/:orgId/performance/summary/">
  1148. <IndexRoute
  1149. component={make(
  1150. () =>
  1151. import('sentry/views/performance/transactionSummary/transactionOverview')
  1152. )}
  1153. />
  1154. <Route
  1155. path="replays/"
  1156. component={make(
  1157. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1158. )}
  1159. />
  1160. <Route
  1161. path="vitals/"
  1162. component={make(
  1163. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1164. )}
  1165. />
  1166. <Route
  1167. path="tags/"
  1168. component={make(
  1169. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1170. )}
  1171. />
  1172. <Route
  1173. path="events/"
  1174. component={make(
  1175. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1176. )}
  1177. />
  1178. <Route
  1179. path="anomalies/"
  1180. component={make(
  1181. () =>
  1182. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1183. )}
  1184. />
  1185. <Route path="spans/">
  1186. <IndexRoute
  1187. component={make(
  1188. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1189. )}
  1190. />
  1191. <Route
  1192. path=":spanSlug/"
  1193. component={make(
  1194. () =>
  1195. import(
  1196. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1197. )
  1198. )}
  1199. />
  1200. </Route>
  1201. </Route>
  1202. <Route
  1203. path="vitaldetail/"
  1204. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1205. />
  1206. <Route
  1207. path="trace/:traceSlug/"
  1208. component={make(() => import('sentry/views/performance/traceDetails'))}
  1209. />
  1210. <Route
  1211. path=":eventSlug/"
  1212. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1213. />
  1214. </Route>
  1215. );
  1216. const userFeedbackRoutes = (
  1217. <Route
  1218. path="/organizations/:orgId/user-feedback/"
  1219. component={make(() => import('sentry/views/userFeedback'))}
  1220. />
  1221. );
  1222. const issueListRoutes = (
  1223. <Route
  1224. path="/organizations/:orgId/issues/"
  1225. component={errorHandler(IssueListContainer)}
  1226. >
  1227. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1228. <IndexRoute component={errorHandler(IssueListOverview)} />
  1229. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1230. </Route>
  1231. );
  1232. // Once org issues is complete, these routes can be nested under
  1233. // /organizations/:orgId/issues
  1234. const issueDetailsRoutes = (
  1235. <Route
  1236. path="/organizations/:orgId/issues/:groupId/"
  1237. component={make(() => import('sentry/views/organizationGroupDetails'))}
  1238. >
  1239. <IndexRoute
  1240. component={make(
  1241. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1242. )}
  1243. props={{
  1244. currentTab: Tab.DETAILS,
  1245. isEventRoute: false,
  1246. }}
  1247. />
  1248. <Route
  1249. path="replays/"
  1250. component={make(
  1251. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1252. )}
  1253. props={{
  1254. currentTab: Tab.REPLAYS,
  1255. isEventRoute: false,
  1256. }}
  1257. />
  1258. <Route
  1259. path="activity/"
  1260. component={make(
  1261. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1262. )}
  1263. props={{
  1264. currentTab: Tab.ACTIVITY,
  1265. isEventRoute: false,
  1266. }}
  1267. />
  1268. <Route
  1269. path="events/"
  1270. component={make(
  1271. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1272. )}
  1273. props={{
  1274. currentTab: Tab.EVENTS,
  1275. isEventRoute: false,
  1276. }}
  1277. />
  1278. <Route
  1279. path="tags/"
  1280. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1281. props={{
  1282. currentTab: Tab.TAGS,
  1283. isEventRoute: false,
  1284. }}
  1285. />
  1286. <Route
  1287. path="tags/:tagKey/"
  1288. component={make(
  1289. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1290. )}
  1291. props={{
  1292. currentTab: Tab.TAGS,
  1293. isEventRoute: false,
  1294. }}
  1295. />
  1296. <Route
  1297. path="feedback/"
  1298. component={make(
  1299. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1300. )}
  1301. props={{
  1302. currentTab: Tab.USER_FEEDBACK,
  1303. isEventRoute: false,
  1304. }}
  1305. />
  1306. <Route
  1307. path="attachments/"
  1308. component={make(
  1309. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1310. )}
  1311. props={{
  1312. currentTab: Tab.ATTACHMENTS,
  1313. isEventRoute: false,
  1314. }}
  1315. />
  1316. <Route
  1317. path="similar/"
  1318. component={make(
  1319. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1320. )}
  1321. props={{
  1322. currentTab: Tab.SIMILAR_ISSUES,
  1323. isEventRoute: false,
  1324. }}
  1325. />
  1326. <Route
  1327. path="merged/"
  1328. component={make(
  1329. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1330. )}
  1331. props={{
  1332. currentTab: Tab.MERGED,
  1333. isEventRoute: false,
  1334. }}
  1335. />
  1336. <Route
  1337. path="grouping/"
  1338. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1339. props={{
  1340. currentTab: Tab.GROUPING,
  1341. isEventRoute: false,
  1342. }}
  1343. />
  1344. <Route path="events/:eventId/">
  1345. <IndexRoute
  1346. component={make(
  1347. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1348. )}
  1349. props={{
  1350. currentTab: Tab.DETAILS,
  1351. isEventRoute: true,
  1352. }}
  1353. />
  1354. <Route
  1355. path="replays/"
  1356. component={make(
  1357. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1358. )}
  1359. props={{
  1360. currentTab: Tab.REPLAYS,
  1361. isEventRoute: true,
  1362. }}
  1363. />
  1364. <Route
  1365. path="activity/"
  1366. component={make(
  1367. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1368. )}
  1369. props={{
  1370. currentTab: Tab.ACTIVITY,
  1371. isEventRoute: true,
  1372. }}
  1373. />
  1374. <Route
  1375. path="events/"
  1376. component={make(
  1377. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1378. )}
  1379. props={{
  1380. currentTab: Tab.EVENTS,
  1381. isEventRoute: true,
  1382. }}
  1383. />
  1384. <Route
  1385. path="similar/"
  1386. component={make(
  1387. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1388. )}
  1389. props={{
  1390. currentTab: Tab.SIMILAR_ISSUES,
  1391. isEventRoute: true,
  1392. }}
  1393. />
  1394. <Route
  1395. path="tags/"
  1396. component={make(
  1397. () => import('sentry/views/organizationGroupDetails/groupTags')
  1398. )}
  1399. props={{
  1400. currentTab: Tab.TAGS,
  1401. isEventRoute: true,
  1402. }}
  1403. />
  1404. <Route
  1405. path="tags/:tagKey/"
  1406. component={make(
  1407. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1408. )}
  1409. props={{
  1410. currentTab: Tab.TAGS,
  1411. isEventRoute: true,
  1412. }}
  1413. />
  1414. <Route
  1415. path="feedback/"
  1416. component={make(
  1417. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1418. )}
  1419. props={{
  1420. currentTab: Tab.USER_FEEDBACK,
  1421. isEventRoute: true,
  1422. }}
  1423. />
  1424. <Route
  1425. path="attachments/"
  1426. component={make(
  1427. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1428. )}
  1429. props={{
  1430. currentTab: Tab.ATTACHMENTS,
  1431. isEventRoute: true,
  1432. }}
  1433. />
  1434. <Route
  1435. path="merged/"
  1436. component={make(
  1437. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1438. )}
  1439. props={{
  1440. currentTab: Tab.MERGED,
  1441. isEventRoute: true,
  1442. }}
  1443. />
  1444. <Route
  1445. path="grouping/"
  1446. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1447. props={{
  1448. currentTab: Tab.GROUPING,
  1449. isEventRoute: true,
  1450. }}
  1451. />
  1452. </Route>
  1453. </Route>
  1454. );
  1455. // These are the "manage" pages. For sentry.io, these are _different_ from
  1456. // the SaaS admin routes in getsentry.
  1457. const adminManageRoutes = (
  1458. <Route
  1459. path="/manage/"
  1460. component={make(() => import('sentry/views/admin/adminLayout'))}
  1461. >
  1462. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1463. <Route
  1464. path="buffer/"
  1465. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1466. />
  1467. <Route
  1468. path="relays/"
  1469. component={make(() => import('sentry/views/admin/adminRelays'))}
  1470. />
  1471. <Route
  1472. path="organizations/"
  1473. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1474. />
  1475. <Route
  1476. path="projects/"
  1477. component={make(() => import('sentry/views/admin/adminProjects'))}
  1478. />
  1479. <Route
  1480. path="queue/"
  1481. component={make(() => import('sentry/views/admin/adminQueue'))}
  1482. />
  1483. <Route
  1484. path="quotas/"
  1485. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1486. />
  1487. <Route
  1488. path="settings/"
  1489. component={make(() => import('sentry/views/admin/adminSettings'))}
  1490. />
  1491. <Route path="users/">
  1492. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1493. <Route
  1494. path=":id"
  1495. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1496. />
  1497. </Route>
  1498. <Route
  1499. path="status/mail/"
  1500. component={make(() => import('sentry/views/admin/adminMail'))}
  1501. />
  1502. <Route
  1503. path="status/environment/"
  1504. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1505. />
  1506. <Route
  1507. path="status/packages/"
  1508. component={make(() => import('sentry/views/admin/adminPackages'))}
  1509. />
  1510. <Route
  1511. path="status/warnings/"
  1512. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1513. />
  1514. {hook('routes:admin')}
  1515. </Route>
  1516. );
  1517. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1518. // me why we need the OrganizationRoot root container.
  1519. const legacyOrganizationRootRoutes = (
  1520. <Route component={errorHandler(OrganizationRoot)}>
  1521. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1522. <Route path="/organizations/:orgId/">
  1523. {hook('routes:organization')}
  1524. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1525. <Redirect
  1526. from="/organizations/:orgId/teams/your-teams/"
  1527. to="/settings/:orgId/teams/"
  1528. />
  1529. <Redirect
  1530. from="/organizations/:orgId/teams/all-teams/"
  1531. to="/settings/:orgId/teams/"
  1532. />
  1533. <Redirect
  1534. from="/organizations/:orgId/teams/:teamId/"
  1535. to="/settings/:orgId/teams/:teamId/"
  1536. />
  1537. <Redirect
  1538. from="/organizations/:orgId/teams/:teamId/members/"
  1539. to="/settings/:orgId/teams/:teamId/members/"
  1540. />
  1541. <Redirect
  1542. from="/organizations/:orgId/teams/:teamId/projects/"
  1543. to="/settings/:orgId/teams/:teamId/projects/"
  1544. />
  1545. <Redirect
  1546. from="/organizations/:orgId/teams/:teamId/settings/"
  1547. to="/settings/:orgId/teams/:teamId/settings/"
  1548. />
  1549. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1550. <Redirect
  1551. from="/organizations/:orgId/api-keys/"
  1552. to="/settings/:orgId/api-keys/"
  1553. />
  1554. <Redirect
  1555. from="/organizations/:orgId/api-keys/:apiKey/"
  1556. to="/settings/:orgId/api-keys/:apiKey/"
  1557. />
  1558. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1559. <Redirect
  1560. from="/organizations/:orgId/members/:memberId/"
  1561. to="/settings/:orgId/members/:memberId/"
  1562. />
  1563. <Redirect
  1564. from="/organizations/:orgId/rate-limits/"
  1565. to="/settings/:orgId/rate-limits/"
  1566. />
  1567. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1568. </Route>
  1569. </Route>
  1570. );
  1571. // XXX(epurkhiser): These also exist in the legacyOrganizationRootRoutes. Not
  1572. // sure which one here is more correct.
  1573. const legacyGettingStartedRoutes = (
  1574. <Route
  1575. path="/:orgId/:projectId/getting-started/"
  1576. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1577. >
  1578. <IndexRoute
  1579. component={make(() => import('sentry/views/projectInstall/overview'))}
  1580. />
  1581. <Route
  1582. path=":platform/"
  1583. component={make(
  1584. () => import('sentry/views/projectInstall/platformOrIntegration')
  1585. )}
  1586. />
  1587. </Route>
  1588. );
  1589. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1590. // canonical URLs.
  1591. //
  1592. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1593. // or do these need to be nested into the OrganizationDetails tree?
  1594. const legacyOrgRedirects = (
  1595. <Route path="/:orgId/:projectId/">
  1596. <IndexRoute
  1597. component={errorHandler(
  1598. redirectDeprecatedProjectRoute(
  1599. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1600. )
  1601. )}
  1602. />
  1603. <Route
  1604. path="issues/"
  1605. component={errorHandler(
  1606. redirectDeprecatedProjectRoute(
  1607. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1608. )
  1609. )}
  1610. />
  1611. <Route
  1612. path="dashboard/"
  1613. component={errorHandler(
  1614. redirectDeprecatedProjectRoute(
  1615. ({orgId, projectId}) =>
  1616. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1617. )
  1618. )}
  1619. />
  1620. <Route
  1621. path="user-feedback/"
  1622. component={errorHandler(
  1623. redirectDeprecatedProjectRoute(
  1624. ({orgId, projectId}) =>
  1625. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1626. )
  1627. )}
  1628. />
  1629. <Route
  1630. path="releases/"
  1631. component={errorHandler(
  1632. redirectDeprecatedProjectRoute(
  1633. ({orgId, projectId}) =>
  1634. `/organizations/${orgId}/releases/?project=${projectId}`
  1635. )
  1636. )}
  1637. />
  1638. <Route
  1639. path="releases/:version/"
  1640. component={errorHandler(
  1641. redirectDeprecatedProjectRoute(
  1642. ({orgId, projectId, router}) =>
  1643. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1644. )
  1645. )}
  1646. />
  1647. <Route
  1648. path="releases/:version/new-events/"
  1649. component={errorHandler(
  1650. redirectDeprecatedProjectRoute(
  1651. ({orgId, projectId, router}) =>
  1652. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1653. )
  1654. )}
  1655. />
  1656. <Route
  1657. path="releases/:version/all-events/"
  1658. component={errorHandler(
  1659. redirectDeprecatedProjectRoute(
  1660. ({orgId, projectId, router}) =>
  1661. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1662. )
  1663. )}
  1664. />
  1665. <Route
  1666. path="releases/:version/commits/"
  1667. component={errorHandler(
  1668. redirectDeprecatedProjectRoute(
  1669. ({orgId, projectId, router}) =>
  1670. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1671. )
  1672. )}
  1673. />
  1674. </Route>
  1675. );
  1676. const profilingRoutes = (
  1677. <Route
  1678. path="/organizations/:orgId/profiling/"
  1679. component={make(() => import('sentry/views/profiling'))}
  1680. >
  1681. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1682. <Route
  1683. path="summary/:projectId/"
  1684. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1685. />
  1686. <Route
  1687. path="profile/:projectId/:eventId"
  1688. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1689. >
  1690. <Route
  1691. path="details/"
  1692. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1693. />
  1694. <Route
  1695. path="flamechart/"
  1696. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1697. />
  1698. </Route>
  1699. </Route>
  1700. );
  1701. const organizationRoutes = (
  1702. <Route component={errorHandler(OrganizationDetails)}>
  1703. {settingsRoutes}
  1704. {projectsRoutes}
  1705. {dashboardRoutes}
  1706. {userFeedbackRoutes}
  1707. {issueListRoutes}
  1708. {issueDetailsRoutes}
  1709. {alertRoutes}
  1710. {monitorsRoutes}
  1711. {replayRoutes}
  1712. {releasesRoutes}
  1713. {activityRoutes}
  1714. {statsRoutes}
  1715. {discoverRoutes}
  1716. {performanceRoutes}
  1717. {profilingRoutes}
  1718. {adminManageRoutes}
  1719. {legacyOrganizationRootRoutes}
  1720. {legacyGettingStartedRoutes}
  1721. {legacyOrgRedirects}
  1722. </Route>
  1723. );
  1724. const legacyRedirectRoutes = (
  1725. <Route path="/:orgId/">
  1726. <IndexRedirect to="/organizations/:orgId/" />
  1727. <Route path=":projectId/settings/">
  1728. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  1729. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  1730. <Redirect
  1731. from="alerts/rules/"
  1732. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  1733. />
  1734. <Redirect
  1735. from="alerts/rules/new/"
  1736. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  1737. />
  1738. <Redirect
  1739. from="alerts/rules/:ruleId/"
  1740. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  1741. />
  1742. <Redirect
  1743. from="environments/"
  1744. to="/settings/:orgId/projects/:projectId/environments/"
  1745. />
  1746. <Redirect
  1747. from="environments/hidden/"
  1748. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  1749. />
  1750. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  1751. <Redirect
  1752. from="issue-tracking/"
  1753. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  1754. />
  1755. <Redirect
  1756. from="release-tracking/"
  1757. to="/settings/:orgId/projects/:projectId/release-tracking/"
  1758. />
  1759. <Redirect
  1760. from="ownership/"
  1761. to="/settings/:orgId/projects/:projectId/ownership/"
  1762. />
  1763. <Redirect
  1764. from="data-forwarding/"
  1765. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  1766. />
  1767. <Redirect
  1768. from="debug-symbols/"
  1769. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  1770. />
  1771. <Redirect
  1772. from="processing-issues/"
  1773. to="/settings/:orgId/projects/:projectId/processing-issues/"
  1774. />
  1775. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  1776. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  1777. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  1778. <Redirect
  1779. from="keys/:keyId/"
  1780. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  1781. />
  1782. <Redirect
  1783. from="user-feedback/"
  1784. to="/settings/:orgId/projects/:projectId/user-feedback/"
  1785. />
  1786. <Redirect
  1787. from="security-headers/"
  1788. to="/settings/:orgId/projects/:projectId/security-headers/"
  1789. />
  1790. <Redirect
  1791. from="security-headers/csp/"
  1792. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  1793. />
  1794. <Redirect
  1795. from="security-headers/expect-ct/"
  1796. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  1797. />
  1798. <Redirect
  1799. from="security-headers/hpkp/"
  1800. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  1801. />
  1802. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  1803. <Redirect
  1804. from="plugins/:pluginId/"
  1805. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  1806. />
  1807. <Redirect
  1808. from="integrations/:providerKey/"
  1809. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  1810. />
  1811. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  1812. <Redirect
  1813. from="install/:platform'"
  1814. to="/settings/:orgId/projects/:projectId/install/:platform/"
  1815. />
  1816. </Route>
  1817. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  1818. <Redirect
  1819. from=":projectId/issues/:groupId/"
  1820. to="/organizations/:orgId/issues/:groupId/"
  1821. />
  1822. <Redirect
  1823. from=":projectId/issues/:groupId/events/"
  1824. to="/organizations/:orgId/issues/:groupId/events/"
  1825. />
  1826. <Redirect
  1827. from=":projectId/issues/:groupId/events/:eventId/"
  1828. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  1829. />
  1830. <Redirect
  1831. from=":projectId/issues/:groupId/tags/"
  1832. to="/organizations/:orgId/issues/:groupId/tags/"
  1833. />
  1834. <Redirect
  1835. from=":projectId/issues/:groupId/tags/:tagKey/"
  1836. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  1837. />
  1838. <Redirect
  1839. from=":projectId/issues/:groupId/feedback/"
  1840. to="/organizations/:orgId/issues/:groupId/feedback/"
  1841. />
  1842. <Redirect
  1843. from=":projectId/issues/:groupId/similar/"
  1844. to="/organizations/:orgId/issues/:groupId/similar/"
  1845. />
  1846. <Redirect
  1847. from=":projectId/issues/:groupId/merged/"
  1848. to="/organizations/:orgId/issues/:groupId/merged/"
  1849. />
  1850. <Route
  1851. path=":projectId/events/:eventId/"
  1852. component={errorHandler(ProjectEventRedirect)}
  1853. />
  1854. </Route>
  1855. );
  1856. const appRoutes = (
  1857. <Route>
  1858. {experimentalSpaRoutes}
  1859. <Route path="/" component={errorHandler(App)}>
  1860. {rootRoutes}
  1861. {organizationRoutes}
  1862. {legacyRedirectRoutes}
  1863. {hook('routes')}
  1864. <Route path="*" component={errorHandler(RouteNotFound)} />
  1865. </Route>
  1866. </Route>
  1867. );
  1868. return appRoutes;
  1869. }
  1870. // We load routes both when initlaizing the SDK (for routing integrations) and
  1871. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  1872. export const routes = memoize(buildRoutes);