routes.tsx 73 KB

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