routes.tsx 72 KB

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