routes.tsx 74 KB

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