routes.tsx 80 KB

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