routes.tsx 73 KB

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