routes.tsx 71 KB

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