routes.tsx 73 KB

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