routes.tsx 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440
  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 component={make(() => import('sentry/views/alerts/list/rules'))} />
  1183. <Route
  1184. path="details/:ruleId/"
  1185. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1186. />
  1187. <Route
  1188. path=":projectId/"
  1189. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1190. >
  1191. <IndexRedirect
  1192. to={
  1193. forCustomerDomain
  1194. ? '/alerts/rules/'
  1195. : '/organizations/:orgId/alerts/rules/'
  1196. }
  1197. />
  1198. <Route
  1199. path=":ruleId/"
  1200. component={make(() => import('sentry/views/alerts/edit'))}
  1201. />
  1202. </Route>
  1203. <Route path=":projectId/:ruleId/details/">
  1204. <IndexRoute
  1205. component={make(
  1206. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1207. )}
  1208. />
  1209. </Route>
  1210. </Route>
  1211. <Route path="metric-rules/">
  1212. <IndexRedirect
  1213. to={
  1214. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1215. }
  1216. />
  1217. <Route
  1218. path=":projectId/"
  1219. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1220. >
  1221. <IndexRedirect
  1222. to={
  1223. forCustomerDomain
  1224. ? '/alerts/rules/'
  1225. : '/organizations/:orgId/alerts/rules/'
  1226. }
  1227. />
  1228. <Route
  1229. path=":ruleId/"
  1230. component={make(() => import('sentry/views/alerts/edit'))}
  1231. />
  1232. </Route>
  1233. </Route>
  1234. <Route
  1235. path="wizard/"
  1236. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1237. >
  1238. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1239. </Route>
  1240. <Route
  1241. path="new/"
  1242. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1243. >
  1244. <IndexRedirect
  1245. to={
  1246. forCustomerDomain
  1247. ? '/alerts/wizard/'
  1248. : '/organizations/:orgId/alerts/wizard/'
  1249. }
  1250. />
  1251. <Route
  1252. path=":alertType/"
  1253. component={make(() => import('sentry/views/alerts/create'))}
  1254. />
  1255. </Route>
  1256. <Route
  1257. path=":alertId/"
  1258. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1259. />
  1260. <Route
  1261. path=":projectId/"
  1262. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1263. >
  1264. <Route
  1265. path="new/"
  1266. component={make(() => import('sentry/views/alerts/create'))}
  1267. />
  1268. <Route
  1269. path="wizard/"
  1270. component={make(() => import('sentry/views/alerts/wizard'))}
  1271. />
  1272. </Route>
  1273. </Fragment>
  1274. );
  1275. };
  1276. const alertRoutes = (
  1277. <Fragment>
  1278. {usingCustomerDomain && (
  1279. <Route
  1280. path="/alerts/"
  1281. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1282. key="orgless-alerts-route"
  1283. >
  1284. {alertChildRoutes({forCustomerDomain: true})}
  1285. </Route>
  1286. )}
  1287. <Route
  1288. path="/organizations/:orgId/alerts/"
  1289. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1290. key="org-alerts"
  1291. >
  1292. {alertChildRoutes({forCustomerDomain: false})}
  1293. </Route>
  1294. </Fragment>
  1295. );
  1296. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1297. return (
  1298. <Fragment>
  1299. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1300. <Route
  1301. path={
  1302. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1303. }
  1304. component={make(() => import('sentry/views/monitors/create'))}
  1305. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1306. />
  1307. <Route
  1308. path={
  1309. forCustomerDomain
  1310. ? '/crons/:monitorSlug/'
  1311. : '/organizations/:orgId/crons/:monitorSlug/'
  1312. }
  1313. component={make(() => import('sentry/views/monitors/details'))}
  1314. key={
  1315. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1316. }
  1317. />
  1318. <Route
  1319. path={
  1320. forCustomerDomain
  1321. ? '/crons/:monitorSlug/edit/'
  1322. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1323. }
  1324. component={make(() => import('sentry/views/monitors/edit'))}
  1325. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1326. />
  1327. </Fragment>
  1328. );
  1329. };
  1330. const cronsRoutes = (
  1331. <Fragment>
  1332. {usingCustomerDomain && (
  1333. <Route
  1334. path="/crons/"
  1335. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1336. key="orgless-monitors-route"
  1337. >
  1338. {cronsChildRoutes({forCustomerDomain: true})}
  1339. </Route>
  1340. )}
  1341. <Route
  1342. path="/organizations/:orgId/crons/"
  1343. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1344. key="org-monitors"
  1345. >
  1346. {cronsChildRoutes({forCustomerDomain: false})}
  1347. </Route>
  1348. </Fragment>
  1349. );
  1350. const replayChildRoutes = (
  1351. <Fragment>
  1352. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1353. <Route
  1354. path="dead-clicks/"
  1355. component={make(() => import('sentry/views/replays/deadRageClick/deadClickList'))}
  1356. />
  1357. <Route
  1358. path="rage-clicks/"
  1359. component={make(() => import('sentry/views/replays/deadRageClick/rageClickList'))}
  1360. />
  1361. <Route
  1362. path=":replaySlug/"
  1363. component={make(() => import('sentry/views/replays/details'))}
  1364. />
  1365. </Fragment>
  1366. );
  1367. const replayRoutes = (
  1368. <Fragment>
  1369. {usingCustomerDomain && (
  1370. <Route
  1371. path="/replays/"
  1372. component={withDomainRequired(make(() => import('sentry/views/replays/index')))}
  1373. key="orgless-replays-route"
  1374. >
  1375. {replayChildRoutes}
  1376. </Route>
  1377. )}
  1378. <Route
  1379. path="/organizations/:orgId/replays/"
  1380. component={withDomainRedirect(make(() => import('sentry/views/replays/index')))}
  1381. key="org-replays"
  1382. >
  1383. {replayChildRoutes}
  1384. </Route>
  1385. </Fragment>
  1386. );
  1387. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1388. return (
  1389. <Fragment>
  1390. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1391. <Route
  1392. path=":release/"
  1393. component={make(() => import('sentry/views/releases/detail'))}
  1394. >
  1395. <IndexRoute
  1396. component={make(() => import('sentry/views/releases/detail/overview'))}
  1397. />
  1398. <Route
  1399. path="commits/"
  1400. component={make(
  1401. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1402. )}
  1403. />
  1404. <Route
  1405. path="files-changed/"
  1406. component={make(
  1407. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1408. )}
  1409. />
  1410. {forCustomerDomain ? null : (
  1411. <Fragment>
  1412. <Redirect
  1413. from="new-events/"
  1414. to="/organizations/:orgId/releases/:release/"
  1415. />
  1416. <Redirect
  1417. from="all-events/"
  1418. to="/organizations/:orgId/releases/:release/"
  1419. />
  1420. </Fragment>
  1421. )}
  1422. </Route>
  1423. </Fragment>
  1424. );
  1425. };
  1426. const releasesRoutes = (
  1427. <Fragment>
  1428. {usingCustomerDomain && (
  1429. <Route
  1430. path="/releases/"
  1431. component={withDomainRequired(NoOp)}
  1432. key="orgless-releases-route"
  1433. >
  1434. {releasesChildRoutes({forCustomerDomain: true})}
  1435. </Route>
  1436. )}
  1437. <Route
  1438. path="/organizations/:orgId/releases/"
  1439. component={withDomainRedirect(NoOp)}
  1440. key="org-releases"
  1441. >
  1442. {releasesChildRoutes({forCustomerDomain: false})}
  1443. </Route>
  1444. </Fragment>
  1445. );
  1446. const activityRoutes = (
  1447. <Fragment>
  1448. {usingCustomerDomain && (
  1449. <Route
  1450. path="/activity/"
  1451. component={withDomainRequired(
  1452. make(() => import('sentry/views/organizationActivity'))
  1453. )}
  1454. key="orgless-activity-route"
  1455. />
  1456. )}
  1457. <Route
  1458. path="/organizations/:orgId/activity/"
  1459. component={withDomainRedirect(
  1460. make(() => import('sentry/views/organizationActivity'))
  1461. )}
  1462. key="org-activity"
  1463. />
  1464. </Fragment>
  1465. );
  1466. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1467. return (
  1468. <Fragment>
  1469. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1470. <Route
  1471. path="issues/"
  1472. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1473. >
  1474. <IndexRoute
  1475. component={make(
  1476. () => import('sentry/views/organizationStats/teamInsights/issues')
  1477. )}
  1478. />
  1479. </Route>
  1480. <Route
  1481. path="health/"
  1482. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1483. >
  1484. <IndexRoute
  1485. component={make(
  1486. () => import('sentry/views/organizationStats/teamInsights/health')
  1487. )}
  1488. />
  1489. </Route>
  1490. {forCustomerDomain ? null : (
  1491. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1492. )}
  1493. </Fragment>
  1494. );
  1495. };
  1496. const statsRoutes = (
  1497. <Fragment>
  1498. {usingCustomerDomain && (
  1499. <Route
  1500. path="/stats/"
  1501. component={withDomainRequired(NoOp)}
  1502. key="orgless-stats-route"
  1503. >
  1504. {statsChildRoutes({forCustomerDomain: true})}
  1505. </Route>
  1506. )}
  1507. <Route
  1508. path="/organizations/:orgId/stats/"
  1509. component={withDomainRedirect(NoOp)}
  1510. key="org-stats"
  1511. >
  1512. {statsChildRoutes({forCustomerDomain: false})}
  1513. </Route>
  1514. </Fragment>
  1515. );
  1516. // TODO(mark) Long term this /queries route should go away and /discover
  1517. // should be the canonical route for discover2. We have a redirect right now
  1518. // as /discover was for discover 1 and most of the application is linking to
  1519. // /discover/queries and not /discover
  1520. const discoverChildRoutes = (
  1521. <Fragment>
  1522. <IndexRedirect to="queries/" />
  1523. <Route
  1524. path="homepage/"
  1525. component={make(() => import('sentry/views/discover/homepage'))}
  1526. />
  1527. <Route
  1528. path="queries/"
  1529. component={make(() => import('sentry/views/discover/landing'))}
  1530. />
  1531. <Route
  1532. path="results/"
  1533. component={make(() => import('sentry/views/discover/results'))}
  1534. />
  1535. <Route
  1536. path=":eventSlug/"
  1537. component={make(() => import('sentry/views/discover/eventDetails'))}
  1538. />
  1539. </Fragment>
  1540. );
  1541. const discoverRoutes = (
  1542. <Fragment>
  1543. {usingCustomerDomain && (
  1544. <Route
  1545. path="/discover/"
  1546. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1547. key="orgless-discover-route"
  1548. >
  1549. {discoverChildRoutes}
  1550. </Route>
  1551. )}
  1552. <Route
  1553. path="/organizations/:orgId/discover/"
  1554. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1555. key="org-discover-route"
  1556. >
  1557. {discoverChildRoutes}
  1558. </Route>
  1559. </Fragment>
  1560. );
  1561. const performanceChildRoutes = (
  1562. <Fragment>
  1563. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1564. <Route
  1565. path="trends/"
  1566. component={make(() => import('sentry/views/performance/trends'))}
  1567. />
  1568. <Route path="database/">
  1569. <IndexRoute
  1570. component={make(
  1571. () => import('sentry/views/performance/database/databaseLandingPage')
  1572. )}
  1573. />
  1574. <Route
  1575. path="spans/span/:groupId/"
  1576. component={make(
  1577. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1578. )}
  1579. />
  1580. </Route>
  1581. <Route path="browser/">
  1582. <Route path="interactions/">
  1583. <IndexRoute
  1584. component={make(
  1585. () => import('sentry/views/performance/browser/interactionsLandingPage')
  1586. )}
  1587. />
  1588. <Route
  1589. path="summary/"
  1590. component={make(
  1591. () => import('sentry/views/performance/browser/interactionSummary/index')
  1592. )}
  1593. />
  1594. </Route>
  1595. <Route
  1596. path="pageloads/"
  1597. component={make(
  1598. () =>
  1599. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1600. )}
  1601. />
  1602. </Route>
  1603. <Route path="summary/">
  1604. <IndexRoute
  1605. component={make(
  1606. () =>
  1607. import('sentry/views/performance/transactionSummary/transactionOverview')
  1608. )}
  1609. />
  1610. <Route
  1611. path="replays/"
  1612. component={make(
  1613. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1614. )}
  1615. />
  1616. <Route
  1617. path="vitals/"
  1618. component={make(
  1619. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1620. )}
  1621. />
  1622. <Route
  1623. path="tags/"
  1624. component={make(
  1625. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1626. )}
  1627. />
  1628. <Route
  1629. path="events/"
  1630. component={make(
  1631. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1632. )}
  1633. />
  1634. <Route
  1635. path="anomalies/"
  1636. component={make(
  1637. () =>
  1638. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1639. )}
  1640. />
  1641. <Route
  1642. path="profiles/"
  1643. component={make(
  1644. () =>
  1645. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1646. )}
  1647. />
  1648. <Route
  1649. path="aggregateWaterfall/"
  1650. component={make(
  1651. () =>
  1652. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1653. )}
  1654. />
  1655. <Route path="spans/">
  1656. <IndexRoute
  1657. component={make(
  1658. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1659. )}
  1660. />
  1661. <Route
  1662. path=":spanSlug/"
  1663. component={make(
  1664. () =>
  1665. import(
  1666. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1667. )
  1668. )}
  1669. />
  1670. </Route>
  1671. </Route>
  1672. <Route
  1673. path="vitaldetail/"
  1674. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1675. />
  1676. <Route
  1677. path="trace/:traceSlug/"
  1678. component={make(() => import('sentry/views/performance/traceDetails'))}
  1679. />
  1680. <Route
  1681. path=":eventSlug/"
  1682. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1683. />
  1684. </Fragment>
  1685. );
  1686. const performanceRoutes = (
  1687. <Fragment>
  1688. {usingCustomerDomain && (
  1689. <Route
  1690. path="/performance/"
  1691. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1692. key="orgless-performance-route"
  1693. >
  1694. {performanceChildRoutes}
  1695. </Route>
  1696. )}
  1697. <Route
  1698. path="/organizations/:orgId/performance/"
  1699. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1700. key="org-performance"
  1701. >
  1702. {performanceChildRoutes}
  1703. </Route>
  1704. </Fragment>
  1705. );
  1706. const starfishChildRoutes = (
  1707. <Fragment>
  1708. <IndexRoute
  1709. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1710. />
  1711. <Route path="endpoint-overview/">
  1712. <IndexRoute
  1713. component={make(
  1714. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1715. )}
  1716. />
  1717. <Route
  1718. path="span/:groupId/"
  1719. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1720. />
  1721. </Route>
  1722. <Redirect from="database/" to="/performance/database" />
  1723. <Route path="initialization/">
  1724. <IndexRoute
  1725. component={make(
  1726. () => import('sentry/views/starfish/modules/mobile/initialization')
  1727. )}
  1728. />
  1729. </Route>
  1730. <Route path="pageload/">
  1731. <IndexRoute
  1732. component={make(() => import('sentry/views/starfish/modules/mobile/pageload'))}
  1733. />
  1734. </Route>
  1735. <Route path="responsiveness/">
  1736. <IndexRoute
  1737. component={make(
  1738. () => import('sentry/views/starfish/modules/mobile/responsiveness')
  1739. )}
  1740. />
  1741. </Route>
  1742. <Route path="spans/">
  1743. <IndexRoute component={make(() => import('sentry/views/starfish/views/spans'))} />
  1744. <Route
  1745. path="span/:groupId/"
  1746. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1747. />
  1748. </Route>
  1749. </Fragment>
  1750. );
  1751. const starfishRoutes = (
  1752. <Fragment>
  1753. {usingCustomerDomain && (
  1754. <Route
  1755. path="/starfish/"
  1756. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1757. key="orgless-starfish-route"
  1758. >
  1759. {starfishChildRoutes}
  1760. </Route>
  1761. )}
  1762. <Route
  1763. path="/organizations/:orgId/starfish/"
  1764. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1765. key="org-starfish"
  1766. >
  1767. {starfishChildRoutes}
  1768. </Route>
  1769. </Fragment>
  1770. );
  1771. const userFeedbackRoutes = (
  1772. <Fragment>
  1773. {usingCustomerDomain && (
  1774. <Route
  1775. path="/user-feedback/"
  1776. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1777. key="orgless-user-feedback-route"
  1778. />
  1779. )}
  1780. <Route
  1781. path="/organizations/:orgId/user-feedback/"
  1782. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1783. key="org-user-feedback"
  1784. />
  1785. </Fragment>
  1786. );
  1787. const feedbackChildRoutes = (
  1788. <Fragment>
  1789. <IndexRoute
  1790. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1791. />
  1792. <Route
  1793. path=":feedbackSlug/"
  1794. component={make(() => import('sentry/views/feedback/feedbackDetailsPage'))}
  1795. />
  1796. </Fragment>
  1797. );
  1798. const feedbackv2Routes = (
  1799. <Fragment>
  1800. {usingCustomerDomain && (
  1801. <Route
  1802. path="/feedback/"
  1803. component={withDomainRequired(
  1804. make(() => import('sentry/views/feedback/index'))
  1805. )}
  1806. key="orgless-feedback-list-route"
  1807. >
  1808. {feedbackChildRoutes}
  1809. </Route>
  1810. )}
  1811. <Route
  1812. path="/organizations/:orgId/feedback/"
  1813. component={withDomainRedirect(make(() => import('sentry/views/feedback/index')))}
  1814. key="org-feedback-list-route"
  1815. >
  1816. {feedbackChildRoutes}
  1817. </Route>
  1818. </Fragment>
  1819. );
  1820. const issueListRoutes = (
  1821. <Fragment>
  1822. {usingCustomerDomain && (
  1823. <Route
  1824. path="/issues/(searches/:searchId/)"
  1825. component={withDomainRequired(errorHandler(IssueListContainer))}
  1826. key="orgless-issues-route"
  1827. >
  1828. <IndexRoute component={errorHandler(IssueListOverview)} />
  1829. </Route>
  1830. )}
  1831. <Route
  1832. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1833. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1834. key="org-issues"
  1835. >
  1836. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1837. <IndexRoute component={errorHandler(IssueListOverview)} />
  1838. </Route>
  1839. </Fragment>
  1840. );
  1841. // Once org issues is complete, these routes can be nested under
  1842. // /organizations/:orgId/issues
  1843. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1844. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1845. return (
  1846. <Fragment>
  1847. <IndexRoute
  1848. component={hoc(
  1849. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1850. )}
  1851. />
  1852. <Route
  1853. path={TabPaths[Tab.REPLAYS]}
  1854. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1855. />
  1856. <Route
  1857. path={TabPaths[Tab.ACTIVITY]}
  1858. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1859. />
  1860. <Route
  1861. path={TabPaths[Tab.EVENTS]}
  1862. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1863. />
  1864. <Route
  1865. path={TabPaths[Tab.TAGS]}
  1866. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1867. />
  1868. <Route
  1869. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1870. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1871. />
  1872. <Route
  1873. path={TabPaths[Tab.USER_FEEDBACK]}
  1874. component={hoc(
  1875. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1876. )}
  1877. />
  1878. <Route
  1879. path={TabPaths[Tab.ATTACHMENTS]}
  1880. component={hoc(
  1881. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1882. )}
  1883. />
  1884. <Route
  1885. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1886. component={hoc(
  1887. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1888. )}
  1889. />
  1890. <Route
  1891. path={TabPaths[Tab.MERGED]}
  1892. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1893. />
  1894. </Fragment>
  1895. );
  1896. };
  1897. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1898. <Fragment>
  1899. {issueTabs({forCustomerDomain})}
  1900. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1901. {issueTabs({forCustomerDomain})}
  1902. </Route>
  1903. </Fragment>
  1904. );
  1905. const issueDetailsRoutes = (
  1906. <Fragment>
  1907. <Route
  1908. path="/organizations/:orgId/issues/:groupId/"
  1909. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1910. key="org-issues-group-id"
  1911. >
  1912. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1913. </Route>
  1914. {usingCustomerDomain && (
  1915. <Route
  1916. path="/issues/:groupId/"
  1917. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1918. key="orgless-issues-group-id-route"
  1919. >
  1920. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1921. </Route>
  1922. )}
  1923. </Fragment>
  1924. );
  1925. // These are the "manage" pages. For sentry.io, these are _different_ from
  1926. // the SaaS admin routes in getsentry.
  1927. const adminManageRoutes = (
  1928. <Route
  1929. path="/manage/"
  1930. component={make(() => import('sentry/views/admin/adminLayout'))}
  1931. >
  1932. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1933. <Route
  1934. path="buffer/"
  1935. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1936. />
  1937. <Route
  1938. path="relays/"
  1939. component={make(() => import('sentry/views/admin/adminRelays'))}
  1940. />
  1941. <Route
  1942. path="organizations/"
  1943. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1944. />
  1945. <Route
  1946. path="projects/"
  1947. component={make(() => import('sentry/views/admin/adminProjects'))}
  1948. />
  1949. <Route
  1950. path="queue/"
  1951. component={make(() => import('sentry/views/admin/adminQueue'))}
  1952. />
  1953. <Route
  1954. path="quotas/"
  1955. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1956. />
  1957. <Route
  1958. path="settings/"
  1959. component={make(() => import('sentry/views/admin/adminSettings'))}
  1960. />
  1961. <Route path="users/">
  1962. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1963. <Route
  1964. path=":id"
  1965. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1966. />
  1967. </Route>
  1968. <Route
  1969. path="status/mail/"
  1970. component={make(() => import('sentry/views/admin/adminMail'))}
  1971. />
  1972. <Route
  1973. path="status/environment/"
  1974. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1975. />
  1976. <Route
  1977. path="status/packages/"
  1978. component={make(() => import('sentry/views/admin/adminPackages'))}
  1979. />
  1980. <Route
  1981. path="status/warnings/"
  1982. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1983. />
  1984. </Route>
  1985. );
  1986. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1987. // me why we need the OrganizationRoot root container.
  1988. const legacyOrganizationRootRoutes = (
  1989. <Route component={errorHandler(OrganizationRoot)}>
  1990. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1991. <Route path="/organizations/:orgId/">
  1992. {hook('routes:organization')}
  1993. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1994. <Redirect
  1995. from="/organizations/:orgId/teams/your-teams/"
  1996. to="/settings/:orgId/teams/"
  1997. />
  1998. <Redirect
  1999. from="/organizations/:orgId/teams/all-teams/"
  2000. to="/settings/:orgId/teams/"
  2001. />
  2002. <Redirect
  2003. from="/organizations/:orgId/teams/:teamId/"
  2004. to="/settings/:orgId/teams/:teamId/"
  2005. />
  2006. <Redirect
  2007. from="/organizations/:orgId/teams/:teamId/members/"
  2008. to="/settings/:orgId/teams/:teamId/members/"
  2009. />
  2010. <Redirect
  2011. from="/organizations/:orgId/teams/:teamId/projects/"
  2012. to="/settings/:orgId/teams/:teamId/projects/"
  2013. />
  2014. <Redirect
  2015. from="/organizations/:orgId/teams/:teamId/settings/"
  2016. to="/settings/:orgId/teams/:teamId/settings/"
  2017. />
  2018. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  2019. <Redirect
  2020. from="/organizations/:orgId/api-keys/"
  2021. to="/settings/:orgId/api-keys/"
  2022. />
  2023. <Redirect
  2024. from="/organizations/:orgId/api-keys/:apiKey/"
  2025. to="/settings/:orgId/api-keys/:apiKey/"
  2026. />
  2027. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  2028. <Redirect
  2029. from="/organizations/:orgId/members/:memberId/"
  2030. to="/settings/:orgId/members/:memberId/"
  2031. />
  2032. <Redirect
  2033. from="/organizations/:orgId/rate-limits/"
  2034. to="/settings/:orgId/rate-limits/"
  2035. />
  2036. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  2037. </Route>
  2038. </Route>
  2039. );
  2040. const gettingStartedRoutes = (
  2041. <Fragment>
  2042. {usingCustomerDomain && (
  2043. <Fragment>
  2044. <Redirect
  2045. from="/getting-started/:projectId/"
  2046. to="/projects/:projectId/getting-started/"
  2047. />
  2048. <Redirect
  2049. from="/getting-started/:projectId/:platform/"
  2050. to="/projects/:projectId/getting-started/"
  2051. />
  2052. </Fragment>
  2053. )}
  2054. <Redirect
  2055. from="/:orgId/:projectId/getting-started/"
  2056. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2057. />
  2058. <Redirect
  2059. from="/:orgId/:projectId/getting-started/:platform/"
  2060. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2061. />
  2062. </Fragment>
  2063. );
  2064. const profilingChildRoutes = (
  2065. <Fragment>
  2066. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2067. <Route
  2068. path="summary/:projectId/"
  2069. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2070. />
  2071. <Route
  2072. path="profile/:projectId/:eventId/"
  2073. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2074. >
  2075. {/* @TODO Remove flamechart route name */}
  2076. <Route
  2077. path="flamechart/"
  2078. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2079. />
  2080. <Route
  2081. path="flamegraph/"
  2082. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2083. />
  2084. </Route>
  2085. </Fragment>
  2086. );
  2087. const profilingRoutes = (
  2088. <Fragment>
  2089. {usingCustomerDomain && (
  2090. <Route
  2091. path="/profiling/"
  2092. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2093. key="orgless-profiling-route"
  2094. >
  2095. {profilingChildRoutes}
  2096. </Route>
  2097. )}
  2098. <Route
  2099. path="/organizations/:orgId/profiling/"
  2100. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2101. key="org-profiling"
  2102. >
  2103. {profilingChildRoutes}
  2104. </Route>
  2105. </Fragment>
  2106. );
  2107. const ddmChildRoutes = (
  2108. <Fragment>
  2109. <IndexRoute component={make(() => import('sentry/views/ddm/ddm'))} />
  2110. </Fragment>
  2111. );
  2112. const ddmRoutes = (
  2113. <Fragment>
  2114. {usingCustomerDomain && (
  2115. <Route
  2116. path="/ddm/"
  2117. component={withDomainRequired(make(() => import('sentry/views/ddm')))}
  2118. key="orgless-ddm-route"
  2119. >
  2120. {ddmChildRoutes}
  2121. </Route>
  2122. )}
  2123. <Route
  2124. path="/organizations/:orgId/ddm/"
  2125. component={withDomainRedirect(make(() => import('sentry/views/ddm')))}
  2126. key="org-ddm"
  2127. >
  2128. {ddmChildRoutes}
  2129. </Route>
  2130. </Fragment>
  2131. );
  2132. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2133. // canonical URLs.
  2134. //
  2135. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2136. // or do these need to be nested into the OrganizationDetails tree?
  2137. const legacyOrgRedirects = (
  2138. <Route path="/:orgId/:projectId/">
  2139. <IndexRoute
  2140. component={errorHandler(
  2141. redirectDeprecatedProjectRoute(
  2142. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2143. )
  2144. )}
  2145. />
  2146. <Route
  2147. path="issues/"
  2148. component={errorHandler(
  2149. redirectDeprecatedProjectRoute(
  2150. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2151. )
  2152. )}
  2153. />
  2154. <Route
  2155. path="dashboard/"
  2156. component={errorHandler(
  2157. redirectDeprecatedProjectRoute(
  2158. ({orgId, projectId}) =>
  2159. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2160. )
  2161. )}
  2162. />
  2163. <Route
  2164. path="user-feedback/"
  2165. component={errorHandler(
  2166. redirectDeprecatedProjectRoute(
  2167. ({orgId, projectId}) =>
  2168. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2169. )
  2170. )}
  2171. />
  2172. <Route
  2173. path="releases/"
  2174. component={errorHandler(
  2175. redirectDeprecatedProjectRoute(
  2176. ({orgId, projectId}) =>
  2177. `/organizations/${orgId}/releases/?project=${projectId}`
  2178. )
  2179. )}
  2180. />
  2181. <Route
  2182. path="releases/:version/"
  2183. component={errorHandler(
  2184. redirectDeprecatedProjectRoute(
  2185. ({orgId, projectId, router}) =>
  2186. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2187. )
  2188. )}
  2189. />
  2190. <Route
  2191. path="releases/:version/new-events/"
  2192. component={errorHandler(
  2193. redirectDeprecatedProjectRoute(
  2194. ({orgId, projectId, router}) =>
  2195. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2196. )
  2197. )}
  2198. />
  2199. <Route
  2200. path="releases/:version/all-events/"
  2201. component={errorHandler(
  2202. redirectDeprecatedProjectRoute(
  2203. ({orgId, projectId, router}) =>
  2204. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2205. )
  2206. )}
  2207. />
  2208. <Route
  2209. path="releases/:version/commits/"
  2210. component={errorHandler(
  2211. redirectDeprecatedProjectRoute(
  2212. ({orgId, projectId, router}) =>
  2213. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2214. )
  2215. )}
  2216. />
  2217. </Route>
  2218. );
  2219. const organizationRoutes = (
  2220. <Route component={errorHandler(OrganizationDetails)}>
  2221. {settingsRoutes}
  2222. {projectsRoutes}
  2223. {dashboardRoutes}
  2224. {userFeedbackRoutes}
  2225. {feedbackv2Routes}
  2226. {issueListRoutes}
  2227. {issueDetailsRoutes}
  2228. {alertRoutes}
  2229. {cronsRoutes}
  2230. {replayRoutes}
  2231. {releasesRoutes}
  2232. {activityRoutes}
  2233. {statsRoutes}
  2234. {discoverRoutes}
  2235. {performanceRoutes}
  2236. {starfishRoutes}
  2237. {profilingRoutes}
  2238. {ddmRoutes}
  2239. {gettingStartedRoutes}
  2240. {adminManageRoutes}
  2241. {legacyOrganizationRootRoutes}
  2242. {legacyOrgRedirects}
  2243. </Route>
  2244. );
  2245. const legacyRedirectRoutes = (
  2246. <Route path="/:orgId/">
  2247. <IndexRedirect to="/organizations/:orgId/" />
  2248. <Route path=":projectId/settings/">
  2249. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2250. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2251. <Redirect
  2252. from="alerts/rules/"
  2253. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2254. />
  2255. <Redirect
  2256. from="alerts/rules/new/"
  2257. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2258. />
  2259. <Redirect
  2260. from="alerts/rules/:ruleId/"
  2261. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2262. />
  2263. <Redirect
  2264. from="environments/"
  2265. to="/settings/:orgId/projects/:projectId/environments/"
  2266. />
  2267. <Redirect
  2268. from="environments/hidden/"
  2269. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2270. />
  2271. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2272. <Redirect
  2273. from="issue-tracking/"
  2274. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2275. />
  2276. <Redirect
  2277. from="release-tracking/"
  2278. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2279. />
  2280. <Redirect
  2281. from="ownership/"
  2282. to="/settings/:orgId/projects/:projectId/ownership/"
  2283. />
  2284. <Redirect
  2285. from="data-forwarding/"
  2286. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2287. />
  2288. <Redirect
  2289. from="debug-symbols/"
  2290. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2291. />
  2292. <Redirect
  2293. from="processing-issues/"
  2294. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2295. />
  2296. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2297. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2298. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2299. <Redirect
  2300. from="keys/:keyId/"
  2301. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2302. />
  2303. <Redirect
  2304. from="user-feedback/"
  2305. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2306. />
  2307. <Redirect
  2308. from="security-headers/"
  2309. to="/settings/:orgId/projects/:projectId/security-headers/"
  2310. />
  2311. <Redirect
  2312. from="security-headers/csp/"
  2313. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2314. />
  2315. <Redirect
  2316. from="security-headers/expect-ct/"
  2317. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2318. />
  2319. <Redirect
  2320. from="security-headers/hpkp/"
  2321. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2322. />
  2323. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2324. <Redirect
  2325. from="plugins/:pluginId/"
  2326. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2327. />
  2328. <Redirect
  2329. from="integrations/:providerKey/"
  2330. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2331. />
  2332. </Route>
  2333. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2334. <Redirect
  2335. from=":projectId/issues/:groupId/"
  2336. to="/organizations/:orgId/issues/:groupId/"
  2337. />
  2338. <Redirect
  2339. from=":projectId/issues/:groupId/events/"
  2340. to="/organizations/:orgId/issues/:groupId/events/"
  2341. />
  2342. <Redirect
  2343. from=":projectId/issues/:groupId/events/:eventId/"
  2344. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2345. />
  2346. <Redirect
  2347. from=":projectId/issues/:groupId/tags/"
  2348. to="/organizations/:orgId/issues/:groupId/tags/"
  2349. />
  2350. <Redirect
  2351. from=":projectId/issues/:groupId/tags/:tagKey/"
  2352. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2353. />
  2354. <Redirect
  2355. from=":projectId/issues/:groupId/feedback/"
  2356. to="/organizations/:orgId/issues/:groupId/feedback/"
  2357. />
  2358. <Redirect
  2359. from=":projectId/issues/:groupId/similar/"
  2360. to="/organizations/:orgId/issues/:groupId/similar/"
  2361. />
  2362. <Redirect
  2363. from=":projectId/issues/:groupId/merged/"
  2364. to="/organizations/:orgId/issues/:groupId/merged/"
  2365. />
  2366. <Route
  2367. path=":projectId/events/:eventId/"
  2368. component={errorHandler(ProjectEventRedirect)}
  2369. />
  2370. </Route>
  2371. );
  2372. const appRoutes = (
  2373. <Route>
  2374. {experimentalSpaRoutes}
  2375. <Route path="/" component={errorHandler(App)}>
  2376. {rootRoutes}
  2377. {organizationRoutes}
  2378. {legacyRedirectRoutes}
  2379. <Route path="*" component={errorHandler(RouteNotFound)} />
  2380. </Route>
  2381. </Route>
  2382. );
  2383. return appRoutes;
  2384. }
  2385. // We load routes both when initializing the SDK (for routing integrations) and
  2386. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2387. export const routes = memoize(buildRoutes);
  2388. // Exported for use in tests.
  2389. export {buildRoutes};
  2390. function NoOp(props: {children: React.ReactNode}) {
  2391. return <Fragment>{props.children}</Fragment>;
  2392. }