routes.tsx 71 KB

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