routes.tsx 73 KB

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