routes.tsx 80 KB

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