routes.tsx 72 KB

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