routes.tsx 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258
  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('Extract Metric')}
  526. path="extract-metric/"
  527. component={make(
  528. () => import('sentry/views/settings/projectMetrics/extractMetric')
  529. )}
  530. />
  531. <Route
  532. name={t('Metrics Details')}
  533. path=":mri/"
  534. component={make(
  535. () => import('sentry/views/settings/projectMetrics/projectMetricsDetails')
  536. )}
  537. />
  538. </Route>
  539. <Route
  540. path="replays/"
  541. name={t('Replays')}
  542. component={make(() => import('sentry/views/settings/project/projectReplays'))}
  543. />
  544. <Route
  545. path="remote-config/"
  546. name={t('Remote Config')}
  547. component={make(
  548. () => import('sentry/views/settings/project/projectRemoteConfig')
  549. )}
  550. />
  551. <Route path="source-maps/" name={t('Source Maps')}>
  552. <IndexRoute
  553. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  554. />
  555. <Route
  556. path="artifact-bundles/"
  557. name={t('Artifact Bundles')}
  558. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  559. >
  560. <Route
  561. name={t('Artifact Bundle')}
  562. path=":bundleId/"
  563. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  564. />
  565. </Route>
  566. <Route
  567. path="release-bundles/"
  568. name={t('Release Bundles')}
  569. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  570. >
  571. <Route
  572. name={t('Release Bundle')}
  573. path=":bundleId/"
  574. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  575. />
  576. </Route>
  577. <Redirect from=":name/" to="release-bundles/:name/" />
  578. </Route>
  579. <Route
  580. path="processing-issues/"
  581. name={t('Processing Issues')}
  582. component={make(
  583. () => import('sentry/views/settings/project/projectProcessingIssues')
  584. )}
  585. />
  586. <Route
  587. path="filters/"
  588. name={t('Inbound Filters')}
  589. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  590. >
  591. <IndexRedirect to="data-filters/" />
  592. <Route path=":filterType/" />
  593. </Route>
  594. <Redirect from="dynamic-sampling/" to="performance/" />
  595. <Route
  596. path="issue-grouping/"
  597. name={t('Issue Grouping')}
  598. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  599. />
  600. <Route
  601. path="hooks/"
  602. name={t('Service Hooks')}
  603. component={make(
  604. () => import('sentry/views/settings/project/projectServiceHooks')
  605. )}
  606. />
  607. <Route
  608. path="hooks/new/"
  609. name={t('Create Service Hook')}
  610. component={make(
  611. () => import('sentry/views/settings/project/projectCreateServiceHook')
  612. )}
  613. />
  614. <Route
  615. path="hooks/:hookId/"
  616. name={t('Service Hook Details')}
  617. component={make(
  618. () => import('sentry/views/settings/project/projectServiceHookDetails')
  619. )}
  620. />
  621. <Route path="keys/" name={t('Client Keys')}>
  622. <IndexRoute
  623. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  624. />
  625. <Route
  626. path=":keyId/"
  627. name={t('Details')}
  628. component={make(
  629. () => import('sentry/views/settings/project/projectKeys/details')
  630. )}
  631. />
  632. </Route>
  633. <Route
  634. path="loader-script/"
  635. name={t('Loader Script')}
  636. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  637. />
  638. <Redirect from="csp/" to="security-headers/" />
  639. <Route path="security-headers/" name={t('Security Headers')}>
  640. <IndexRoute
  641. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  642. />
  643. <Route
  644. path="csp/"
  645. name={t('Content Security Policy')}
  646. component={make(
  647. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  648. )}
  649. />
  650. <Route
  651. path="expect-ct/"
  652. name={t('Certificate Transparency')}
  653. component={make(
  654. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  655. )}
  656. />
  657. <Route
  658. path="hpkp/"
  659. name={t('HPKP')}
  660. component={make(
  661. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  662. )}
  663. />
  664. </Route>
  665. <Route path="plugins/" name={t('Legacy Integrations')}>
  666. <IndexRoute
  667. component={make(() => import('sentry/views/settings/projectPlugins'))}
  668. />
  669. <Route
  670. path=":pluginId/"
  671. name={t('Integration Details')}
  672. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  673. />
  674. </Route>
  675. </Route>
  676. );
  677. const orgSettingsRoutes = (
  678. <Route
  679. component={make(
  680. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  681. )}
  682. >
  683. {hook('routes:organization')}
  684. {!USING_CUSTOMER_DOMAIN && (
  685. <IndexRoute
  686. name={t('General')}
  687. component={make(
  688. () => import('sentry/views/settings/organizationGeneralSettings')
  689. )}
  690. />
  691. )}
  692. {USING_CUSTOMER_DOMAIN && (
  693. <Route
  694. path="/settings/organization/"
  695. name={t('General')}
  696. component={make(
  697. () => import('sentry/views/settings/organizationGeneralSettings')
  698. )}
  699. />
  700. )}
  701. <Route
  702. path="projects/"
  703. name={t('Projects')}
  704. component={make(() => import('sentry/views/settings/organizationProjects'))}
  705. />
  706. <Route path="api-keys/" name={t('API Key')}>
  707. <IndexRoute
  708. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  709. />
  710. <Route
  711. path=":apiKey/"
  712. name={t('Details')}
  713. component={make(
  714. () =>
  715. import(
  716. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  717. )
  718. )}
  719. />
  720. </Route>
  721. <Route
  722. path="audit-log/"
  723. name={t('Audit Log')}
  724. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  725. />
  726. <Route
  727. path="auth/"
  728. name={t('Auth Providers')}
  729. component={make(() => import('sentry/views/settings/organizationAuth'))}
  730. />
  731. <Redirect from="members/requests" to="members/" />
  732. <Route path="members/" name={t('Members')}>
  733. <Route
  734. component={make(
  735. () =>
  736. import(
  737. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  738. )
  739. )}
  740. >
  741. <IndexRoute
  742. component={make(
  743. () =>
  744. import(
  745. 'sentry/views/settings/organizationMembers/organizationMembersList'
  746. )
  747. )}
  748. />
  749. </Route>
  750. <Route
  751. path=":memberId/"
  752. name={t('Details')}
  753. component={make(
  754. () =>
  755. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  756. )}
  757. />
  758. </Route>
  759. <Route
  760. path="rate-limits/"
  761. name={t('Rate Limits')}
  762. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  763. />
  764. <Route
  765. path="relay/"
  766. name={t('Relay')}
  767. component={make(() => import('sentry/views/settings/organizationRelay'))}
  768. />
  769. <Route
  770. path="repos/"
  771. name={t('Repositories')}
  772. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  773. />
  774. <Route
  775. path="settings/"
  776. component={make(
  777. () => import('sentry/views/settings/organizationGeneralSettings')
  778. )}
  779. />
  780. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  781. <IndexRoute
  782. component={make(
  783. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  784. )}
  785. />
  786. <Route
  787. path="advanced-data-scrubbing/:scrubbingId/"
  788. component={make(
  789. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  790. )}
  791. />
  792. </Route>
  793. <Route path="teams/" name={t('Teams')}>
  794. <IndexRoute
  795. component={make(() => import('sentry/views/settings/organizationTeams'))}
  796. />
  797. <Route
  798. path=":teamId/"
  799. name={t('Team')}
  800. component={make(
  801. () => import('sentry/views/settings/organizationTeams/teamDetails')
  802. )}
  803. >
  804. <IndexRedirect to="members/" />
  805. <Route
  806. path="members/"
  807. name={t('Members')}
  808. component={make(
  809. () => import('sentry/views/settings/organizationTeams/teamMembers')
  810. )}
  811. />
  812. <Route
  813. path="notifications/"
  814. name={t('Notifications')}
  815. component={make(
  816. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  817. )}
  818. />
  819. <Route
  820. path="projects/"
  821. name={t('Projects')}
  822. component={make(
  823. () => import('sentry/views/settings/organizationTeams/teamProjects')
  824. )}
  825. />
  826. <Route
  827. path="settings/"
  828. name={t('Settings')}
  829. component={make(
  830. () => import('sentry/views/settings/organizationTeams/teamSettings')
  831. )}
  832. />
  833. </Route>
  834. </Route>
  835. <Redirect from="plugins/" to="integrations/" />
  836. <Route path="plugins/" name={t('Integrations')}>
  837. <Route
  838. path=":integrationSlug/"
  839. name={t('Integration Details')}
  840. component={make(
  841. () =>
  842. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  843. )}
  844. />
  845. </Route>
  846. <Redirect from="sentry-apps/" to="integrations/" />
  847. <Route path="sentry-apps/" name={t('Integrations')}>
  848. <Route
  849. path=":integrationSlug"
  850. name={t('Details')}
  851. component={make(
  852. () =>
  853. import(
  854. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  855. )
  856. )}
  857. />
  858. </Route>
  859. <Redirect from="document-integrations/" to="integrations/" />
  860. <Route path="document-integrations/" name={t('Integrations')}>
  861. <Route
  862. path=":integrationSlug"
  863. name={t('Details')}
  864. component={make(
  865. () =>
  866. import(
  867. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  868. )
  869. )}
  870. />
  871. </Route>
  872. <Route path="integrations/" name={t('Integrations')}>
  873. <IndexRoute
  874. component={make(
  875. () =>
  876. import(
  877. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  878. )
  879. )}
  880. />
  881. <Route
  882. path=":integrationSlug"
  883. name={t('Integration Details')}
  884. component={make(
  885. () =>
  886. import(
  887. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  888. )
  889. )}
  890. />
  891. <Route
  892. path=":providerKey/:integrationId/"
  893. name={t('Configure Integration')}
  894. component={make(
  895. () =>
  896. import(
  897. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  898. )
  899. )}
  900. />
  901. </Route>
  902. <Route path="developer-settings/" name={t('Custom Integrations')}>
  903. <IndexRoute
  904. component={make(
  905. () => import('sentry/views/settings/organizationDeveloperSettings')
  906. )}
  907. />
  908. <Route
  909. path="new-public/"
  910. name={t('Create Integration')}
  911. component={make(
  912. () =>
  913. import(
  914. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  915. )
  916. )}
  917. />
  918. <Route
  919. path="new-internal/"
  920. name={t('Create Integration')}
  921. component={make(
  922. () =>
  923. import(
  924. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  925. )
  926. )}
  927. />
  928. <Route
  929. path=":appSlug/"
  930. name={t('Edit Integration')}
  931. component={make(
  932. () =>
  933. import(
  934. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  935. )
  936. )}
  937. />
  938. <Route
  939. path=":appSlug/dashboard/"
  940. name={t('Integration Dashboard')}
  941. component={make(
  942. () =>
  943. import(
  944. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  945. )
  946. )}
  947. />
  948. </Route>
  949. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  950. <IndexRoute
  951. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  952. />
  953. <Route
  954. path="new-token/"
  955. name={t('Create New Auth Token')}
  956. component={make(
  957. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  958. )}
  959. />
  960. <Route
  961. path=":tokenId/"
  962. name={t('Edit Auth Token')}
  963. component={make(
  964. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  965. )}
  966. />
  967. </Route>
  968. <Route
  969. path="early-features/"
  970. name={t('Early Features')}
  971. component={make(() => import('sentry/views/settings/earlyFeatures'))}
  972. />
  973. </Route>
  974. );
  975. const legacySettingsRedirects = (
  976. <Fragment>
  977. <Redirect from=":projectId/" to="projects/:projectId/" />
  978. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  979. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  980. <Redirect
  981. from=":projectId/alerts/rules/:ruleId/"
  982. to="projects/:projectId/alerts/rules/:ruleId/"
  983. />
  984. </Fragment>
  985. );
  986. const settingsRoutes = (
  987. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  988. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  989. {accountSettingsRoutes}
  990. <Fragment>
  991. {USING_CUSTOMER_DOMAIN && (
  992. <Route
  993. name={t('Organization')}
  994. component={withDomainRequired(NoOp)}
  995. key="orgless-settings-route"
  996. >
  997. {orgSettingsRoutes}
  998. {projectSettingsRoutes}
  999. </Route>
  1000. )}
  1001. <Route
  1002. path=":orgId/"
  1003. name={t('Organization')}
  1004. component={withDomainRedirect(NoOp)}
  1005. key="org-settings"
  1006. >
  1007. {orgSettingsRoutes}
  1008. {projectSettingsRoutes}
  1009. {legacySettingsRedirects}
  1010. </Route>
  1011. </Fragment>
  1012. </Route>
  1013. );
  1014. const projectsRoutes = (
  1015. <Route
  1016. path="/projects/"
  1017. component={make(() => import('sentry/views/projects/'))}
  1018. withOrgPath
  1019. >
  1020. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1021. <Route
  1022. path="new/"
  1023. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1024. />
  1025. <Route
  1026. path=":projectId/"
  1027. component={make(() => import('sentry/views/projectDetail'))}
  1028. />
  1029. <Route
  1030. path=":projectId/events/:eventId/"
  1031. component={errorHandler(ProjectEventRedirect)}
  1032. />
  1033. <Route
  1034. path=":projectId/getting-started/"
  1035. component={make(
  1036. () => import('sentry/views/projectInstall/platformOrIntegration')
  1037. )}
  1038. />
  1039. </Route>
  1040. );
  1041. const dashboardRoutes = (
  1042. <Fragment>
  1043. <Fragment>
  1044. {USING_CUSTOMER_DOMAIN && (
  1045. <Route
  1046. path="/dashboards/"
  1047. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1048. key="orgless-dashboards-route"
  1049. >
  1050. <IndexRoute
  1051. component={make(() => import('sentry/views/dashboards/manage'))}
  1052. />
  1053. </Route>
  1054. )}
  1055. <Route
  1056. path="/organizations/:orgId/dashboards/"
  1057. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1058. key="org-dashboards"
  1059. >
  1060. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1061. </Route>
  1062. </Fragment>
  1063. <Fragment>
  1064. {USING_CUSTOMER_DOMAIN && (
  1065. <Route
  1066. path="/dashboards/new/"
  1067. component={withDomainRequired(
  1068. make(() => import('sentry/views/dashboards/create'))
  1069. )}
  1070. key="orgless-dashboards-new-route"
  1071. >
  1072. <Route
  1073. path="widget/:widgetIndex/edit/"
  1074. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1075. />
  1076. <Route
  1077. path="widget/new/"
  1078. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1079. />
  1080. </Route>
  1081. )}
  1082. <Route
  1083. path="/organizations/:orgId/dashboards/new/"
  1084. component={withDomainRedirect(
  1085. make(() => import('sentry/views/dashboards/create'))
  1086. )}
  1087. key="org-dashboards-new"
  1088. >
  1089. <Route
  1090. path="widget/:widgetIndex/edit/"
  1091. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1092. />
  1093. <Route
  1094. path="widget/new/"
  1095. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1096. />
  1097. </Route>
  1098. </Fragment>
  1099. <Fragment>
  1100. {USING_CUSTOMER_DOMAIN && (
  1101. <Route
  1102. path="/dashboards/new/:templateId"
  1103. component={withDomainRequired(
  1104. make(() => import('sentry/views/dashboards/create'))
  1105. )}
  1106. key="orgless-dashboards-new-template-route"
  1107. >
  1108. <Route
  1109. path="widget/:widgetId/"
  1110. component={make(() => import('sentry/views/dashboards/create'))}
  1111. />
  1112. </Route>
  1113. )}
  1114. <Route
  1115. path="/organizations/:orgId/dashboards/new/:templateId"
  1116. component={withDomainRedirect(
  1117. make(() => import('sentry/views/dashboards/create'))
  1118. )}
  1119. key="org-dashboards-new-template"
  1120. >
  1121. <Route
  1122. path="widget/:widgetId/"
  1123. component={make(() => import('sentry/views/dashboards/create'))}
  1124. />
  1125. </Route>
  1126. </Fragment>
  1127. <Redirect
  1128. from="/organizations/:orgId/dashboards/:dashboardId/"
  1129. to="/organizations/:orgId/dashboard/:dashboardId/"
  1130. />
  1131. {USING_CUSTOMER_DOMAIN && (
  1132. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1133. )}
  1134. <Route
  1135. path="/dashboard/:dashboardId/"
  1136. component={make(() => import('sentry/views/dashboards/view'))}
  1137. withOrgPath
  1138. >
  1139. <Route
  1140. path="widget/:widgetIndex/edit/"
  1141. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1142. />
  1143. <Route
  1144. path="widget/new/"
  1145. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1146. />
  1147. <Route
  1148. path="widget/:widgetId/"
  1149. component={make(() => import('sentry/views/dashboards/view'))}
  1150. />
  1151. </Route>
  1152. </Fragment>
  1153. );
  1154. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1155. // ALERT CHILD ROUTES
  1156. return (
  1157. <Fragment>
  1158. <IndexRoute
  1159. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1160. />
  1161. <Route path="rules/">
  1162. <IndexRoute
  1163. component={make(
  1164. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1165. )}
  1166. />
  1167. <Route
  1168. path="details/:ruleId/"
  1169. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1170. />
  1171. <Route
  1172. path=":projectId/"
  1173. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1174. >
  1175. <IndexRedirect
  1176. to={
  1177. forCustomerDomain
  1178. ? '/alerts/rules/'
  1179. : '/organizations/:orgId/alerts/rules/'
  1180. }
  1181. />
  1182. <Route
  1183. path=":ruleId/"
  1184. component={make(() => import('sentry/views/alerts/edit'))}
  1185. />
  1186. </Route>
  1187. <Route path=":projectId/:ruleId/details/">
  1188. <IndexRoute
  1189. component={make(
  1190. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1191. )}
  1192. />
  1193. </Route>
  1194. </Route>
  1195. <Route path="metric-rules/">
  1196. <IndexRedirect
  1197. to={
  1198. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1199. }
  1200. />
  1201. <Route
  1202. path=":projectId/"
  1203. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1204. >
  1205. <IndexRedirect
  1206. to={
  1207. forCustomerDomain
  1208. ? '/alerts/rules/'
  1209. : '/organizations/:orgId/alerts/rules/'
  1210. }
  1211. />
  1212. <Route
  1213. path=":ruleId/"
  1214. component={make(() => import('sentry/views/alerts/edit'))}
  1215. />
  1216. </Route>
  1217. </Route>
  1218. <Route
  1219. path="wizard/"
  1220. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1221. >
  1222. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1223. </Route>
  1224. <Route
  1225. path="new/"
  1226. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1227. >
  1228. <IndexRedirect
  1229. to={
  1230. forCustomerDomain
  1231. ? '/alerts/wizard/'
  1232. : '/organizations/:orgId/alerts/wizard/'
  1233. }
  1234. />
  1235. <Route
  1236. path=":alertType/"
  1237. component={make(() => import('sentry/views/alerts/create'))}
  1238. />
  1239. </Route>
  1240. <Route
  1241. path=":alertId/"
  1242. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1243. />
  1244. <Route
  1245. path=":projectId/"
  1246. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1247. >
  1248. <Route
  1249. path="new/"
  1250. component={make(() => import('sentry/views/alerts/create'))}
  1251. />
  1252. <Route
  1253. path="wizard/"
  1254. component={make(() => import('sentry/views/alerts/wizard'))}
  1255. />
  1256. </Route>
  1257. </Fragment>
  1258. );
  1259. };
  1260. // ALERT ROUTES
  1261. const alertRoutes = (
  1262. <Fragment>
  1263. {USING_CUSTOMER_DOMAIN && (
  1264. <Route
  1265. path="/alerts/"
  1266. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1267. key="orgless-alerts-route"
  1268. >
  1269. {alertChildRoutes({forCustomerDomain: true})}
  1270. </Route>
  1271. )}
  1272. <Route
  1273. path="/organizations/:orgId/alerts/"
  1274. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1275. key="org-alerts"
  1276. >
  1277. {alertChildRoutes({forCustomerDomain: false})}
  1278. </Route>
  1279. </Fragment>
  1280. );
  1281. const cronsRoutes = (
  1282. <Route
  1283. path="/crons/"
  1284. component={make(() => import('sentry/views/monitors'))}
  1285. withOrgPath
  1286. >
  1287. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1288. <Route
  1289. path="create/"
  1290. component={make(() => import('sentry/views/monitors/create'))}
  1291. />
  1292. <Redirect from=":monitorSlug/" to="/crons/" />
  1293. <Redirect from=":monitorSlug/edit/" to="/crons/" />
  1294. <Route
  1295. path=":projectId/:monitorSlug/"
  1296. component={make(() => import('sentry/views/monitors/details'))}
  1297. />
  1298. <Route
  1299. path=":projectId/:monitorSlug/edit/"
  1300. component={make(() => import('sentry/views/monitors/edit'))}
  1301. />
  1302. </Route>
  1303. );
  1304. const replayRoutes = (
  1305. <Route
  1306. path="/replays/"
  1307. component={make(() => import('sentry/views/replays/index'))}
  1308. withOrgPath
  1309. >
  1310. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1311. <Route
  1312. path="selectors/"
  1313. component={make(
  1314. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1315. )}
  1316. />
  1317. <Route
  1318. path=":replaySlug/"
  1319. component={make(() => import('sentry/views/replays/details'))}
  1320. />
  1321. </Route>
  1322. );
  1323. const releasesRoutes = (
  1324. <Fragment>
  1325. <Route path="/releases/" withOrgPath>
  1326. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1327. <Route
  1328. path=":release/"
  1329. component={make(() => import('sentry/views/releases/detail'))}
  1330. >
  1331. <IndexRoute
  1332. component={make(() => import('sentry/views/releases/detail/overview'))}
  1333. />
  1334. <Route
  1335. path="commits/"
  1336. component={make(
  1337. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1338. )}
  1339. />
  1340. <Route
  1341. path="files-changed/"
  1342. component={make(
  1343. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1344. )}
  1345. />
  1346. </Route>
  1347. </Route>
  1348. <Redirect
  1349. from="/releases/new-events/"
  1350. to="/organizations/:orgId/releases/:release/"
  1351. />
  1352. <Redirect
  1353. from="/releases/all-events/"
  1354. to="/organizations/:orgId/releases/:release/"
  1355. />
  1356. </Fragment>
  1357. );
  1358. const activityRoutes = (
  1359. <Route
  1360. path="/activity/"
  1361. component={make(() => import('sentry/views/organizationActivity'))}
  1362. withOrgPath
  1363. />
  1364. );
  1365. const statsRoutes = (
  1366. <Fragment>
  1367. <Route path="/stats/" withOrgPath>
  1368. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1369. <Route
  1370. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1371. >
  1372. <Route
  1373. path="issues/"
  1374. component={make(
  1375. () => import('sentry/views/organizationStats/teamInsights/issues')
  1376. )}
  1377. />
  1378. <Route
  1379. path="health/"
  1380. component={make(
  1381. () => import('sentry/views/organizationStats/teamInsights/health')
  1382. )}
  1383. />
  1384. </Route>
  1385. </Route>
  1386. <Redirect
  1387. from="/organizations/:orgId/stats/team/"
  1388. to="/organizations/:orgId/stats/issues/"
  1389. />
  1390. </Fragment>
  1391. );
  1392. // TODO(mark) Long term this /queries route should go away and /discover
  1393. // should be the canonical route for discover2. We have a redirect right now
  1394. // as /discover was for discover 1 and most of the application is linking to
  1395. // /discover/queries and not /discover
  1396. const discoverRoutes = (
  1397. <Route
  1398. path="/discover/"
  1399. component={make(() => import('sentry/views/discover'))}
  1400. withOrgPath
  1401. >
  1402. <IndexRedirect to="queries/" />
  1403. <Route
  1404. path="homepage/"
  1405. component={make(() => import('sentry/views/discover/homepage'))}
  1406. />
  1407. <Route
  1408. path="queries/"
  1409. component={make(() => import('sentry/views/discover/landing'))}
  1410. />
  1411. <Route
  1412. path="results/"
  1413. component={make(() => import('sentry/views/discover/results'))}
  1414. />
  1415. <Route
  1416. path=":eventSlug/"
  1417. component={make(() => import('sentry/views/discover/eventDetails'))}
  1418. />
  1419. </Route>
  1420. );
  1421. const llmMonitoringRedirects = USING_CUSTOMER_DOMAIN ? (
  1422. <Redirect
  1423. from="/llm-monitoring/"
  1424. to={`/insights/${MODULE_BASE_URLS[ModuleName.AI]}/`}
  1425. />
  1426. ) : (
  1427. <Redirect
  1428. from="/organizations/:orgId/llm-monitoring/"
  1429. to={`/organizations/:orgId/insights/${MODULE_BASE_URLS[ModuleName.AI]}/`}
  1430. />
  1431. );
  1432. const insightsRedirects = Object.values(MODULE_BASE_URLS)
  1433. .map(
  1434. moduleBaseURL =>
  1435. moduleBaseURL && (
  1436. <Redirect
  1437. key={moduleBaseURL}
  1438. from={`${moduleBaseURL}`}
  1439. to={`/insights/${moduleBaseURL}/`}
  1440. />
  1441. )
  1442. )
  1443. .filter(Boolean);
  1444. const insightsRoutes = (
  1445. <Route path="/insights/" withOrgPath>
  1446. <Route path={`${MODULE_BASE_URLS[ModuleName.DB]}/`}>
  1447. <IndexRoute
  1448. component={make(
  1449. () => import('sentry/views/performance/database/databaseLandingPage')
  1450. )}
  1451. />
  1452. <Route
  1453. path="spans/span/:groupId/"
  1454. component={make(
  1455. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1456. )}
  1457. />
  1458. </Route>
  1459. <Route path={`${MODULE_BASE_URLS[ModuleName.HTTP]}/`}>
  1460. <IndexRoute
  1461. component={make(() => import('sentry/views/performance/http/httpLandingPage'))}
  1462. />
  1463. <Route
  1464. path="domains/"
  1465. component={make(
  1466. () => import('sentry/views/performance/http/httpDomainSummaryPage')
  1467. )}
  1468. />
  1469. </Route>
  1470. <Route path={`${MODULE_BASE_URLS[ModuleName.CACHE]}/`}>
  1471. <IndexRoute
  1472. component={make(
  1473. () => import('sentry/views/performance/cache/cacheLandingPage')
  1474. )}
  1475. />
  1476. </Route>
  1477. <Route path={`${MODULE_BASE_URLS[ModuleName.VITAL]}/`}>
  1478. <IndexRoute
  1479. component={make(
  1480. () =>
  1481. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1482. )}
  1483. />
  1484. <Route
  1485. path="overview/"
  1486. component={make(
  1487. () => import('sentry/views/performance/browser/webVitals/pageOverview')
  1488. )}
  1489. />
  1490. </Route>
  1491. <Redirect
  1492. from="browser/resources/"
  1493. to={`${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}
  1494. />
  1495. <Route path={`${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}>
  1496. <IndexRoute
  1497. component={make(
  1498. () => import('sentry/views/performance/browser/resources/index')
  1499. )}
  1500. />
  1501. <Route
  1502. path="spans/span/:groupId/"
  1503. component={make(
  1504. () =>
  1505. import(
  1506. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1507. )
  1508. )}
  1509. />
  1510. </Route>
  1511. <Route path={`${MODULE_BASE_URLS[ModuleName.QUEUE]}/`}>
  1512. <IndexRoute
  1513. component={make(
  1514. () => import('sentry/views/performance/queues/queuesLandingPage')
  1515. )}
  1516. />
  1517. <Route
  1518. path="destination/"
  1519. component={make(
  1520. () =>
  1521. import(
  1522. 'sentry/views/performance/queues/destinationSummary/destinationSummaryPage'
  1523. )
  1524. )}
  1525. />
  1526. </Route>
  1527. <Route path={`${MODULE_BASE_URLS[ModuleName.SCREEN_LOAD]}/`}>
  1528. <IndexRoute
  1529. component={make(() => import('sentry/views/performance/mobile/screenload'))}
  1530. />
  1531. <Route
  1532. path="spans/"
  1533. component={make(
  1534. () => import('sentry/views/performance/mobile/screenload/screenLoadSpans')
  1535. )}
  1536. />
  1537. </Route>
  1538. <Route path={`${MODULE_BASE_URLS[ModuleName.APP_START]}/`}>
  1539. <IndexRoute
  1540. component={make(() => import('sentry/views/performance/mobile/appStarts'))}
  1541. />
  1542. <Route
  1543. path="spans/"
  1544. component={make(
  1545. () => import('sentry/views/performance/mobile/appStarts/screenSummary')
  1546. )}
  1547. />
  1548. </Route>
  1549. <Route path={`${MODULE_BASE_URLS[ModuleName.MOBILE_UI]}/`}>
  1550. <IndexRoute
  1551. component={make(() => import('sentry/views/performance/mobile/ui'))}
  1552. />
  1553. <Route
  1554. path="spans/"
  1555. component={make(
  1556. () => import('sentry/views/performance/mobile/ui/screenSummary')
  1557. )}
  1558. />
  1559. </Route>
  1560. <Route path={`${MODULE_BASE_URLS[ModuleName.AI]}/`}>
  1561. <IndexRoute
  1562. component={make(() => import('sentry/views/llmMonitoring/landing'))}
  1563. />
  1564. <Route
  1565. path="pipeline-type/:groupId/"
  1566. component={make(
  1567. () => import('sentry/views/llmMonitoring/llmMonitoringDetailsPage')
  1568. )}
  1569. />
  1570. </Route>
  1571. </Route>
  1572. );
  1573. const performanceRoutes = (
  1574. <Route
  1575. path="/performance/"
  1576. component={make(() => import('sentry/views/performance'))}
  1577. withOrgPath
  1578. >
  1579. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1580. <Route
  1581. path="trends/"
  1582. component={make(() => import('sentry/views/performance/trends'))}
  1583. />
  1584. <Route path="summary/">
  1585. <IndexRoute
  1586. component={make(
  1587. () =>
  1588. import('sentry/views/performance/transactionSummary/transactionOverview')
  1589. )}
  1590. />
  1591. <Route
  1592. path="replays/"
  1593. component={make(
  1594. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1595. )}
  1596. />
  1597. <Route
  1598. path="vitals/"
  1599. component={make(
  1600. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1601. )}
  1602. />
  1603. <Route
  1604. path="tags/"
  1605. component={make(
  1606. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1607. )}
  1608. />
  1609. <Route
  1610. path="events/"
  1611. component={make(
  1612. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1613. )}
  1614. />
  1615. <Route
  1616. path="anomalies/"
  1617. component={make(
  1618. () =>
  1619. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1620. )}
  1621. />
  1622. <Route
  1623. path="profiles/"
  1624. component={make(
  1625. () =>
  1626. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1627. )}
  1628. />
  1629. <Route
  1630. path="aggregateWaterfall/"
  1631. component={make(
  1632. () =>
  1633. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1634. )}
  1635. />
  1636. <Route path="spans/">
  1637. <IndexRoute
  1638. component={make(
  1639. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1640. )}
  1641. />
  1642. <Route
  1643. path=":spanSlug/"
  1644. component={make(
  1645. () =>
  1646. import(
  1647. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1648. )
  1649. )}
  1650. />
  1651. </Route>
  1652. </Route>
  1653. <Route
  1654. path="vitaldetail/"
  1655. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1656. />
  1657. <Route
  1658. path="trace/:traceSlug/"
  1659. component={make(() => import('sentry/views/performance/traceDetails'))}
  1660. />
  1661. {insightsRedirects}
  1662. <Redirect
  1663. from="browser/resources"
  1664. to={`/insights/${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}
  1665. />
  1666. <Route
  1667. path=":eventSlug/"
  1668. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1669. />
  1670. </Route>
  1671. );
  1672. const tracesRoutes = (
  1673. <Route
  1674. path="/traces/"
  1675. component={make(() => import('sentry/views/traces'))}
  1676. withOrgPath
  1677. />
  1678. );
  1679. const userFeedbackRoutes = (
  1680. <Route
  1681. path="/user-feedback/"
  1682. component={make(() => import('sentry/views/userFeedback'))}
  1683. withOrgPath
  1684. />
  1685. );
  1686. const feedbackv2Routes = (
  1687. <Route
  1688. path="/feedback/"
  1689. component={make(() => import('sentry/views/feedback/index'))}
  1690. withOrgPath
  1691. >
  1692. <IndexRoute
  1693. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1694. />
  1695. </Route>
  1696. );
  1697. const issueListRoutes = (
  1698. <Route path="/issues" component={errorHandler(IssueListContainer)} withOrgPath>
  1699. <IndexRoute component={errorHandler(IssueListOverview)} />
  1700. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1701. </Route>
  1702. );
  1703. // Once org issues is complete, these routes can be nested under
  1704. // /organizations/:orgId/issues
  1705. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1706. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1707. return (
  1708. <Fragment>
  1709. <IndexRoute
  1710. component={hoc(
  1711. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1712. )}
  1713. />
  1714. <Route
  1715. path={TabPaths[Tab.REPLAYS]}
  1716. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1717. />
  1718. <Route
  1719. path={TabPaths[Tab.ACTIVITY]}
  1720. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1721. />
  1722. <Route
  1723. path={TabPaths[Tab.EVENTS]}
  1724. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1725. />
  1726. <Route
  1727. path={TabPaths[Tab.TAGS]}
  1728. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1729. />
  1730. <Route
  1731. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1732. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1733. />
  1734. <Route
  1735. path={TabPaths[Tab.USER_FEEDBACK]}
  1736. component={hoc(
  1737. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1738. )}
  1739. />
  1740. <Route
  1741. path={TabPaths[Tab.ATTACHMENTS]}
  1742. component={hoc(
  1743. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1744. )}
  1745. />
  1746. <Route
  1747. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1748. component={hoc(
  1749. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1750. )}
  1751. />
  1752. <Route
  1753. path={TabPaths[Tab.MERGED]}
  1754. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1755. />
  1756. </Fragment>
  1757. );
  1758. };
  1759. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1760. <Fragment>
  1761. {issueTabs({forCustomerDomain})}
  1762. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1763. {issueTabs({forCustomerDomain})}
  1764. </Route>
  1765. </Fragment>
  1766. );
  1767. const issueDetailsRoutes = (
  1768. <Fragment>
  1769. <Route
  1770. path="/organizations/:orgId/issues/:groupId/"
  1771. component={withDomainRedirect(
  1772. make(() => import('sentry/views/issueDetails/groupDetails'))
  1773. )}
  1774. key="org-issues-group-id"
  1775. >
  1776. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1777. </Route>
  1778. {USING_CUSTOMER_DOMAIN && (
  1779. <Route
  1780. path="/issues/:groupId/"
  1781. component={withDomainRequired(
  1782. make(() => import('sentry/views/issueDetails/groupDetails'))
  1783. )}
  1784. key="orgless-issues-group-id-route"
  1785. >
  1786. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1787. </Route>
  1788. )}
  1789. </Fragment>
  1790. );
  1791. // These are the "manage" pages. For sentry.io, these are _different_ from
  1792. // the SaaS admin routes in getsentry.
  1793. const adminManageRoutes = (
  1794. <Route
  1795. path="/manage/"
  1796. component={make(() => import('sentry/views/admin/adminLayout'))}
  1797. >
  1798. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1799. <Route
  1800. path="buffer/"
  1801. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1802. />
  1803. <Route
  1804. path="relays/"
  1805. component={make(() => import('sentry/views/admin/adminRelays'))}
  1806. />
  1807. <Route
  1808. path="organizations/"
  1809. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1810. />
  1811. <Route
  1812. path="projects/"
  1813. component={make(() => import('sentry/views/admin/adminProjects'))}
  1814. />
  1815. <Route
  1816. path="queue/"
  1817. component={make(() => import('sentry/views/admin/adminQueue'))}
  1818. />
  1819. <Route
  1820. path="quotas/"
  1821. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1822. />
  1823. <Route
  1824. path="settings/"
  1825. component={make(() => import('sentry/views/admin/adminSettings'))}
  1826. />
  1827. <Route path="users/">
  1828. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1829. <Route
  1830. path=":id"
  1831. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1832. />
  1833. </Route>
  1834. <Route
  1835. path="status/mail/"
  1836. component={make(() => import('sentry/views/admin/adminMail'))}
  1837. />
  1838. <Route
  1839. path="status/environment/"
  1840. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1841. />
  1842. <Route
  1843. path="status/packages/"
  1844. component={make(() => import('sentry/views/admin/adminPackages'))}
  1845. />
  1846. <Route
  1847. path="status/warnings/"
  1848. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1849. />
  1850. </Route>
  1851. );
  1852. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1853. // me why we need the OrganizationRoot root container.
  1854. const legacyOrganizationRootRoutes = (
  1855. <Route component={errorHandler(OrganizationRoot)}>
  1856. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1857. <Route path="/organizations/:orgId/">
  1858. {hook('routes:organization')}
  1859. <IndexRedirect to="issues/" />
  1860. <Redirect from="teams/" to="/settings/:orgId/teams/" />
  1861. <Redirect from="teams/your-teams/" to="/settings/:orgId/teams/" />
  1862. <Redirect from="teams/all-teams/" to="/settings/:orgId/teams/" />
  1863. <Redirect from="teams/:teamId/" to="/settings/:orgId/teams/:teamId/" />
  1864. <Redirect
  1865. from="teams/:teamId/members/"
  1866. to="/settings/:orgId/teams/:teamId/members/"
  1867. />
  1868. <Redirect
  1869. from="teams/:teamId/projects/"
  1870. to="/settings/:orgId/teams/:teamId/projects/"
  1871. />
  1872. <Redirect
  1873. from="teams/:teamId/settings/"
  1874. to="/settings/:orgId/teams/:teamId/settings/"
  1875. />
  1876. <Redirect from="settings/" to="/settings/:orgId/" />
  1877. <Redirect from="api-keys/" to="/settings/:orgId/api-keys/" />
  1878. <Redirect from="api-keys/:apiKey/" to="/settings/:orgId/api-keys/:apiKey/" />
  1879. <Redirect from="members/" to="/settings/:orgId/members/" />
  1880. <Redirect from="members/:memberId/" to="/settings/:orgId/members/:memberId/" />
  1881. <Redirect from="rate-limits/" to="/settings/:orgId/rate-limits/" />
  1882. <Redirect from="repos/" to="/settings/:orgId/repos/" />
  1883. </Route>
  1884. </Route>
  1885. );
  1886. const gettingStartedRoutes = (
  1887. <Fragment>
  1888. {USING_CUSTOMER_DOMAIN && (
  1889. <Fragment>
  1890. <Redirect
  1891. from="/getting-started/:projectId/"
  1892. to="/projects/:projectId/getting-started/"
  1893. />
  1894. <Redirect
  1895. from="/getting-started/:projectId/:platform/"
  1896. to="/projects/:projectId/getting-started/"
  1897. />
  1898. </Fragment>
  1899. )}
  1900. <Redirect
  1901. from="/:orgId/:projectId/getting-started/"
  1902. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1903. />
  1904. <Redirect
  1905. from="/:orgId/:projectId/getting-started/:platform/"
  1906. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1907. />
  1908. </Fragment>
  1909. );
  1910. const profilingRoutes = (
  1911. <Route
  1912. path="/profiling/"
  1913. component={make(() => import('sentry/views/profiling'))}
  1914. withOrgPath
  1915. >
  1916. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1917. <Route
  1918. path="summary/:projectId/"
  1919. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1920. />
  1921. <Route
  1922. path="profile/:projectId/differential-flamegraph/"
  1923. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  1924. />
  1925. <Route
  1926. path="profile/:projectId/:eventId/"
  1927. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1928. >
  1929. <Route
  1930. path="flamegraph/"
  1931. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1932. />
  1933. </Route>
  1934. </Route>
  1935. );
  1936. const metricsRoutes = (
  1937. <Fragment>
  1938. <Route
  1939. path="/metrics/"
  1940. component={make(() => import('sentry/views/metrics'))}
  1941. withOrgPath
  1942. >
  1943. <IndexRoute component={make(() => import('sentry/views/metrics/metrics'))} />
  1944. </Route>
  1945. {/* TODO(ddm): fade this out */}
  1946. <Redirect from="/ddm/" to="/metrics/" />
  1947. </Fragment>
  1948. );
  1949. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1950. // canonical URLs.
  1951. //
  1952. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1953. // or do these need to be nested into the OrganizationLayout tree?
  1954. const legacyOrgRedirects = (
  1955. <Route path="/:orgId/:projectId/">
  1956. <IndexRoute
  1957. component={errorHandler(
  1958. redirectDeprecatedProjectRoute(
  1959. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1960. )
  1961. )}
  1962. />
  1963. <Route
  1964. path="issues/"
  1965. component={errorHandler(
  1966. redirectDeprecatedProjectRoute(
  1967. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1968. )
  1969. )}
  1970. />
  1971. <Route
  1972. path="dashboard/"
  1973. component={errorHandler(
  1974. redirectDeprecatedProjectRoute(
  1975. ({orgId, projectId}) =>
  1976. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1977. )
  1978. )}
  1979. />
  1980. <Route
  1981. path="user-feedback/"
  1982. component={errorHandler(
  1983. redirectDeprecatedProjectRoute(
  1984. ({orgId, projectId}) =>
  1985. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1986. )
  1987. )}
  1988. />
  1989. <Route
  1990. path="releases/"
  1991. component={errorHandler(
  1992. redirectDeprecatedProjectRoute(
  1993. ({orgId, projectId}) =>
  1994. `/organizations/${orgId}/releases/?project=${projectId}`
  1995. )
  1996. )}
  1997. />
  1998. <Route
  1999. path="releases/:version/"
  2000. component={errorHandler(
  2001. redirectDeprecatedProjectRoute(
  2002. ({orgId, projectId, router}) =>
  2003. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2004. )
  2005. )}
  2006. />
  2007. <Route
  2008. path="releases/:version/new-events/"
  2009. component={errorHandler(
  2010. redirectDeprecatedProjectRoute(
  2011. ({orgId, projectId, router}) =>
  2012. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2013. )
  2014. )}
  2015. />
  2016. <Route
  2017. path="releases/:version/all-events/"
  2018. component={errorHandler(
  2019. redirectDeprecatedProjectRoute(
  2020. ({orgId, projectId, router}) =>
  2021. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2022. )
  2023. )}
  2024. />
  2025. <Route
  2026. path="releases/:version/commits/"
  2027. component={errorHandler(
  2028. redirectDeprecatedProjectRoute(
  2029. ({orgId, projectId, router}) =>
  2030. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2031. )
  2032. )}
  2033. />
  2034. </Route>
  2035. );
  2036. const organizationRoutes = (
  2037. <Route component={errorHandler(OrganizationLayout)}>
  2038. {settingsRoutes}
  2039. {projectsRoutes}
  2040. {dashboardRoutes}
  2041. {userFeedbackRoutes}
  2042. {feedbackv2Routes}
  2043. {issueListRoutes}
  2044. {issueDetailsRoutes}
  2045. {alertRoutes}
  2046. {cronsRoutes}
  2047. {replayRoutes}
  2048. {releasesRoutes}
  2049. {activityRoutes}
  2050. {statsRoutes}
  2051. {discoverRoutes}
  2052. {performanceRoutes}
  2053. {tracesRoutes}
  2054. {insightsRoutes}
  2055. {llmMonitoringRedirects}
  2056. {profilingRoutes}
  2057. {metricsRoutes}
  2058. {gettingStartedRoutes}
  2059. {adminManageRoutes}
  2060. {legacyOrganizationRootRoutes}
  2061. {legacyOrgRedirects}
  2062. </Route>
  2063. );
  2064. const legacyRedirectRoutes = (
  2065. <Route path="/:orgId/">
  2066. <IndexRedirect to="/organizations/:orgId/" />
  2067. <Route path=":projectId/settings/">
  2068. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2069. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2070. <Redirect
  2071. from="alerts/rules/"
  2072. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2073. />
  2074. <Redirect
  2075. from="alerts/rules/new/"
  2076. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2077. />
  2078. <Redirect
  2079. from="alerts/rules/:ruleId/"
  2080. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2081. />
  2082. <Redirect
  2083. from="environments/"
  2084. to="/settings/:orgId/projects/:projectId/environments/"
  2085. />
  2086. <Redirect
  2087. from="environments/hidden/"
  2088. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2089. />
  2090. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2091. <Redirect
  2092. from="issue-tracking/"
  2093. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2094. />
  2095. <Redirect
  2096. from="release-tracking/"
  2097. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2098. />
  2099. <Redirect
  2100. from="ownership/"
  2101. to="/settings/:orgId/projects/:projectId/ownership/"
  2102. />
  2103. <Redirect
  2104. from="data-forwarding/"
  2105. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2106. />
  2107. <Redirect
  2108. from="debug-symbols/"
  2109. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2110. />
  2111. <Redirect
  2112. from="processing-issues/"
  2113. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2114. />
  2115. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2116. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2117. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2118. <Redirect
  2119. from="keys/:keyId/"
  2120. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2121. />
  2122. <Redirect
  2123. from="user-feedback/"
  2124. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2125. />
  2126. <Redirect
  2127. from="security-headers/"
  2128. to="/settings/:orgId/projects/:projectId/security-headers/"
  2129. />
  2130. <Redirect
  2131. from="security-headers/csp/"
  2132. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2133. />
  2134. <Redirect
  2135. from="security-headers/expect-ct/"
  2136. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2137. />
  2138. <Redirect
  2139. from="security-headers/hpkp/"
  2140. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2141. />
  2142. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2143. <Redirect
  2144. from="plugins/:pluginId/"
  2145. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2146. />
  2147. <Redirect
  2148. from="integrations/:providerKey/"
  2149. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2150. />
  2151. </Route>
  2152. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2153. <Redirect
  2154. from=":projectId/issues/:groupId/"
  2155. to="/organizations/:orgId/issues/:groupId/"
  2156. />
  2157. <Redirect
  2158. from=":projectId/issues/:groupId/events/"
  2159. to="/organizations/:orgId/issues/:groupId/events/"
  2160. />
  2161. <Redirect
  2162. from=":projectId/issues/:groupId/events/:eventId/"
  2163. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2164. />
  2165. <Redirect
  2166. from=":projectId/issues/:groupId/tags/"
  2167. to="/organizations/:orgId/issues/:groupId/tags/"
  2168. />
  2169. <Redirect
  2170. from=":projectId/issues/:groupId/tags/:tagKey/"
  2171. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2172. />
  2173. <Redirect
  2174. from=":projectId/issues/:groupId/feedback/"
  2175. to="/organizations/:orgId/issues/:groupId/feedback/"
  2176. />
  2177. <Redirect
  2178. from=":projectId/issues/:groupId/similar/"
  2179. to="/organizations/:orgId/issues/:groupId/similar/"
  2180. />
  2181. <Redirect
  2182. from=":projectId/issues/:groupId/merged/"
  2183. to="/organizations/:orgId/issues/:groupId/merged/"
  2184. />
  2185. <Route
  2186. path=":projectId/events/:eventId/"
  2187. component={errorHandler(ProjectEventRedirect)}
  2188. />
  2189. </Route>
  2190. );
  2191. const appRoutes = (
  2192. <Route>
  2193. {experimentalSpaRoutes}
  2194. <Route path="/" component={errorHandler(App)}>
  2195. {rootRoutes}
  2196. {organizationRoutes}
  2197. {legacyRedirectRoutes}
  2198. <Route path="*" component={errorHandler(RouteNotFound)} />
  2199. </Route>
  2200. </Route>
  2201. );
  2202. return appRoutes;
  2203. }
  2204. // We load routes both when initializing the SDK (for routing integrations) and
  2205. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2206. export const routes = memoize(buildRoutes);
  2207. // Exported for use in tests.
  2208. export {buildRoutes};
  2209. function NoOp({children}: {children: JSX.Element}) {
  2210. return children;
  2211. }