routes.tsx 71 KB

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