routes.tsx 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323
  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. {hook('routes:root')}
  153. <Route
  154. path="/accept/:orgId/:memberId/:token/"
  155. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  156. />
  157. <Route
  158. path="/accept/:memberId/:token/"
  159. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  160. />
  161. <Route
  162. path="/accept-transfer/"
  163. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  164. />
  165. <Route
  166. path="/extensions/external-install/:integrationSlug/:installationId"
  167. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  168. />
  169. <Route
  170. path="/extensions/:integrationSlug/link/"
  171. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  172. />
  173. <Route
  174. path="/sentry-apps/:sentryAppSlug/external-install/"
  175. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  176. />
  177. <Redirect from="/account/" to="/settings/account/details/" />
  178. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  179. {/* TODO: remove share/issue orgless url */}
  180. <Route
  181. path="/share/issue/:shareId/"
  182. component={make(() => import('sentry/views/sharedGroupDetails'))}
  183. />
  184. <Route
  185. path="/organizations/:orgId/share/issue/:shareId/"
  186. component={make(() => import('sentry/views/sharedGroupDetails'))}
  187. />
  188. <Route
  189. path="/organizations/new/"
  190. component={make(() => import('sentry/views/organizationCreate'))}
  191. />
  192. {usingCustomerDomain && (
  193. <Route
  194. path="/data-export/:dataExportId"
  195. component={withDomainRequired(
  196. make(() => import('sentry/views/dataExport/dataDownload'))
  197. )}
  198. key="orgless-data-export-route"
  199. />
  200. )}
  201. <Route
  202. path="/organizations/:orgId/data-export/:dataExportId"
  203. component={withDomainRedirect(
  204. make(() => import('sentry/views/dataExport/dataDownload'))
  205. )}
  206. key="org-data-export"
  207. />
  208. {usingCustomerDomain && (
  209. <Route
  210. path="/disabled-member/"
  211. component={withDomainRequired(
  212. make(() => import('sentry/views/disabledMember'))
  213. )}
  214. key="orgless-disabled-member-route"
  215. />
  216. )}
  217. <Route
  218. path="/organizations/:orgId/disabled-member/"
  219. component={withDomainRedirect(make(() => import('sentry/views/disabledMember')))}
  220. key="org-disabled-member"
  221. />
  222. {usingCustomerDomain && (
  223. <Route
  224. path="/join-request/"
  225. component={withDomainRequired(
  226. make(() => import('sentry/views/organizationJoinRequest'))
  227. )}
  228. key="orgless-join-request"
  229. />
  230. )}
  231. <Route
  232. path="/join-request/:orgId/"
  233. component={withDomainRedirect(
  234. make(() => import('sentry/views/organizationJoinRequest'))
  235. )}
  236. key="org-join-request"
  237. />
  238. {usingCustomerDomain && (
  239. <Route
  240. path="/onboarding/"
  241. component={errorHandler(withDomainRequired(OrganizationContextContainer))}
  242. key="orgless-onboarding"
  243. >
  244. <IndexRedirect to="welcome/" />
  245. <Route
  246. path=":step/"
  247. component={make(() => import('sentry/views/onboarding'))}
  248. />
  249. </Route>
  250. )}
  251. <Route
  252. path="/onboarding/:orgId/"
  253. component={withDomainRedirect(errorHandler(OrganizationContextContainer))}
  254. key="org-onboarding"
  255. >
  256. <IndexRedirect to="welcome/" />
  257. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  258. </Route>
  259. </Fragment>
  260. );
  261. const accountSettingsRoutes = (
  262. <Route
  263. path="account/"
  264. name={t('Account')}
  265. component={make(
  266. () => import('sentry/views/settings/account/accountSettingsLayout')
  267. )}
  268. >
  269. <IndexRedirect to="details/" />
  270. <Route
  271. path="details/"
  272. name={t('Details')}
  273. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  274. />
  275. <Route path="notifications/" name={t('Notifications')}>
  276. <IndexRoute
  277. component={make(
  278. () =>
  279. import('sentry/views/settings/account/notifications/notificationSettings')
  280. )}
  281. />
  282. <Route
  283. path=":fineTuneType/"
  284. name={t('Fine Tune Alerts')}
  285. component={make(
  286. () => import('sentry/views/settings/account/accountNotificationFineTuning')
  287. )}
  288. />
  289. </Route>
  290. <Route
  291. path="emails/"
  292. name={t('Emails')}
  293. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  294. />
  295. <Route
  296. path="authorizations/"
  297. component={make(
  298. () => import('sentry/views/settings/account/accountAuthorizations')
  299. )}
  300. />
  301. <Route path="security/" name={t('Security')}>
  302. <Route
  303. component={make(
  304. () =>
  305. import(
  306. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  307. )
  308. )}
  309. >
  310. <IndexRoute
  311. component={make(
  312. () => import('sentry/views/settings/account/accountSecurity')
  313. )}
  314. />
  315. <Route
  316. path="session-history/"
  317. name={t('Session History')}
  318. component={make(
  319. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  320. )}
  321. />
  322. <Route
  323. path="mfa/:authId/"
  324. name={t('Details')}
  325. component={make(
  326. () =>
  327. import(
  328. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  329. )
  330. )}
  331. />
  332. </Route>
  333. <Route
  334. path="mfa/:authId/enroll/"
  335. name={t('Enroll')}
  336. component={make(
  337. () =>
  338. import(
  339. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  340. )
  341. )}
  342. />
  343. </Route>
  344. <Route
  345. path="subscriptions/"
  346. name={t('Subscriptions')}
  347. component={make(
  348. () => import('sentry/views/settings/account/accountSubscriptions')
  349. )}
  350. />
  351. <Route
  352. path="identities/"
  353. name={t('Identities')}
  354. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  355. />
  356. <Route path="api/" name={t('API')}>
  357. <IndexRedirect to="auth-tokens/" />
  358. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  359. <IndexRoute
  360. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  361. />
  362. <Route
  363. path="new-token/"
  364. name={t('Create New Token')}
  365. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  366. />
  367. </Route>
  368. <Route path="applications/" name={t('Applications')}>
  369. <IndexRoute
  370. component={make(
  371. () => import('sentry/views/settings/account/apiApplications')
  372. )}
  373. />
  374. <Route
  375. path=":appId/"
  376. name={t('Details')}
  377. component={make(
  378. () => import('sentry/views/settings/account/apiApplications/details')
  379. )}
  380. />
  381. </Route>
  382. {hook('routes:api')}
  383. </Route>
  384. <Route
  385. path="close-account/"
  386. name={t('Close Account')}
  387. component={make(() => import('sentry/views/settings/account/accountClose'))}
  388. />
  389. </Route>
  390. );
  391. const projectSettingsRoutes = (
  392. <Route
  393. path="projects/:projectId/"
  394. name={t('Project')}
  395. component={make(
  396. () => import('sentry/views/settings/project/projectSettingsLayout')
  397. )}
  398. >
  399. <IndexRoute
  400. name={t('General')}
  401. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  402. />
  403. <Route
  404. path="teams/"
  405. name={t('Teams')}
  406. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  407. />
  408. <Route
  409. path="alerts/"
  410. name={t('Alerts')}
  411. component={make(() => import('sentry/views/settings/projectAlerts'))}
  412. >
  413. <IndexRoute
  414. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  415. />
  416. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  417. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  418. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  419. <Redirect
  420. from="metric-rules/new/"
  421. to="/organizations/:orgId/alerts/:projectId/new/"
  422. />
  423. <Redirect
  424. from="rules/:ruleId/"
  425. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  426. />
  427. <Redirect
  428. from="metric-rules/:ruleId/"
  429. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  430. />
  431. </Route>
  432. <Route
  433. path="environments/"
  434. name={t('Environments')}
  435. component={make(
  436. () => import('sentry/views/settings/project/projectEnvironments')
  437. )}
  438. >
  439. <IndexRoute />
  440. <Route path="hidden/" />
  441. </Route>
  442. <Route
  443. path="tags/"
  444. name={t('Tags')}
  445. component={make(() => import('sentry/views/settings/projectTags'))}
  446. />
  447. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  448. <Route
  449. path="release-tracking/"
  450. name={t('Release Tracking')}
  451. component={make(
  452. () => import('sentry/views/settings/project/projectReleaseTracking')
  453. )}
  454. />
  455. <Route
  456. path="ownership/"
  457. name={t('Ownership Rules')}
  458. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  459. />
  460. <Route
  461. path="data-forwarding/"
  462. name={t('Data Forwarding')}
  463. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  464. />
  465. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  466. <IndexRoute
  467. component={make(
  468. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  469. )}
  470. />
  471. <Route
  472. path="advanced-data-scrubbing/:scrubbingId/"
  473. component={make(
  474. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  475. )}
  476. />
  477. </Route>
  478. <Route
  479. path="debug-symbols/"
  480. name={t('Debug Information Files')}
  481. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  482. />
  483. <Route
  484. path="proguard/"
  485. name={t('ProGuard Mappings')}
  486. component={make(() => import('sentry/views/settings/projectProguard'))}
  487. />
  488. <Route
  489. path="performance/"
  490. name={t('Performance')}
  491. component={make(() => import('sentry/views/settings/projectPerformance'))}
  492. />
  493. <Route path="source-maps/" name={t('Source Maps')}>
  494. <IndexRoute
  495. component={make(async () => {
  496. const {ProjectSourceMapsContainer} = await import(
  497. 'sentry/views/settings/projectSourceMaps'
  498. );
  499. return {
  500. default: ProjectSourceMapsContainer,
  501. };
  502. })}
  503. />
  504. <Route
  505. path="artifact-bundles/"
  506. name={t('Artifact Bundles')}
  507. component={make(async () => {
  508. const {ProjectSourceMapsContainer} = await import(
  509. 'sentry/views/settings/projectSourceMaps'
  510. );
  511. return {
  512. default: ProjectSourceMapsContainer,
  513. };
  514. })}
  515. >
  516. <Route
  517. name={t('Artifact Bundle')}
  518. path=":bundleId/"
  519. component={make(async () => {
  520. const {ProjectSourceMapsContainer} = await import(
  521. 'sentry/views/settings/projectSourceMaps'
  522. );
  523. return {
  524. default: ProjectSourceMapsContainer,
  525. };
  526. })}
  527. />
  528. </Route>
  529. <Route
  530. path="release-bundles/"
  531. name={t('Release Bundles')}
  532. component={make(async () => {
  533. const {ProjectSourceMapsContainer} = await import(
  534. 'sentry/views/settings/projectSourceMaps'
  535. );
  536. return {
  537. default: ProjectSourceMapsContainer,
  538. };
  539. })}
  540. >
  541. <Route
  542. name={t('Release Bundle')}
  543. path=":bundleId/"
  544. component={make(async () => {
  545. const {ProjectSourceMapsContainer} = await import(
  546. 'sentry/views/settings/projectSourceMaps'
  547. );
  548. return {
  549. default: ProjectSourceMapsContainer,
  550. };
  551. })}
  552. />
  553. </Route>
  554. <Route
  555. path=":name/"
  556. name={t('Archive')}
  557. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  558. />
  559. </Route>
  560. <Route
  561. path="processing-issues/"
  562. name={t('Processing Issues')}
  563. component={make(
  564. () => import('sentry/views/settings/project/projectProcessingIssues')
  565. )}
  566. />
  567. <Route
  568. path="filters/"
  569. name={t('Inbound Filters')}
  570. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  571. >
  572. <IndexRedirect to="data-filters/" />
  573. <Route path=":filterType/" />
  574. </Route>
  575. <Redirect from="dynamic-sampling/" to="performance/" />
  576. <Route
  577. path="issue-grouping/"
  578. name={t('Issue Grouping')}
  579. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  580. />
  581. <Route
  582. path="hooks/"
  583. name={t('Service Hooks')}
  584. component={make(
  585. () => import('sentry/views/settings/project/projectServiceHooks')
  586. )}
  587. />
  588. <Route
  589. path="hooks/new/"
  590. name={t('Create Service Hook')}
  591. component={make(
  592. () => import('sentry/views/settings/project/projectCreateServiceHook')
  593. )}
  594. />
  595. <Route
  596. path="hooks/:hookId/"
  597. name={t('Service Hook Details')}
  598. component={make(
  599. () => import('sentry/views/settings/project/projectServiceHookDetails')
  600. )}
  601. />
  602. <Route path="keys/" name={t('Client Keys')}>
  603. <IndexRoute
  604. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  605. />
  606. <Route
  607. path=":keyId/"
  608. name={t('Details')}
  609. component={make(
  610. () => import('sentry/views/settings/project/projectKeys/details')
  611. )}
  612. />
  613. </Route>
  614. <Route
  615. path="user-feedback/"
  616. name={t('User Feedback')}
  617. component={make(
  618. () => import('sentry/views/settings/project/projectUserFeedback')
  619. )}
  620. />
  621. <Redirect from="csp/" to="security-headers/" />
  622. <Route path="security-headers/" name={t('Security Headers')}>
  623. <IndexRoute
  624. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  625. />
  626. <Route
  627. path="csp/"
  628. name={t('Content Security Policy')}
  629. component={make(
  630. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  631. )}
  632. />
  633. <Route
  634. path="expect-ct/"
  635. name={t('Certificate Transparency')}
  636. component={make(
  637. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  638. )}
  639. />
  640. <Route
  641. path="hpkp/"
  642. name={t('HPKP')}
  643. component={make(
  644. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  645. )}
  646. />
  647. </Route>
  648. <Route path="plugins/" name={t('Legacy Integrations')}>
  649. <IndexRoute
  650. component={make(() => import('sentry/views/settings/projectPlugins'))}
  651. />
  652. <Route
  653. path=":pluginId/"
  654. name={t('Integration Details')}
  655. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  656. />
  657. </Route>
  658. </Route>
  659. );
  660. const orgSettingsRoutes = (
  661. <Route
  662. component={make(
  663. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  664. )}
  665. >
  666. {hook('routes:organization')}
  667. {!usingCustomerDomain && (
  668. <IndexRoute
  669. name={t('General')}
  670. component={make(
  671. () => import('sentry/views/settings/organizationGeneralSettings')
  672. )}
  673. />
  674. )}
  675. {usingCustomerDomain && (
  676. <Route
  677. path="/settings/organization/"
  678. name={t('General')}
  679. component={make(
  680. () => import('sentry/views/settings/organizationGeneralSettings')
  681. )}
  682. />
  683. )}
  684. <Route
  685. path="projects/"
  686. name={t('Projects')}
  687. component={make(() => import('sentry/views/settings/organizationProjects'))}
  688. />
  689. <Route path="api-keys/" name={t('API Key')}>
  690. <IndexRoute
  691. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  692. />
  693. <Route
  694. path=":apiKey/"
  695. name={t('Details')}
  696. component={make(
  697. () =>
  698. import(
  699. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  700. )
  701. )}
  702. />
  703. </Route>
  704. <Route
  705. path="audit-log/"
  706. name={t('Audit Log')}
  707. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  708. />
  709. <Route
  710. path="auth/"
  711. name={t('Auth Providers')}
  712. component={make(() => import('sentry/views/settings/organizationAuth'))}
  713. />
  714. <Redirect from="members/requests" to="members/" />
  715. <Route path="members/" name={t('Members')}>
  716. <Route
  717. component={make(
  718. () =>
  719. import(
  720. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  721. )
  722. )}
  723. >
  724. <IndexRoute
  725. component={make(
  726. () =>
  727. import(
  728. 'sentry/views/settings/organizationMembers/organizationMembersList'
  729. )
  730. )}
  731. />
  732. </Route>
  733. <Route
  734. path=":memberId/"
  735. name={t('Details')}
  736. component={make(
  737. () =>
  738. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  739. )}
  740. />
  741. </Route>
  742. <Route
  743. path="rate-limits/"
  744. name={t('Rate Limits')}
  745. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  746. />
  747. <Route
  748. path="relay/"
  749. name={t('Relay')}
  750. component={make(() => import('sentry/views/settings/organizationRelay'))}
  751. />
  752. <Route
  753. path="repos/"
  754. name={t('Repositories')}
  755. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  756. />
  757. <Route
  758. path="settings/"
  759. component={make(
  760. () => import('sentry/views/settings/organizationGeneralSettings')
  761. )}
  762. />
  763. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  764. <IndexRoute
  765. component={make(
  766. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  767. )}
  768. />
  769. <Route
  770. path="advanced-data-scrubbing/:scrubbingId/"
  771. component={make(
  772. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  773. )}
  774. />
  775. </Route>
  776. <Route path="teams/" name={t('Teams')}>
  777. <IndexRoute
  778. component={make(() => import('sentry/views/settings/organizationTeams'))}
  779. />
  780. <Route
  781. path=":teamId/"
  782. name={t('Team')}
  783. component={make(
  784. () => import('sentry/views/settings/organizationTeams/teamDetails')
  785. )}
  786. >
  787. <IndexRedirect to="members/" />
  788. <Route
  789. path="members/"
  790. name={t('Members')}
  791. component={make(
  792. () => import('sentry/views/settings/organizationTeams/teamMembers')
  793. )}
  794. />
  795. <Route
  796. path="notifications/"
  797. name={t('Notifications')}
  798. component={make(
  799. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  800. )}
  801. />
  802. <Route
  803. path="projects/"
  804. name={t('Projects')}
  805. component={make(
  806. () => import('sentry/views/settings/organizationTeams/teamProjects')
  807. )}
  808. />
  809. <Route
  810. path="settings/"
  811. name={t('Settings')}
  812. component={make(
  813. () => import('sentry/views/settings/organizationTeams/teamSettings')
  814. )}
  815. />
  816. </Route>
  817. </Route>
  818. <Redirect from="plugins/" to="integrations/" />
  819. <Route path="plugins/" name={t('Integrations')}>
  820. <Route
  821. path=":integrationSlug/"
  822. name={t('Integration Details')}
  823. component={make(
  824. () =>
  825. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  826. )}
  827. />
  828. </Route>
  829. <Redirect from="sentry-apps/" to="integrations/" />
  830. <Route path="sentry-apps/" name={t('Integrations')}>
  831. <Route
  832. path=":integrationSlug"
  833. name={t('Details')}
  834. component={make(
  835. () =>
  836. import(
  837. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  838. )
  839. )}
  840. />
  841. </Route>
  842. <Redirect from="document-integrations/" to="integrations/" />
  843. <Route path="document-integrations/" name={t('Integrations')}>
  844. <Route
  845. path=":integrationSlug"
  846. name={t('Details')}
  847. component={make(
  848. () =>
  849. import(
  850. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  851. )
  852. )}
  853. />
  854. </Route>
  855. <Route path="integrations/" name={t('Integrations')}>
  856. <IndexRoute
  857. component={make(
  858. () =>
  859. import(
  860. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  861. )
  862. )}
  863. />
  864. <Route
  865. path=":integrationSlug"
  866. name={t('Integration Details')}
  867. component={make(
  868. () =>
  869. import(
  870. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  871. )
  872. )}
  873. />
  874. <Route
  875. path=":providerKey/:integrationId/"
  876. name={t('Configure Integration')}
  877. component={make(
  878. () =>
  879. import(
  880. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  881. )
  882. )}
  883. />
  884. </Route>
  885. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  886. <Route path="developer-settings/" name={t('Developer Settings')}>
  887. <IndexRoute
  888. component={make(
  889. () => import('sentry/views/settings/organizationDeveloperSettings')
  890. )}
  891. />
  892. <Route
  893. path="new-public/"
  894. name={t('Create Integration')}
  895. component={make(
  896. () =>
  897. import(
  898. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  899. )
  900. )}
  901. />
  902. <Route
  903. path="new-internal/"
  904. name={t('Create Integration')}
  905. component={make(
  906. () =>
  907. import(
  908. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  909. )
  910. )}
  911. />
  912. <Route
  913. path=":appSlug/"
  914. name={t('Edit Integration')}
  915. component={make(
  916. () =>
  917. import(
  918. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  919. )
  920. )}
  921. />
  922. <Route
  923. path=":appSlug/dashboard/"
  924. name={t('Integration Dashboard')}
  925. component={make(
  926. () =>
  927. import(
  928. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  929. )
  930. )}
  931. />
  932. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  933. <Route
  934. path="new/"
  935. name={t('Create Sentry Function')}
  936. component={make(
  937. () =>
  938. import(
  939. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  940. )
  941. )}
  942. />
  943. <Route
  944. path=":functionSlug/"
  945. name={t('Edit Sentry Function')}
  946. component={make(
  947. () =>
  948. import(
  949. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  950. )
  951. )}
  952. />
  953. </Route>
  954. </Route>
  955. </Route>
  956. );
  957. const legacySettingsRedirects = (
  958. <Fragment>
  959. <Redirect from=":projectId/" to="projects/:projectId/" />
  960. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  961. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  962. <Redirect
  963. from=":projectId/alerts/rules/:ruleId/"
  964. to="projects/:projectId/alerts/rules/:ruleId/"
  965. />
  966. </Fragment>
  967. );
  968. const settingsRoutes = (
  969. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  970. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  971. {accountSettingsRoutes}
  972. <Fragment>
  973. {usingCustomerDomain && (
  974. <Route
  975. name={t('Organization')}
  976. component={withDomainRequired(NoOp)}
  977. key="orgless-settings-route"
  978. >
  979. {orgSettingsRoutes}
  980. {projectSettingsRoutes}
  981. </Route>
  982. )}
  983. <Route
  984. path=":orgId/"
  985. name={t('Organization')}
  986. component={withDomainRedirect(NoOp)}
  987. key="org-settings"
  988. >
  989. {orgSettingsRoutes}
  990. {projectSettingsRoutes}
  991. {legacySettingsRedirects}
  992. </Route>
  993. </Fragment>
  994. </Route>
  995. );
  996. const projectsChildRoutes = (
  997. <Fragment>
  998. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  999. <Route
  1000. path="new/"
  1001. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1002. />
  1003. <Route
  1004. path=":projectId/"
  1005. component={make(() => import('sentry/views/projectDetail'))}
  1006. />
  1007. <Route
  1008. path=":projectId/events/:eventId/"
  1009. component={errorHandler(ProjectEventRedirect)}
  1010. />
  1011. <Route
  1012. path=":projectId/getting-started/"
  1013. component={make(
  1014. () => import('sentry/views/projectInstall/platformOrIntegration')
  1015. )}
  1016. />
  1017. </Fragment>
  1018. );
  1019. const projectsRoutes = (
  1020. <Fragment>
  1021. {usingCustomerDomain && (
  1022. <Route
  1023. path="/projects/"
  1024. component={make(async () => {
  1025. const {Projects} = await import('sentry/views/projects/');
  1026. return {
  1027. default: Projects,
  1028. };
  1029. })}
  1030. key="orgless-projects-route"
  1031. >
  1032. {projectsChildRoutes}
  1033. </Route>
  1034. )}
  1035. <Route
  1036. path="/organizations/:orgId/projects/"
  1037. component={make(async () => {
  1038. const {Projects} = await import('sentry/views/projects/');
  1039. return {
  1040. default: Projects,
  1041. };
  1042. })}
  1043. key="org-projects"
  1044. >
  1045. {projectsChildRoutes}
  1046. </Route>
  1047. </Fragment>
  1048. );
  1049. const dashboardWidgetRoutes = (
  1050. <Fragment>
  1051. <Route
  1052. path="widget/:widgetIndex/edit/"
  1053. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1054. />
  1055. <Route
  1056. path="widget/new/"
  1057. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1058. />
  1059. <Route
  1060. path="widget/:widgetId/"
  1061. component={make(() => import('sentry/views/dashboards/view'))}
  1062. />
  1063. </Fragment>
  1064. );
  1065. const dashboardRoutes = (
  1066. <Fragment>
  1067. <Fragment>
  1068. {usingCustomerDomain && (
  1069. <Route
  1070. path="/dashboards/"
  1071. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1072. key="orgless-dashboards-route"
  1073. >
  1074. <IndexRoute
  1075. component={make(() => import('sentry/views/dashboards/manage'))}
  1076. />
  1077. </Route>
  1078. )}
  1079. <Route
  1080. path="/organizations/:orgId/dashboards/"
  1081. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1082. key="org-dashboards"
  1083. >
  1084. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1085. </Route>
  1086. </Fragment>
  1087. <Fragment>
  1088. {usingCustomerDomain && (
  1089. <Route
  1090. path="/dashboards/new/"
  1091. component={withDomainRequired(
  1092. make(() => import('sentry/views/dashboards/create'))
  1093. )}
  1094. key="orgless-dashboards-new-route"
  1095. >
  1096. <Route
  1097. path="widget/:widgetIndex/edit/"
  1098. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1099. />
  1100. <Route
  1101. path="widget/new/"
  1102. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1103. />
  1104. </Route>
  1105. )}
  1106. <Route
  1107. path="/organizations/:orgId/dashboards/new/"
  1108. component={withDomainRedirect(
  1109. make(() => import('sentry/views/dashboards/create'))
  1110. )}
  1111. key="org-dashboards-new"
  1112. >
  1113. <Route
  1114. path="widget/:widgetIndex/edit/"
  1115. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1116. />
  1117. <Route
  1118. path="widget/new/"
  1119. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1120. />
  1121. </Route>
  1122. </Fragment>
  1123. <Fragment>
  1124. {usingCustomerDomain && (
  1125. <Route
  1126. path="/dashboards/new/:templateId"
  1127. component={withDomainRequired(
  1128. make(() => import('sentry/views/dashboards/create'))
  1129. )}
  1130. key="orgless-dashboards-new-template-route"
  1131. >
  1132. <Route
  1133. path="widget/:widgetId/"
  1134. component={make(() => import('sentry/views/dashboards/create'))}
  1135. />
  1136. </Route>
  1137. )}
  1138. <Route
  1139. path="/organizations/:orgId/dashboards/new/:templateId"
  1140. component={withDomainRedirect(
  1141. make(() => import('sentry/views/dashboards/create'))
  1142. )}
  1143. key="org-dashboards-new-template"
  1144. >
  1145. <Route
  1146. path="widget/:widgetId/"
  1147. component={make(() => import('sentry/views/dashboards/create'))}
  1148. />
  1149. </Route>
  1150. </Fragment>
  1151. <Redirect
  1152. from="/organizations/:orgId/dashboards/:dashboardId/"
  1153. to="/organizations/:orgId/dashboard/:dashboardId/"
  1154. />
  1155. {usingCustomerDomain && (
  1156. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1157. )}
  1158. <Fragment>
  1159. {usingCustomerDomain && (
  1160. <Route
  1161. path="/dashboard/:dashboardId/"
  1162. component={withDomainRequired(
  1163. make(() => import('sentry/views/dashboards/view'))
  1164. )}
  1165. key="orgless-dashboards-dashboard-id-route"
  1166. >
  1167. {dashboardWidgetRoutes}
  1168. </Route>
  1169. )}
  1170. <Route
  1171. path="/organizations/:orgId/dashboard/:dashboardId/"
  1172. component={withDomainRedirect(
  1173. make(() => import('sentry/views/dashboards/view'))
  1174. )}
  1175. key="org-dashboards-dashboard-id"
  1176. >
  1177. {dashboardWidgetRoutes}
  1178. </Route>
  1179. </Fragment>
  1180. </Fragment>
  1181. );
  1182. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1183. return (
  1184. <Fragment>
  1185. <IndexRoute
  1186. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1187. />
  1188. <Route path="rules/">
  1189. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  1190. <Route
  1191. path="details/:ruleId/"
  1192. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1193. />
  1194. <Route
  1195. path=":projectId/"
  1196. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1197. >
  1198. <IndexRedirect
  1199. to={
  1200. forCustomerDomain
  1201. ? '/alerts/rules/'
  1202. : '/organizations/:orgId/alerts/rules/'
  1203. }
  1204. />
  1205. <Route
  1206. path=":ruleId/"
  1207. component={make(() => import('sentry/views/alerts/edit'))}
  1208. />
  1209. </Route>
  1210. <Route path=":projectId/:ruleId/details/">
  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/DBModule'))}
  1683. />
  1684. <Route
  1685. path="api/"
  1686. component={make(() => import('sentry/views/starfish/modules/HTTPModule'))}
  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/spanSummaryPage'))}
  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 gettingStartedRoutes = (
  1959. <Fragment>
  1960. {usingCustomerDomain && (
  1961. <Fragment>
  1962. <Redirect
  1963. from="/getting-started/:projectId/"
  1964. to="/projects/:projectId/getting-started/"
  1965. />
  1966. <Redirect
  1967. from="/getting-started/:projectId/:platform/"
  1968. to="/projects/:projectId/getting-started/"
  1969. />
  1970. </Fragment>
  1971. )}
  1972. <Redirect
  1973. from="/:orgId/:projectId/getting-started/"
  1974. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1975. />
  1976. <Redirect
  1977. from="/:orgId/:projectId/getting-started/:platform/"
  1978. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1979. />
  1980. </Fragment>
  1981. );
  1982. const profilingChildRoutes = (
  1983. <Fragment>
  1984. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1985. <Route
  1986. path="summary/:projectId/"
  1987. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1988. />
  1989. <Route
  1990. path="profile/:projectId/:eventId/"
  1991. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1992. >
  1993. <Route
  1994. path="flamechart/"
  1995. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1996. />
  1997. </Route>
  1998. </Fragment>
  1999. );
  2000. const profilingRoutes = (
  2001. <Fragment>
  2002. {usingCustomerDomain && (
  2003. <Route
  2004. path="/profiling/"
  2005. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2006. key="orgless-profiling-route"
  2007. >
  2008. {profilingChildRoutes}
  2009. </Route>
  2010. )}
  2011. <Route
  2012. path="/organizations/:orgId/profiling/"
  2013. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2014. key="org-profiling"
  2015. >
  2016. {profilingChildRoutes}
  2017. </Route>
  2018. </Fragment>
  2019. );
  2020. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2021. // canonical URLs.
  2022. //
  2023. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2024. // or do these need to be nested into the OrganizationDetails tree?
  2025. const legacyOrgRedirects = (
  2026. <Route path="/:orgId/:projectId/">
  2027. <IndexRoute
  2028. component={errorHandler(
  2029. redirectDeprecatedProjectRoute(
  2030. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2031. )
  2032. )}
  2033. />
  2034. <Route
  2035. path="issues/"
  2036. component={errorHandler(
  2037. redirectDeprecatedProjectRoute(
  2038. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2039. )
  2040. )}
  2041. />
  2042. <Route
  2043. path="dashboard/"
  2044. component={errorHandler(
  2045. redirectDeprecatedProjectRoute(
  2046. ({orgId, projectId}) =>
  2047. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2048. )
  2049. )}
  2050. />
  2051. <Route
  2052. path="user-feedback/"
  2053. component={errorHandler(
  2054. redirectDeprecatedProjectRoute(
  2055. ({orgId, projectId}) =>
  2056. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2057. )
  2058. )}
  2059. />
  2060. <Route
  2061. path="releases/"
  2062. component={errorHandler(
  2063. redirectDeprecatedProjectRoute(
  2064. ({orgId, projectId}) =>
  2065. `/organizations/${orgId}/releases/?project=${projectId}`
  2066. )
  2067. )}
  2068. />
  2069. <Route
  2070. path="releases/:version/"
  2071. component={errorHandler(
  2072. redirectDeprecatedProjectRoute(
  2073. ({orgId, projectId, router}) =>
  2074. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2075. )
  2076. )}
  2077. />
  2078. <Route
  2079. path="releases/:version/new-events/"
  2080. component={errorHandler(
  2081. redirectDeprecatedProjectRoute(
  2082. ({orgId, projectId, router}) =>
  2083. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2084. )
  2085. )}
  2086. />
  2087. <Route
  2088. path="releases/:version/all-events/"
  2089. component={errorHandler(
  2090. redirectDeprecatedProjectRoute(
  2091. ({orgId, projectId, router}) =>
  2092. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2093. )
  2094. )}
  2095. />
  2096. <Route
  2097. path="releases/:version/commits/"
  2098. component={errorHandler(
  2099. redirectDeprecatedProjectRoute(
  2100. ({orgId, projectId, router}) =>
  2101. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2102. )
  2103. )}
  2104. />
  2105. </Route>
  2106. );
  2107. const organizationRoutes = (
  2108. <Route component={errorHandler(OrganizationDetails)}>
  2109. {settingsRoutes}
  2110. {projectsRoutes}
  2111. {dashboardRoutes}
  2112. {userFeedbackRoutes}
  2113. {issueListRoutes}
  2114. {issueDetailsRoutes}
  2115. {alertRoutes}
  2116. {cronsRoutes}
  2117. {replayRoutes}
  2118. {releasesRoutes}
  2119. {activityRoutes}
  2120. {statsRoutes}
  2121. {discoverRoutes}
  2122. {performanceRoutes}
  2123. {starfishRoutes}
  2124. {profilingRoutes}
  2125. {gettingStartedRoutes}
  2126. {adminManageRoutes}
  2127. {legacyOrganizationRootRoutes}
  2128. {legacyOrgRedirects}
  2129. </Route>
  2130. );
  2131. const legacyRedirectRoutes = (
  2132. <Route path="/:orgId/">
  2133. <IndexRedirect to="/organizations/:orgId/" />
  2134. <Route path=":projectId/settings/">
  2135. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2136. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2137. <Redirect
  2138. from="alerts/rules/"
  2139. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2140. />
  2141. <Redirect
  2142. from="alerts/rules/new/"
  2143. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2144. />
  2145. <Redirect
  2146. from="alerts/rules/:ruleId/"
  2147. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2148. />
  2149. <Redirect
  2150. from="environments/"
  2151. to="/settings/:orgId/projects/:projectId/environments/"
  2152. />
  2153. <Redirect
  2154. from="environments/hidden/"
  2155. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2156. />
  2157. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2158. <Redirect
  2159. from="issue-tracking/"
  2160. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2161. />
  2162. <Redirect
  2163. from="release-tracking/"
  2164. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2165. />
  2166. <Redirect
  2167. from="ownership/"
  2168. to="/settings/:orgId/projects/:projectId/ownership/"
  2169. />
  2170. <Redirect
  2171. from="data-forwarding/"
  2172. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2173. />
  2174. <Redirect
  2175. from="debug-symbols/"
  2176. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2177. />
  2178. <Redirect
  2179. from="processing-issues/"
  2180. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2181. />
  2182. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2183. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2184. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2185. <Redirect
  2186. from="keys/:keyId/"
  2187. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2188. />
  2189. <Redirect
  2190. from="user-feedback/"
  2191. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2192. />
  2193. <Redirect
  2194. from="security-headers/"
  2195. to="/settings/:orgId/projects/:projectId/security-headers/"
  2196. />
  2197. <Redirect
  2198. from="security-headers/csp/"
  2199. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2200. />
  2201. <Redirect
  2202. from="security-headers/expect-ct/"
  2203. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2204. />
  2205. <Redirect
  2206. from="security-headers/hpkp/"
  2207. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2208. />
  2209. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2210. <Redirect
  2211. from="plugins/:pluginId/"
  2212. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2213. />
  2214. <Redirect
  2215. from="integrations/:providerKey/"
  2216. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2217. />
  2218. </Route>
  2219. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2220. <Redirect
  2221. from=":projectId/issues/:groupId/"
  2222. to="/organizations/:orgId/issues/:groupId/"
  2223. />
  2224. <Redirect
  2225. from=":projectId/issues/:groupId/events/"
  2226. to="/organizations/:orgId/issues/:groupId/events/"
  2227. />
  2228. <Redirect
  2229. from=":projectId/issues/:groupId/events/:eventId/"
  2230. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2231. />
  2232. <Redirect
  2233. from=":projectId/issues/:groupId/tags/"
  2234. to="/organizations/:orgId/issues/:groupId/tags/"
  2235. />
  2236. <Redirect
  2237. from=":projectId/issues/:groupId/tags/:tagKey/"
  2238. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2239. />
  2240. <Redirect
  2241. from=":projectId/issues/:groupId/feedback/"
  2242. to="/organizations/:orgId/issues/:groupId/feedback/"
  2243. />
  2244. <Redirect
  2245. from=":projectId/issues/:groupId/similar/"
  2246. to="/organizations/:orgId/issues/:groupId/similar/"
  2247. />
  2248. <Redirect
  2249. from=":projectId/issues/:groupId/merged/"
  2250. to="/organizations/:orgId/issues/:groupId/merged/"
  2251. />
  2252. <Route
  2253. path=":projectId/events/:eventId/"
  2254. component={errorHandler(ProjectEventRedirect)}
  2255. />
  2256. </Route>
  2257. );
  2258. const appRoutes = (
  2259. <Route>
  2260. {experimentalSpaRoutes}
  2261. <Route path="/" component={errorHandler(App)}>
  2262. {rootRoutes}
  2263. {organizationRoutes}
  2264. {legacyRedirectRoutes}
  2265. <Route path="*" component={errorHandler(RouteNotFound)} />
  2266. </Route>
  2267. </Route>
  2268. );
  2269. return appRoutes;
  2270. }
  2271. // We load routes both when initializing the SDK (for routing integrations) and
  2272. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2273. export const routes = memoize(buildRoutes);
  2274. // Exported for use in tests.
  2275. export {buildRoutes};
  2276. function NoOp(props: {children: React.ReactNode}) {
  2277. return <Fragment>{props.children}</Fragment>;
  2278. }