routes.tsx 73 KB

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