routes.tsx 73 KB

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