routes.tsx 73 KB

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