routes.tsx 73 KB

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