routes.tsx 72 KB

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