routes.tsx 79 KB

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