routes.tsx 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354
  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 path="install/" name={t('Configuration')}>
  658. <IndexRoute
  659. component={make(() => import('sentry/views/projectInstall/overview'))}
  660. />
  661. <Route
  662. path=":platform/"
  663. name={t('Docs')}
  664. component={make(
  665. () => import('sentry/views/projectInstall/platformOrIntegration')
  666. )}
  667. />
  668. </Route>
  669. </Route>
  670. );
  671. const orgSettingsRoutes = (
  672. <Route
  673. component={make(
  674. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  675. )}
  676. >
  677. {hook('routes:organization')}
  678. {!usingCustomerDomain && (
  679. <IndexRoute
  680. name={t('General')}
  681. component={make(
  682. () => import('sentry/views/settings/organizationGeneralSettings')
  683. )}
  684. />
  685. )}
  686. {usingCustomerDomain && (
  687. <Route
  688. path="/settings/organization/"
  689. name={t('General')}
  690. component={make(
  691. () => import('sentry/views/settings/organizationGeneralSettings')
  692. )}
  693. />
  694. )}
  695. <Route
  696. path="projects/"
  697. name={t('Projects')}
  698. component={make(() => import('sentry/views/settings/organizationProjects'))}
  699. />
  700. <Route path="api-keys/" name={t('API Key')}>
  701. <IndexRoute
  702. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  703. />
  704. <Route
  705. path=":apiKey/"
  706. name={t('Details')}
  707. component={make(
  708. () =>
  709. import(
  710. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  711. )
  712. )}
  713. />
  714. </Route>
  715. <Route
  716. path="audit-log/"
  717. name={t('Audit Log')}
  718. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  719. />
  720. <Route
  721. path="auth/"
  722. name={t('Auth Providers')}
  723. component={make(() => import('sentry/views/settings/organizationAuth'))}
  724. />
  725. <Redirect from="members/requests" to="members/" />
  726. <Route path="members/" name={t('Members')}>
  727. <Route
  728. component={make(
  729. () =>
  730. import(
  731. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  732. )
  733. )}
  734. >
  735. <IndexRoute
  736. component={make(
  737. () =>
  738. import(
  739. 'sentry/views/settings/organizationMembers/organizationMembersList'
  740. )
  741. )}
  742. />
  743. </Route>
  744. <Route
  745. path=":memberId/"
  746. name={t('Details')}
  747. component={make(
  748. () =>
  749. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  750. )}
  751. />
  752. </Route>
  753. <Route
  754. path="rate-limits/"
  755. name={t('Rate Limits')}
  756. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  757. />
  758. <Route
  759. path="relay/"
  760. name={t('Relay')}
  761. component={make(() => import('sentry/views/settings/organizationRelay'))}
  762. />
  763. <Route
  764. path="repos/"
  765. name={t('Repositories')}
  766. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  767. />
  768. <Route
  769. path="settings/"
  770. component={make(
  771. () => import('sentry/views/settings/organizationGeneralSettings')
  772. )}
  773. />
  774. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  775. <IndexRoute
  776. component={make(
  777. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  778. )}
  779. />
  780. <Route
  781. path="advanced-data-scrubbing/:scrubbingId/"
  782. component={make(
  783. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  784. )}
  785. />
  786. </Route>
  787. <Route path="teams/" name={t('Teams')}>
  788. <IndexRoute
  789. component={make(() => import('sentry/views/settings/organizationTeams'))}
  790. />
  791. <Route
  792. path=":teamId/"
  793. name={t('Team')}
  794. component={make(
  795. () => import('sentry/views/settings/organizationTeams/teamDetails')
  796. )}
  797. >
  798. <IndexRedirect to="members/" />
  799. <Route
  800. path="members/"
  801. name={t('Members')}
  802. component={make(
  803. () => import('sentry/views/settings/organizationTeams/teamMembers')
  804. )}
  805. />
  806. <Route
  807. path="notifications/"
  808. name={t('Notifications')}
  809. component={make(
  810. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  811. )}
  812. />
  813. <Route
  814. path="projects/"
  815. name={t('Projects')}
  816. component={make(
  817. () => import('sentry/views/settings/organizationTeams/teamProjects')
  818. )}
  819. />
  820. <Route
  821. path="settings/"
  822. name={t('Settings')}
  823. component={make(
  824. () => import('sentry/views/settings/organizationTeams/teamSettings')
  825. )}
  826. />
  827. </Route>
  828. </Route>
  829. <Redirect from="plugins/" to="integrations/" />
  830. <Route path="plugins/" name={t('Integrations')}>
  831. <Route
  832. path=":integrationSlug/"
  833. name={t('Integration Details')}
  834. component={make(
  835. () =>
  836. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  837. )}
  838. />
  839. </Route>
  840. <Redirect from="sentry-apps/" to="integrations/" />
  841. <Route path="sentry-apps/" name={t('Integrations')}>
  842. <Route
  843. path=":integrationSlug"
  844. name={t('Details')}
  845. component={make(
  846. () =>
  847. import(
  848. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  849. )
  850. )}
  851. />
  852. </Route>
  853. <Redirect from="document-integrations/" to="integrations/" />
  854. <Route path="document-integrations/" name={t('Integrations')}>
  855. <Route
  856. path=":integrationSlug"
  857. name={t('Details')}
  858. component={make(
  859. () =>
  860. import(
  861. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  862. )
  863. )}
  864. />
  865. </Route>
  866. <Route path="integrations/" name={t('Integrations')}>
  867. <IndexRoute
  868. component={make(
  869. () =>
  870. import(
  871. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  872. )
  873. )}
  874. />
  875. <Route
  876. path=":integrationSlug"
  877. name={t('Integration Details')}
  878. component={make(
  879. () =>
  880. import(
  881. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  882. )
  883. )}
  884. />
  885. <Route
  886. path=":providerKey/:integrationId/"
  887. name={t('Configure Integration')}
  888. component={make(
  889. () =>
  890. import(
  891. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  892. )
  893. )}
  894. />
  895. </Route>
  896. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  897. <Route path="developer-settings/" name={t('Developer Settings')}>
  898. <IndexRoute
  899. component={make(
  900. () => import('sentry/views/settings/organizationDeveloperSettings')
  901. )}
  902. />
  903. <Route
  904. path="new-public/"
  905. name={t('Create Integration')}
  906. component={make(
  907. () =>
  908. import(
  909. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  910. )
  911. )}
  912. />
  913. <Route
  914. path="new-internal/"
  915. name={t('Create Integration')}
  916. component={make(
  917. () =>
  918. import(
  919. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  920. )
  921. )}
  922. />
  923. <Route
  924. path=":appSlug/"
  925. name={t('Edit Integration')}
  926. component={make(
  927. () =>
  928. import(
  929. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  930. )
  931. )}
  932. />
  933. <Route
  934. path=":appSlug/dashboard/"
  935. name={t('Integration Dashboard')}
  936. component={make(
  937. () =>
  938. import(
  939. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  940. )
  941. )}
  942. />
  943. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  944. <Route
  945. path="new/"
  946. name={t('Create Sentry Function')}
  947. component={make(
  948. () =>
  949. import(
  950. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  951. )
  952. )}
  953. />
  954. <Route
  955. path=":functionSlug/"
  956. name={t('Edit Sentry Function')}
  957. component={make(
  958. () =>
  959. import(
  960. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  961. )
  962. )}
  963. />
  964. </Route>
  965. </Route>
  966. </Route>
  967. );
  968. const legacySettingsRedirects = (
  969. <Fragment>
  970. <Redirect from=":projectId/" to="projects/:projectId/" />
  971. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  972. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  973. <Redirect
  974. from=":projectId/alerts/rules/:ruleId/"
  975. to="projects/:projectId/alerts/rules/:ruleId/"
  976. />
  977. </Fragment>
  978. );
  979. const settingsRoutes = (
  980. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  981. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  982. {accountSettingsRoutes}
  983. <Fragment>
  984. {usingCustomerDomain && (
  985. <Route
  986. name={t('Organization')}
  987. component={withDomainRequired(NoOp)}
  988. key="orgless-settings-route"
  989. >
  990. {orgSettingsRoutes}
  991. {projectSettingsRoutes}
  992. </Route>
  993. )}
  994. <Route
  995. path=":orgId/"
  996. name={t('Organization')}
  997. component={withDomainRedirect(NoOp)}
  998. key="org-settings"
  999. >
  1000. {orgSettingsRoutes}
  1001. {projectSettingsRoutes}
  1002. {legacySettingsRedirects}
  1003. </Route>
  1004. </Fragment>
  1005. </Route>
  1006. );
  1007. const projectsChildRoutes = (
  1008. <Fragment>
  1009. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1010. <Route
  1011. path="new/"
  1012. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1013. />
  1014. <Route
  1015. path=":projectId/getting-started/"
  1016. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1017. >
  1018. <IndexRoute
  1019. component={make(() => import('sentry/views/projectInstall/overview'))}
  1020. />
  1021. <Route
  1022. path=":platform/"
  1023. component={make(
  1024. () => import('sentry/views/projectInstall/platformOrIntegration')
  1025. )}
  1026. />
  1027. </Route>
  1028. <Route
  1029. path=":projectId/"
  1030. component={make(() => import('sentry/views/projectDetail'))}
  1031. />
  1032. <Route
  1033. path=":projectId/events/:eventId/"
  1034. component={errorHandler(ProjectEventRedirect)}
  1035. />
  1036. </Fragment>
  1037. );
  1038. const projectsRoutes = (
  1039. <Fragment>
  1040. {usingCustomerDomain && (
  1041. <Route
  1042. path="/projects/"
  1043. component={withDomainRequired(NoOp)}
  1044. key="orgless-projects-route"
  1045. >
  1046. {projectsChildRoutes}
  1047. </Route>
  1048. )}
  1049. <Route
  1050. path="/organizations/:orgId/projects/"
  1051. component={withDomainRedirect(NoOp)}
  1052. key="org-projects"
  1053. >
  1054. {projectsChildRoutes}
  1055. </Route>
  1056. </Fragment>
  1057. );
  1058. const dashboardWidgetRoutes = (
  1059. <Fragment>
  1060. <Route
  1061. path="widget/:widgetIndex/edit/"
  1062. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1063. />
  1064. <Route
  1065. path="widget/new/"
  1066. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1067. />
  1068. <Route
  1069. path="widget/:widgetId/"
  1070. component={make(() => import('sentry/views/dashboards/view'))}
  1071. />
  1072. </Fragment>
  1073. );
  1074. const dashboardRoutes = (
  1075. <Fragment>
  1076. <Fragment>
  1077. {usingCustomerDomain && (
  1078. <Route
  1079. path="/dashboards/"
  1080. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1081. key="orgless-dashboards-route"
  1082. >
  1083. <IndexRoute
  1084. component={make(() => import('sentry/views/dashboards/manage'))}
  1085. />
  1086. </Route>
  1087. )}
  1088. <Route
  1089. path="/organizations/:orgId/dashboards/"
  1090. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1091. key="org-dashboards"
  1092. >
  1093. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1094. </Route>
  1095. </Fragment>
  1096. <Fragment>
  1097. {usingCustomerDomain && (
  1098. <Route
  1099. path="/dashboards/new/"
  1100. component={withDomainRequired(
  1101. make(() => import('sentry/views/dashboards/create'))
  1102. )}
  1103. key="orgless-dashboards-new-route"
  1104. >
  1105. <Route
  1106. path="widget/:widgetIndex/edit/"
  1107. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1108. />
  1109. <Route
  1110. path="widget/new/"
  1111. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1112. />
  1113. </Route>
  1114. )}
  1115. <Route
  1116. path="/organizations/:orgId/dashboards/new/"
  1117. component={withDomainRedirect(
  1118. make(() => import('sentry/views/dashboards/create'))
  1119. )}
  1120. key="org-dashboards-new"
  1121. >
  1122. <Route
  1123. path="widget/:widgetIndex/edit/"
  1124. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1125. />
  1126. <Route
  1127. path="widget/new/"
  1128. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1129. />
  1130. </Route>
  1131. </Fragment>
  1132. <Fragment>
  1133. {usingCustomerDomain && (
  1134. <Route
  1135. path="/dashboards/new/:templateId"
  1136. component={withDomainRequired(
  1137. make(() => import('sentry/views/dashboards/create'))
  1138. )}
  1139. key="orgless-dashboards-new-template-route"
  1140. >
  1141. <Route
  1142. path="widget/:widgetId/"
  1143. component={make(() => import('sentry/views/dashboards/create'))}
  1144. />
  1145. </Route>
  1146. )}
  1147. <Route
  1148. path="/organizations/:orgId/dashboards/new/:templateId"
  1149. component={withDomainRedirect(
  1150. make(() => import('sentry/views/dashboards/create'))
  1151. )}
  1152. key="org-dashboards-new-template"
  1153. >
  1154. <Route
  1155. path="widget/:widgetId/"
  1156. component={make(() => import('sentry/views/dashboards/create'))}
  1157. />
  1158. </Route>
  1159. </Fragment>
  1160. <Redirect
  1161. from="/organizations/:orgId/dashboards/:dashboardId/"
  1162. to="/organizations/:orgId/dashboard/:dashboardId/"
  1163. />
  1164. {usingCustomerDomain && (
  1165. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1166. )}
  1167. <Fragment>
  1168. {usingCustomerDomain && (
  1169. <Route
  1170. path="/dashboard/:dashboardId/"
  1171. component={withDomainRequired(
  1172. make(() => import('sentry/views/dashboards/view'))
  1173. )}
  1174. key="orgless-dashboards-dashboard-id-route"
  1175. >
  1176. {dashboardWidgetRoutes}
  1177. </Route>
  1178. )}
  1179. <Route
  1180. path="/organizations/:orgId/dashboard/:dashboardId/"
  1181. component={withDomainRedirect(
  1182. make(() => import('sentry/views/dashboards/view'))
  1183. )}
  1184. key="org-dashboards-dashboard-id"
  1185. >
  1186. {dashboardWidgetRoutes}
  1187. </Route>
  1188. </Fragment>
  1189. </Fragment>
  1190. );
  1191. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1192. return (
  1193. <Fragment>
  1194. <IndexRoute
  1195. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1196. />
  1197. <Route path="rules/">
  1198. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  1199. <Route
  1200. path="details/:ruleId/"
  1201. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  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. path=":projectId/:ruleId/details/"
  1221. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  1222. >
  1223. <IndexRoute
  1224. component={make(
  1225. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1226. )}
  1227. />
  1228. </Route>
  1229. </Route>
  1230. <Route path="metric-rules/">
  1231. <IndexRedirect
  1232. to={
  1233. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1234. }
  1235. />
  1236. <Route
  1237. path=":projectId/"
  1238. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1239. >
  1240. <IndexRedirect
  1241. to={
  1242. forCustomerDomain
  1243. ? '/alerts/rules/'
  1244. : '/organizations/:orgId/alerts/rules/'
  1245. }
  1246. />
  1247. <Route
  1248. path=":ruleId/"
  1249. component={make(() => import('sentry/views/alerts/edit'))}
  1250. />
  1251. </Route>
  1252. </Route>
  1253. <Route
  1254. path="wizard/"
  1255. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1256. >
  1257. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1258. </Route>
  1259. <Route
  1260. path="new/"
  1261. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1262. >
  1263. <IndexRedirect
  1264. to={
  1265. forCustomerDomain
  1266. ? '/alerts/wizard/'
  1267. : '/organizations/:orgId/alerts/wizard/'
  1268. }
  1269. />
  1270. <Route
  1271. path=":alertType/"
  1272. component={make(() => import('sentry/views/alerts/create'))}
  1273. />
  1274. </Route>
  1275. <Route
  1276. path=":alertId/"
  1277. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1278. />
  1279. <Route
  1280. path=":projectId/"
  1281. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1282. >
  1283. <Route
  1284. path="new/"
  1285. component={make(() => import('sentry/views/alerts/create'))}
  1286. />
  1287. <Route
  1288. path="wizard/"
  1289. component={make(() => import('sentry/views/alerts/wizard'))}
  1290. />
  1291. </Route>
  1292. </Fragment>
  1293. );
  1294. };
  1295. const alertRoutes = (
  1296. <Fragment>
  1297. {usingCustomerDomain && (
  1298. <Route
  1299. path="/alerts/"
  1300. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1301. key="orgless-alerts-route"
  1302. >
  1303. {alertChildRoutes({forCustomerDomain: true})}
  1304. </Route>
  1305. )}
  1306. <Route
  1307. path="/organizations/:orgId/alerts/"
  1308. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1309. key="org-alerts"
  1310. >
  1311. {alertChildRoutes({forCustomerDomain: false})}
  1312. </Route>
  1313. </Fragment>
  1314. );
  1315. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1316. return (
  1317. <Fragment>
  1318. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1319. <Route
  1320. path={
  1321. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1322. }
  1323. component={make(() => import('sentry/views/monitors/create'))}
  1324. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1325. />
  1326. <Route
  1327. path={
  1328. forCustomerDomain
  1329. ? '/crons/:monitorSlug/'
  1330. : '/organizations/:orgId/crons/:monitorSlug/'
  1331. }
  1332. component={make(() => import('sentry/views/monitors/details'))}
  1333. key={
  1334. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1335. }
  1336. />
  1337. <Route
  1338. path={
  1339. forCustomerDomain
  1340. ? '/crons/:monitorSlug/edit/'
  1341. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1342. }
  1343. component={make(() => import('sentry/views/monitors/edit'))}
  1344. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1345. />
  1346. </Fragment>
  1347. );
  1348. };
  1349. const cronsRoutes = (
  1350. <Fragment>
  1351. {usingCustomerDomain && (
  1352. <Route
  1353. path="/crons/"
  1354. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1355. key="orgless-monitors-route"
  1356. >
  1357. {cronsChildRoutes({forCustomerDomain: true})}
  1358. </Route>
  1359. )}
  1360. <Route
  1361. path="/organizations/:orgId/crons/"
  1362. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1363. key="org-monitors"
  1364. >
  1365. {cronsChildRoutes({forCustomerDomain: false})}
  1366. </Route>
  1367. </Fragment>
  1368. );
  1369. const replayChildRoutes = (
  1370. <Fragment>
  1371. <IndexRoute component={make(() => import('sentry/views/replays/list/container'))} />
  1372. <Route
  1373. path=":replaySlug/"
  1374. component={make(() => import('sentry/views/replays/details'))}
  1375. />
  1376. </Fragment>
  1377. );
  1378. const replayRoutes = (
  1379. <Fragment>
  1380. {usingCustomerDomain && (
  1381. <Route
  1382. path="/replays/"
  1383. component={withDomainRequired(make(() => import('sentry/views/replays')))}
  1384. key="orgless-replays-route"
  1385. >
  1386. {replayChildRoutes}
  1387. </Route>
  1388. )}
  1389. <Route
  1390. path="/organizations/:orgId/replays/"
  1391. component={withDomainRedirect(make(() => import('sentry/views/replays')))}
  1392. key="org-replays"
  1393. >
  1394. {replayChildRoutes}
  1395. </Route>
  1396. </Fragment>
  1397. );
  1398. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1399. return (
  1400. <Fragment>
  1401. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1402. <Route
  1403. path=":release/"
  1404. component={make(() => import('sentry/views/releases/detail'))}
  1405. >
  1406. <IndexRoute
  1407. component={make(() => import('sentry/views/releases/detail/overview'))}
  1408. />
  1409. <Route
  1410. path="commits/"
  1411. component={make(
  1412. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1413. )}
  1414. />
  1415. <Route
  1416. path="files-changed/"
  1417. component={make(
  1418. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1419. )}
  1420. />
  1421. {forCustomerDomain ? null : (
  1422. <Fragment>
  1423. <Redirect
  1424. from="new-events/"
  1425. to="/organizations/:orgId/releases/:release/"
  1426. />
  1427. <Redirect
  1428. from="all-events/"
  1429. to="/organizations/:orgId/releases/:release/"
  1430. />
  1431. </Fragment>
  1432. )}
  1433. </Route>
  1434. </Fragment>
  1435. );
  1436. };
  1437. const releasesRoutes = (
  1438. <Fragment>
  1439. {usingCustomerDomain && (
  1440. <Route
  1441. path="/releases/"
  1442. component={withDomainRequired(NoOp)}
  1443. key="orgless-releases-route"
  1444. >
  1445. {releasesChildRoutes({forCustomerDomain: true})}
  1446. </Route>
  1447. )}
  1448. <Route
  1449. path="/organizations/:orgId/releases/"
  1450. component={withDomainRedirect(NoOp)}
  1451. key="org-releases"
  1452. >
  1453. {releasesChildRoutes({forCustomerDomain: false})}
  1454. </Route>
  1455. </Fragment>
  1456. );
  1457. const activityRoutes = (
  1458. <Fragment>
  1459. {usingCustomerDomain && (
  1460. <Route
  1461. path="/activity/"
  1462. component={withDomainRequired(
  1463. make(() => import('sentry/views/organizationActivity'))
  1464. )}
  1465. key="orgless-activity-route"
  1466. />
  1467. )}
  1468. <Route
  1469. path="/organizations/:orgId/activity/"
  1470. component={withDomainRedirect(
  1471. make(() => import('sentry/views/organizationActivity'))
  1472. )}
  1473. key="org-activity"
  1474. />
  1475. </Fragment>
  1476. );
  1477. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1478. return (
  1479. <Fragment>
  1480. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1481. <Route
  1482. path="issues/"
  1483. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1484. >
  1485. <IndexRoute
  1486. component={make(
  1487. () => import('sentry/views/organizationStats/teamInsights/issues')
  1488. )}
  1489. />
  1490. </Route>
  1491. <Route
  1492. path="health/"
  1493. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1494. >
  1495. <IndexRoute
  1496. component={make(
  1497. () => import('sentry/views/organizationStats/teamInsights/health')
  1498. )}
  1499. />
  1500. </Route>
  1501. {forCustomerDomain ? null : (
  1502. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1503. )}
  1504. </Fragment>
  1505. );
  1506. };
  1507. const statsRoutes = (
  1508. <Fragment>
  1509. {usingCustomerDomain && (
  1510. <Route
  1511. path="/stats/"
  1512. component={withDomainRequired(NoOp)}
  1513. key="orgless-stats-route"
  1514. >
  1515. {statsChildRoutes({forCustomerDomain: true})}
  1516. </Route>
  1517. )}
  1518. <Route
  1519. path="/organizations/:orgId/stats/"
  1520. component={withDomainRedirect(NoOp)}
  1521. key="org-stats"
  1522. >
  1523. {statsChildRoutes({forCustomerDomain: false})}
  1524. </Route>
  1525. </Fragment>
  1526. );
  1527. // TODO(mark) Long term this /queries route should go away and /discover
  1528. // should be the canonical route for discover2. We have a redirect right now
  1529. // as /discover was for discover 1 and most of the application is linking to
  1530. // /discover/queries and not /discover
  1531. const discoverChildRoutes = (
  1532. <Fragment>
  1533. <IndexRedirect to="queries/" />
  1534. <Route
  1535. path="homepage/"
  1536. component={make(() => import('sentry/views/discover/homepage'))}
  1537. />
  1538. <Route
  1539. path="queries/"
  1540. component={make(() => import('sentry/views/discover/landing'))}
  1541. />
  1542. <Route
  1543. path="results/"
  1544. component={make(() => import('sentry/views/discover/results'))}
  1545. />
  1546. <Route
  1547. path=":eventSlug/"
  1548. component={make(() => import('sentry/views/discover/eventDetails'))}
  1549. />
  1550. </Fragment>
  1551. );
  1552. const discoverRoutes = (
  1553. <Fragment>
  1554. {usingCustomerDomain && (
  1555. <Route
  1556. path="/discover/"
  1557. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1558. key="orgless-discover-route"
  1559. >
  1560. {discoverChildRoutes}
  1561. </Route>
  1562. )}
  1563. <Route
  1564. path="/organizations/:orgId/discover/"
  1565. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1566. key="org-discover-route"
  1567. >
  1568. {discoverChildRoutes}
  1569. </Route>
  1570. </Fragment>
  1571. );
  1572. const performanceChildRoutes = (
  1573. <Fragment>
  1574. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1575. <Route
  1576. path="trends/"
  1577. component={make(() => import('sentry/views/performance/trends'))}
  1578. />
  1579. <Route path="summary/">
  1580. <IndexRoute
  1581. component={make(
  1582. () =>
  1583. import('sentry/views/performance/transactionSummary/transactionOverview')
  1584. )}
  1585. />
  1586. <Route
  1587. path="replays/"
  1588. component={make(
  1589. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1590. )}
  1591. />
  1592. <Route
  1593. path="vitals/"
  1594. component={make(
  1595. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1596. )}
  1597. />
  1598. <Route
  1599. path="tags/"
  1600. component={make(
  1601. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1602. )}
  1603. />
  1604. <Route
  1605. path="events/"
  1606. component={make(
  1607. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1608. )}
  1609. />
  1610. <Route
  1611. path="anomalies/"
  1612. component={make(
  1613. () =>
  1614. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1615. )}
  1616. />
  1617. <Route
  1618. path="profiles/"
  1619. component={make(
  1620. () =>
  1621. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1622. )}
  1623. />
  1624. <Route path="spans/">
  1625. <IndexRoute
  1626. component={make(
  1627. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1628. )}
  1629. />
  1630. <Route
  1631. path=":spanSlug/"
  1632. component={make(
  1633. () =>
  1634. import(
  1635. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1636. )
  1637. )}
  1638. />
  1639. </Route>
  1640. </Route>
  1641. <Route
  1642. path="vitaldetail/"
  1643. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1644. />
  1645. <Route
  1646. path="trace/:traceSlug/"
  1647. component={make(() => import('sentry/views/performance/traceDetails'))}
  1648. />
  1649. <Route
  1650. path=":eventSlug/"
  1651. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1652. />
  1653. </Fragment>
  1654. );
  1655. const performanceRoutes = (
  1656. <Fragment>
  1657. {usingCustomerDomain && (
  1658. <Route
  1659. path="/performance/"
  1660. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1661. key="orgless-performance-route"
  1662. >
  1663. {performanceChildRoutes}
  1664. </Route>
  1665. )}
  1666. <Route
  1667. path="/organizations/:orgId/performance/"
  1668. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1669. key="org-performance"
  1670. >
  1671. {performanceChildRoutes}
  1672. </Route>
  1673. </Fragment>
  1674. );
  1675. const starfishChildRoutes = (
  1676. <Fragment>
  1677. <IndexRoute
  1678. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1679. />
  1680. <Route
  1681. path="failure-detail/:slug/"
  1682. component={make(
  1683. () => import('sentry/views/starfish/views/webServiceView/endpointFailureEvents')
  1684. )}
  1685. />
  1686. <Route
  1687. path="endpoint-overview/"
  1688. component={make(
  1689. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1690. )}
  1691. />
  1692. <Route
  1693. path="database/"
  1694. component={make(() => import('sentry/views/starfish/modules/databaseModule'))}
  1695. />
  1696. <Route
  1697. path="api/"
  1698. component={make(() => import('sentry/views/starfish/modules/APIModule'))}
  1699. />
  1700. <Route
  1701. path="spans/"
  1702. component={make(() => import('sentry/views/starfish/views/spans'))}
  1703. />
  1704. <Route
  1705. path="span/:groupId/"
  1706. component={make(() => import('sentry/views/starfish/views/spanSummary'))}
  1707. />
  1708. </Fragment>
  1709. );
  1710. const starfishRoutes = (
  1711. <Fragment>
  1712. {usingCustomerDomain && (
  1713. <Route
  1714. path="/starfish/"
  1715. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1716. key="orgless-starfish-route"
  1717. >
  1718. {starfishChildRoutes}
  1719. </Route>
  1720. )}
  1721. <Route
  1722. path="/organizations/:orgId/starfish/"
  1723. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1724. key="org-starfish"
  1725. >
  1726. {starfishChildRoutes}
  1727. </Route>
  1728. </Fragment>
  1729. );
  1730. const userFeedbackRoutes = (
  1731. <Fragment>
  1732. {usingCustomerDomain && (
  1733. <Route
  1734. path="/user-feedback/"
  1735. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1736. key="orgless-user-feedback-route"
  1737. />
  1738. )}
  1739. <Route
  1740. path="/organizations/:orgId/user-feedback/"
  1741. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1742. key="org-user-feedback"
  1743. />
  1744. </Fragment>
  1745. );
  1746. const issueListRoutes = (
  1747. <Fragment>
  1748. {usingCustomerDomain && (
  1749. <Route
  1750. path="/issues/(searches/:searchId/)"
  1751. component={withDomainRequired(errorHandler(IssueListContainer))}
  1752. key="orgless-issues-route"
  1753. >
  1754. <IndexRoute component={errorHandler(IssueListOverview)} />
  1755. </Route>
  1756. )}
  1757. <Route
  1758. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1759. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1760. key="org-issues"
  1761. >
  1762. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1763. <IndexRoute component={errorHandler(IssueListOverview)} />
  1764. </Route>
  1765. </Fragment>
  1766. );
  1767. // Once org issues is complete, these routes can be nested under
  1768. // /organizations/:orgId/issues
  1769. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1770. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1771. return (
  1772. <Fragment>
  1773. <IndexRoute
  1774. component={hoc(
  1775. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1776. )}
  1777. />
  1778. <Route
  1779. path={TabPaths[Tab.REPLAYS]}
  1780. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1781. />
  1782. <Route
  1783. path={TabPaths[Tab.ACTIVITY]}
  1784. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1785. />
  1786. <Route
  1787. path={TabPaths[Tab.EVENTS]}
  1788. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1789. />
  1790. <Route
  1791. path={TabPaths[Tab.TAGS]}
  1792. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1793. />
  1794. <Route
  1795. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1796. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1797. />
  1798. <Route
  1799. path={TabPaths[Tab.USER_FEEDBACK]}
  1800. component={hoc(
  1801. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1802. )}
  1803. />
  1804. <Route
  1805. path={TabPaths[Tab.ATTACHMENTS]}
  1806. component={hoc(
  1807. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1808. )}
  1809. />
  1810. <Route
  1811. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1812. component={hoc(
  1813. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1814. )}
  1815. />
  1816. <Route
  1817. path={TabPaths[Tab.MERGED]}
  1818. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1819. />
  1820. <Route
  1821. path={TabPaths[Tab.GROUPING]}
  1822. component={hoc(make(() => import('sentry/views/issueDetails/grouping')))}
  1823. />
  1824. </Fragment>
  1825. );
  1826. };
  1827. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1828. <Fragment>
  1829. {issueTabs({forCustomerDomain})}
  1830. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1831. {issueTabs({forCustomerDomain})}
  1832. </Route>
  1833. </Fragment>
  1834. );
  1835. const issueDetailsRoutes = (
  1836. <Fragment>
  1837. <Route
  1838. path="/organizations/:orgId/issues/:groupId/"
  1839. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1840. key="org-issues-group-id"
  1841. >
  1842. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1843. </Route>
  1844. {usingCustomerDomain && (
  1845. <Route
  1846. path="/issues/:groupId/"
  1847. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1848. key="orgless-issues-group-id-route"
  1849. >
  1850. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1851. </Route>
  1852. )}
  1853. </Fragment>
  1854. );
  1855. // These are the "manage" pages. For sentry.io, these are _different_ from
  1856. // the SaaS admin routes in getsentry.
  1857. const adminManageRoutes = (
  1858. <Route
  1859. path="/manage/"
  1860. component={make(() => import('sentry/views/admin/adminLayout'))}
  1861. >
  1862. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1863. <Route
  1864. path="buffer/"
  1865. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1866. />
  1867. <Route
  1868. path="relays/"
  1869. component={make(() => import('sentry/views/admin/adminRelays'))}
  1870. />
  1871. <Route
  1872. path="organizations/"
  1873. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1874. />
  1875. <Route
  1876. path="projects/"
  1877. component={make(() => import('sentry/views/admin/adminProjects'))}
  1878. />
  1879. <Route
  1880. path="queue/"
  1881. component={make(() => import('sentry/views/admin/adminQueue'))}
  1882. />
  1883. <Route
  1884. path="quotas/"
  1885. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1886. />
  1887. <Route
  1888. path="settings/"
  1889. component={make(() => import('sentry/views/admin/adminSettings'))}
  1890. />
  1891. <Route path="users/">
  1892. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1893. <Route
  1894. path=":id"
  1895. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1896. />
  1897. </Route>
  1898. <Route
  1899. path="status/mail/"
  1900. component={make(() => import('sentry/views/admin/adminMail'))}
  1901. />
  1902. <Route
  1903. path="status/environment/"
  1904. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1905. />
  1906. <Route
  1907. path="status/packages/"
  1908. component={make(() => import('sentry/views/admin/adminPackages'))}
  1909. />
  1910. <Route
  1911. path="status/warnings/"
  1912. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1913. />
  1914. </Route>
  1915. );
  1916. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1917. // me why we need the OrganizationRoot root container.
  1918. const legacyOrganizationRootRoutes = (
  1919. <Route component={errorHandler(OrganizationRoot)}>
  1920. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1921. <Route path="/organizations/:orgId/">
  1922. {hook('routes:organization')}
  1923. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1924. <Redirect
  1925. from="/organizations/:orgId/teams/your-teams/"
  1926. to="/settings/:orgId/teams/"
  1927. />
  1928. <Redirect
  1929. from="/organizations/:orgId/teams/all-teams/"
  1930. to="/settings/:orgId/teams/"
  1931. />
  1932. <Redirect
  1933. from="/organizations/:orgId/teams/:teamId/"
  1934. to="/settings/:orgId/teams/:teamId/"
  1935. />
  1936. <Redirect
  1937. from="/organizations/:orgId/teams/:teamId/members/"
  1938. to="/settings/:orgId/teams/:teamId/members/"
  1939. />
  1940. <Redirect
  1941. from="/organizations/:orgId/teams/:teamId/projects/"
  1942. to="/settings/:orgId/teams/:teamId/projects/"
  1943. />
  1944. <Redirect
  1945. from="/organizations/:orgId/teams/:teamId/settings/"
  1946. to="/settings/:orgId/teams/:teamId/settings/"
  1947. />
  1948. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1949. <Redirect
  1950. from="/organizations/:orgId/api-keys/"
  1951. to="/settings/:orgId/api-keys/"
  1952. />
  1953. <Redirect
  1954. from="/organizations/:orgId/api-keys/:apiKey/"
  1955. to="/settings/:orgId/api-keys/:apiKey/"
  1956. />
  1957. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1958. <Redirect
  1959. from="/organizations/:orgId/members/:memberId/"
  1960. to="/settings/:orgId/members/:memberId/"
  1961. />
  1962. <Redirect
  1963. from="/organizations/:orgId/rate-limits/"
  1964. to="/settings/:orgId/rate-limits/"
  1965. />
  1966. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1967. </Route>
  1968. </Route>
  1969. );
  1970. const gettingStartedChildRoutes = (
  1971. <Fragment>
  1972. <IndexRoute
  1973. component={make(() => import('sentry/views/projectInstall/overview'))}
  1974. />
  1975. <Route
  1976. path=":platform/"
  1977. component={make(
  1978. () => import('sentry/views/projectInstall/platformOrIntegration')
  1979. )}
  1980. />
  1981. </Fragment>
  1982. );
  1983. const gettingStartedRoutes = (
  1984. <Fragment>
  1985. {usingCustomerDomain && (
  1986. <Route
  1987. path="/getting-started/:projectId/"
  1988. component={withDomainRequired(
  1989. make(() => import('sentry/views/projectInstall/gettingStarted'))
  1990. )}
  1991. key="orgless-getting-started-route"
  1992. >
  1993. {gettingStartedChildRoutes}
  1994. </Route>
  1995. )}
  1996. <Route
  1997. path="/:orgId/:projectId/getting-started/"
  1998. component={withDomainRedirect(
  1999. make(() => import('sentry/views/projectInstall/gettingStarted'))
  2000. )}
  2001. key="org-getting-started"
  2002. >
  2003. {gettingStartedChildRoutes}
  2004. </Route>
  2005. </Fragment>
  2006. );
  2007. const profilingChildRoutes = (
  2008. <Fragment>
  2009. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2010. <Route
  2011. path="summary/:projectId/"
  2012. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2013. />
  2014. <Route
  2015. path="profile/:projectId/:eventId/"
  2016. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2017. >
  2018. <Route
  2019. path="flamechart/"
  2020. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2021. />
  2022. </Route>
  2023. </Fragment>
  2024. );
  2025. const profilingRoutes = (
  2026. <Fragment>
  2027. {usingCustomerDomain && (
  2028. <Route
  2029. path="/profiling/"
  2030. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2031. key="orgless-profiling-route"
  2032. >
  2033. {profilingChildRoutes}
  2034. </Route>
  2035. )}
  2036. <Route
  2037. path="/organizations/:orgId/profiling/"
  2038. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2039. key="org-profiling"
  2040. >
  2041. {profilingChildRoutes}
  2042. </Route>
  2043. </Fragment>
  2044. );
  2045. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2046. // canonical URLs.
  2047. //
  2048. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2049. // or do these need to be nested into the OrganizationDetails tree?
  2050. const legacyOrgRedirects = (
  2051. <Route path="/:orgId/:projectId/">
  2052. <IndexRoute
  2053. component={errorHandler(
  2054. redirectDeprecatedProjectRoute(
  2055. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2056. )
  2057. )}
  2058. />
  2059. <Route
  2060. path="issues/"
  2061. component={errorHandler(
  2062. redirectDeprecatedProjectRoute(
  2063. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2064. )
  2065. )}
  2066. />
  2067. <Route
  2068. path="dashboard/"
  2069. component={errorHandler(
  2070. redirectDeprecatedProjectRoute(
  2071. ({orgId, projectId}) =>
  2072. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2073. )
  2074. )}
  2075. />
  2076. <Route
  2077. path="user-feedback/"
  2078. component={errorHandler(
  2079. redirectDeprecatedProjectRoute(
  2080. ({orgId, projectId}) =>
  2081. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2082. )
  2083. )}
  2084. />
  2085. <Route
  2086. path="releases/"
  2087. component={errorHandler(
  2088. redirectDeprecatedProjectRoute(
  2089. ({orgId, projectId}) =>
  2090. `/organizations/${orgId}/releases/?project=${projectId}`
  2091. )
  2092. )}
  2093. />
  2094. <Route
  2095. path="releases/:version/"
  2096. component={errorHandler(
  2097. redirectDeprecatedProjectRoute(
  2098. ({orgId, projectId, router}) =>
  2099. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2100. )
  2101. )}
  2102. />
  2103. <Route
  2104. path="releases/:version/new-events/"
  2105. component={errorHandler(
  2106. redirectDeprecatedProjectRoute(
  2107. ({orgId, projectId, router}) =>
  2108. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2109. )
  2110. )}
  2111. />
  2112. <Route
  2113. path="releases/:version/all-events/"
  2114. component={errorHandler(
  2115. redirectDeprecatedProjectRoute(
  2116. ({orgId, projectId, router}) =>
  2117. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2118. )
  2119. )}
  2120. />
  2121. <Route
  2122. path="releases/:version/commits/"
  2123. component={errorHandler(
  2124. redirectDeprecatedProjectRoute(
  2125. ({orgId, projectId, router}) =>
  2126. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2127. )
  2128. )}
  2129. />
  2130. </Route>
  2131. );
  2132. const organizationRoutes = (
  2133. <Route component={errorHandler(OrganizationDetails)}>
  2134. {settingsRoutes}
  2135. {projectsRoutes}
  2136. {dashboardRoutes}
  2137. {userFeedbackRoutes}
  2138. {issueListRoutes}
  2139. {issueDetailsRoutes}
  2140. {alertRoutes}
  2141. {cronsRoutes}
  2142. {replayRoutes}
  2143. {releasesRoutes}
  2144. {activityRoutes}
  2145. {statsRoutes}
  2146. {discoverRoutes}
  2147. {performanceRoutes}
  2148. {starfishRoutes}
  2149. {profilingRoutes}
  2150. {adminManageRoutes}
  2151. {gettingStartedRoutes}
  2152. {legacyOrganizationRootRoutes}
  2153. {legacyOrgRedirects}
  2154. </Route>
  2155. );
  2156. const legacyRedirectRoutes = (
  2157. <Route path="/:orgId/">
  2158. <IndexRedirect to="/organizations/:orgId/" />
  2159. <Route path=":projectId/settings/">
  2160. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2161. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2162. <Redirect
  2163. from="alerts/rules/"
  2164. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2165. />
  2166. <Redirect
  2167. from="alerts/rules/new/"
  2168. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2169. />
  2170. <Redirect
  2171. from="alerts/rules/:ruleId/"
  2172. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2173. />
  2174. <Redirect
  2175. from="environments/"
  2176. to="/settings/:orgId/projects/:projectId/environments/"
  2177. />
  2178. <Redirect
  2179. from="environments/hidden/"
  2180. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2181. />
  2182. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2183. <Redirect
  2184. from="issue-tracking/"
  2185. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2186. />
  2187. <Redirect
  2188. from="release-tracking/"
  2189. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2190. />
  2191. <Redirect
  2192. from="ownership/"
  2193. to="/settings/:orgId/projects/:projectId/ownership/"
  2194. />
  2195. <Redirect
  2196. from="data-forwarding/"
  2197. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2198. />
  2199. <Redirect
  2200. from="debug-symbols/"
  2201. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2202. />
  2203. <Redirect
  2204. from="processing-issues/"
  2205. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2206. />
  2207. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2208. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2209. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2210. <Redirect
  2211. from="keys/:keyId/"
  2212. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2213. />
  2214. <Redirect
  2215. from="user-feedback/"
  2216. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2217. />
  2218. <Redirect
  2219. from="security-headers/"
  2220. to="/settings/:orgId/projects/:projectId/security-headers/"
  2221. />
  2222. <Redirect
  2223. from="security-headers/csp/"
  2224. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2225. />
  2226. <Redirect
  2227. from="security-headers/expect-ct/"
  2228. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2229. />
  2230. <Redirect
  2231. from="security-headers/hpkp/"
  2232. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2233. />
  2234. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2235. <Redirect
  2236. from="plugins/:pluginId/"
  2237. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2238. />
  2239. <Redirect
  2240. from="integrations/:providerKey/"
  2241. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2242. />
  2243. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  2244. <Redirect
  2245. from="install/:platform'"
  2246. to="/settings/:orgId/projects/:projectId/install/:platform/"
  2247. />
  2248. </Route>
  2249. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2250. <Redirect
  2251. from=":projectId/issues/:groupId/"
  2252. to="/organizations/:orgId/issues/:groupId/"
  2253. />
  2254. <Redirect
  2255. from=":projectId/issues/:groupId/events/"
  2256. to="/organizations/:orgId/issues/:groupId/events/"
  2257. />
  2258. <Redirect
  2259. from=":projectId/issues/:groupId/events/:eventId/"
  2260. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2261. />
  2262. <Redirect
  2263. from=":projectId/issues/:groupId/tags/"
  2264. to="/organizations/:orgId/issues/:groupId/tags/"
  2265. />
  2266. <Redirect
  2267. from=":projectId/issues/:groupId/tags/:tagKey/"
  2268. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2269. />
  2270. <Redirect
  2271. from=":projectId/issues/:groupId/feedback/"
  2272. to="/organizations/:orgId/issues/:groupId/feedback/"
  2273. />
  2274. <Redirect
  2275. from=":projectId/issues/:groupId/similar/"
  2276. to="/organizations/:orgId/issues/:groupId/similar/"
  2277. />
  2278. <Redirect
  2279. from=":projectId/issues/:groupId/merged/"
  2280. to="/organizations/:orgId/issues/:groupId/merged/"
  2281. />
  2282. <Route
  2283. path=":projectId/events/:eventId/"
  2284. component={errorHandler(ProjectEventRedirect)}
  2285. />
  2286. </Route>
  2287. );
  2288. const appRoutes = (
  2289. <Route>
  2290. {experimentalSpaRoutes}
  2291. <Route path="/" component={errorHandler(App)}>
  2292. {rootRoutes}
  2293. {organizationRoutes}
  2294. {legacyRedirectRoutes}
  2295. <Route path="*" component={errorHandler(RouteNotFound)} />
  2296. </Route>
  2297. </Route>
  2298. );
  2299. return appRoutes;
  2300. }
  2301. // We load routes both when initializing the SDK (for routing integrations) and
  2302. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2303. export const routes = memoize(buildRoutes);
  2304. // Exported for use in tests.
  2305. export {buildRoutes};
  2306. function NoOp(props: {children: React.ReactNode}) {
  2307. return <Fragment>{props.children}</Fragment>;
  2308. }