routes.tsx 78 KB

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