routes.tsx 71 KB

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