routes.tsx 73 KB

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