routes.tsx 71 KB

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