routes.tsx 70 KB

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