routes.tsx 77 KB

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