routes.tsx 72 KB

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