routes.tsx 72 KB

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