routes.tsx 74 KB

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