routes.tsx 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823
  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} 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 App from 'sentry/views/app';
  18. import AuthLayout from 'sentry/views/auth/layout';
  19. import IssueListContainer from 'sentry/views/issueList/container';
  20. import IssueListOverview from 'sentry/views/issueList/overview';
  21. import OrganizationContextContainer from 'sentry/views/organizationContextContainer';
  22. import OrganizationDetails from 'sentry/views/organizationDetails';
  23. import {Tab, TabPaths} from 'sentry/views/organizationGroupDetails/types';
  24. import OrganizationRoot from 'sentry/views/organizationRoot';
  25. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  26. import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
  27. import RouteNotFound from 'sentry/views/routeNotFound';
  28. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  29. type CustomProps = {
  30. name?: string;
  31. };
  32. /**
  33. * We add some additional props to our routes
  34. */
  35. const Route = BaseRoute as React.ComponentClass<RouteProps & CustomProps>;
  36. const IndexRoute = BaseIndexRoute as React.ComponentClass<IndexRouteProps & CustomProps>;
  37. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  38. const SafeLazyLoad = errorHandler(LazyLoad);
  39. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  40. // pirvate routing tree.
  41. /**
  42. * Factory function to produce a component that will render the SafeLazyLoad
  43. * _with_ the required props.
  44. */
  45. export function makeLazyloadComponent<C extends React.ComponentType<any>>(
  46. resolve: () => Promise<{default: C}>
  47. ) {
  48. // XXX: Assign the component to a variable so it has a displayname
  49. const RouteLazyLoad: React.FC<React.ComponentProps<C>> = props => {
  50. return <SafeLazyLoad {...props} component={resolve} />;
  51. };
  52. return RouteLazyLoad;
  53. }
  54. // Shorthand to avoid extra line wrapping
  55. const make = makeLazyloadComponent;
  56. function buildRoutes() {
  57. // Read this to understand where to add new routes, how / why the routing
  58. // tree is structured the way it is, and how the lazy-loading /
  59. // code-splitting works for pages.
  60. //
  61. // ## Formatting
  62. //
  63. // NOTE that there are intentionally NO blank lines within route tree blocks.
  64. // This helps make it easier to navigate within the file by using your
  65. // editors shortcuts to jump between 'paragraphs' of code.
  66. //
  67. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  68. //
  69. //
  70. // ## Lazy loading
  71. //
  72. // * The `SafeLazyLoad` component
  73. //
  74. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  75. // errorHandler wrapped version). This means the rendered component for the
  76. // route will only be loaded when the route is loaded. This helps us
  77. // "code-split" the app.
  78. //
  79. // ## Hooks
  80. //
  81. // There are a number of `hook()` routes placed within the routing tree to
  82. // allow for additional routes to be augmented into the application via the
  83. // hookStore mechanism.
  84. //
  85. //
  86. // ## The structure
  87. //
  88. // * `experimentalSpaRoutes`
  89. //
  90. // These routes are specifically for the experimental single-page-app mode,
  91. // where Sentry is run separate from Django. These are NOT part of the root
  92. // <App /> component.
  93. //
  94. // Right now these are mainly used for authentication pages. In the future
  95. // they would be used for other pages like registration.
  96. //
  97. // * `rootRoutes`
  98. //
  99. // These routes live directly under the <App /> container, and generally
  100. // are not specific to an organization.
  101. //
  102. // * `settingsRoutes`
  103. //
  104. // This is the route tree for all of `/settings/`. This route tree is
  105. // composed of a few different sub-trees.
  106. //
  107. // - `accountSettingsRoutes` User specific settings
  108. // - `orgSettingsRoutes` Specific to a organization
  109. // - `projectSettingsRoutes` Specific to a project
  110. // - `legacySettingsRedirects` Routes that used to exist in settings
  111. //
  112. // * `organizationRoutes`
  113. //
  114. // This is where a majority of the app routes live. This is wrapped with
  115. // the <OrganizationDetails /> component, which provides the sidebar and
  116. // organization context.
  117. //
  118. // Within these routes are a variety of subroutes. They are not all
  119. // listed here as the subroutes will be added and removed, and most are
  120. // self explanatory.
  121. //
  122. // * `legacyRedirectRoutes`
  123. //
  124. // This route tree contains <Redirect /> routes for many old legacy paths.
  125. //
  126. // You may also find <Redirect />'s collocated next to the feature routes
  127. // they have redirects for. A good rule here is to place 'helper' redirects
  128. // next to the routes they redirect to, and place 'legacy route' redirects
  129. // for routes that have completely changed in this tree.
  130. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  131. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  132. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  133. <Route path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  134. </Route>
  135. ) : null;
  136. const rootRoutes = (
  137. <Fragment>
  138. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  139. <Route
  140. path="/accept/:memberId/:token/"
  141. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  142. />
  143. <Route
  144. path="/accept-transfer/"
  145. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  146. />
  147. <Route
  148. path="/extensions/external-install/:integrationSlug/:installationId"
  149. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  150. />
  151. <Route
  152. path="/extensions/:integrationSlug/link/"
  153. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  154. />
  155. <Route
  156. path="/sentry-apps/:sentryAppSlug/external-install/"
  157. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  158. />
  159. <Redirect from="/account/" to="/settings/account/details/" />
  160. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  161. <Route
  162. path="/share/issue/:shareId/"
  163. component={make(() => import('sentry/views/sharedGroupDetails'))}
  164. />
  165. <Route
  166. path="/organizations/new/"
  167. component={make(() => import('sentry/views/organizationCreate'))}
  168. />
  169. <Route
  170. path="/organizations/:orgId/data-export/:dataExportId"
  171. component={make(() => import('sentry/views/dataExport/dataDownload'))}
  172. />
  173. <Route
  174. path="/organizations/:orgId/disabled-member/"
  175. component={make(() => import('sentry/views/disabledMember'))}
  176. />
  177. <Route
  178. path="/join-request/:orgId/"
  179. component={make(() => import('sentry/views/organizationJoinRequest'))}
  180. />
  181. <Route
  182. path="/onboarding/:orgId/"
  183. component={errorHandler(OrganizationContextContainer)}
  184. >
  185. <IndexRedirect to="welcome/" />
  186. <Route
  187. path=":step/"
  188. component={make(() => import('sentry/views/onboarding/onboarding'))}
  189. />
  190. </Route>
  191. </Fragment>
  192. );
  193. const accountSettingsRoutes = (
  194. <Route
  195. path="account/"
  196. name={t('Account')}
  197. component={make(
  198. () => import('sentry/views/settings/account/accountSettingsLayout')
  199. )}
  200. >
  201. <IndexRedirect to="details/" />
  202. <Route
  203. path="details/"
  204. name={t('Details')}
  205. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  206. />
  207. <Route path="notifications/" name={t('Notifications')}>
  208. <IndexRoute
  209. component={make(
  210. () =>
  211. import('sentry/views/settings/account/notifications/notificationSettings')
  212. )}
  213. />
  214. <Route
  215. path=":fineTuneType/"
  216. name={t('Fine Tune Alerts')}
  217. component={make(
  218. () => import('sentry/views/settings/account/accountNotificationFineTuning')
  219. )}
  220. />
  221. </Route>
  222. <Route
  223. path="emails/"
  224. name={t('Emails')}
  225. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  226. />
  227. <Route
  228. path="authorizations/"
  229. component={make(
  230. () => import('sentry/views/settings/account/accountAuthorizations')
  231. )}
  232. />
  233. <Route path="security/" name={t('Security')}>
  234. <Route
  235. component={make(
  236. () =>
  237. import(
  238. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  239. )
  240. )}
  241. >
  242. <IndexRoute
  243. component={make(
  244. () => import('sentry/views/settings/account/accountSecurity')
  245. )}
  246. />
  247. <Route
  248. path="session-history/"
  249. name={t('Session History')}
  250. component={make(
  251. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  252. )}
  253. />
  254. <Route
  255. path="mfa/:authId/"
  256. name={t('Details')}
  257. component={make(
  258. () =>
  259. import(
  260. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  261. )
  262. )}
  263. />
  264. </Route>
  265. <Route
  266. path="mfa/:authId/enroll/"
  267. name={t('Enroll')}
  268. component={make(
  269. () =>
  270. import(
  271. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  272. )
  273. )}
  274. />
  275. </Route>
  276. <Route
  277. path="subscriptions/"
  278. name={t('Subscriptions')}
  279. component={make(
  280. () => import('sentry/views/settings/account/accountSubscriptions')
  281. )}
  282. />
  283. <Route
  284. path="identities/"
  285. name={t('Identities')}
  286. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  287. />
  288. <Route path="api/" name={t('API')}>
  289. <IndexRedirect to="auth-tokens/" />
  290. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  291. <IndexRoute
  292. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  293. />
  294. <Route
  295. path="new-token/"
  296. name={t('Create New Token')}
  297. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  298. />
  299. </Route>
  300. <Route path="applications/" name={t('Applications')}>
  301. <IndexRoute
  302. component={make(
  303. () => import('sentry/views/settings/account/apiApplications')
  304. )}
  305. />
  306. <Route
  307. path=":appId/"
  308. name={t('Details')}
  309. component={make(
  310. () => import('sentry/views/settings/account/apiApplications/details')
  311. )}
  312. />
  313. </Route>
  314. {hook('routes:api')}
  315. </Route>
  316. <Route
  317. path="close-account/"
  318. name={t('Close Account')}
  319. component={make(() => import('sentry/views/settings/account/accountClose'))}
  320. />
  321. </Route>
  322. );
  323. const projectSettingsRoutes = (
  324. <Route
  325. path="projects/:projectId/"
  326. name={t('Project')}
  327. component={make(
  328. () => import('sentry/views/settings/project/projectSettingsLayout')
  329. )}
  330. >
  331. <IndexRoute
  332. name={t('General')}
  333. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  334. />
  335. <Route
  336. path="teams/"
  337. name={t('Teams')}
  338. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  339. />
  340. <Route
  341. path="alerts/"
  342. name={t('Alerts')}
  343. component={make(() => import('sentry/views/settings/projectAlerts'))}
  344. >
  345. <IndexRoute
  346. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  347. />
  348. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  349. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  350. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  351. <Redirect
  352. from="metric-rules/new/"
  353. to="/organizations/:orgId/alerts/:projectId/new/"
  354. />
  355. <Redirect
  356. from="rules/:ruleId/"
  357. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  358. />
  359. <Redirect
  360. from="metric-rules/:ruleId/"
  361. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  362. />
  363. </Route>
  364. <Route
  365. path="environments/"
  366. name={t('Environments')}
  367. component={make(
  368. () => import('sentry/views/settings/project/projectEnvironments')
  369. )}
  370. >
  371. <IndexRoute />
  372. <Route path="hidden/" />
  373. </Route>
  374. <Route
  375. path="tags/"
  376. name={t('Tags')}
  377. component={make(() => import('sentry/views/settings/projectTags'))}
  378. />
  379. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  380. <Route
  381. path="release-tracking/"
  382. name={t('Release Tracking')}
  383. component={make(
  384. () => import('sentry/views/settings/project/projectReleaseTracking')
  385. )}
  386. />
  387. <Route
  388. path="ownership/"
  389. name={t('Issue Owners')}
  390. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  391. />
  392. <Route
  393. path="data-forwarding/"
  394. name={t('Data Forwarding')}
  395. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  396. />
  397. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  398. <IndexRoute
  399. component={make(
  400. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  401. )}
  402. />
  403. <Route
  404. path="advanced-data-scrubbing/:scrubbingId/"
  405. component={make(
  406. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  407. )}
  408. />
  409. </Route>
  410. <Route
  411. path="debug-symbols/"
  412. name={t('Debug Information Files')}
  413. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  414. />
  415. <Route
  416. path="proguard/"
  417. name={t('ProGuard Mappings')}
  418. component={make(() => import('sentry/views/settings/projectProguard'))}
  419. />
  420. <Route
  421. path="performance/"
  422. name={t('Performance')}
  423. component={make(() => import('sentry/views/settings/projectPerformance'))}
  424. />
  425. <Route
  426. path="source-maps/"
  427. name={t('Source Maps')}
  428. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  429. >
  430. <IndexRoute
  431. component={make(() => import('sentry/views/settings/projectSourceMaps/list'))}
  432. />
  433. <Route
  434. path=":name/"
  435. name={t('Archive')}
  436. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  437. />
  438. </Route>
  439. <Route
  440. path="processing-issues/"
  441. name={t('Processing Issues')}
  442. component={make(
  443. () => import('sentry/views/settings/project/projectProcessingIssues')
  444. )}
  445. />
  446. <Route
  447. path="filters/"
  448. name={t('Inbound Filters')}
  449. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  450. >
  451. <IndexRedirect to="data-filters/" />
  452. <Route path=":filterType/" />
  453. </Route>
  454. <Route path="dynamic-sampling/" name={t('Dynamic Sampling')}>
  455. <IndexRoute
  456. component={make(() => import('sentry/views/settings/project/dynamicSampling'))}
  457. />
  458. <Route
  459. path="rules/:rule/"
  460. component={make(() => import('sentry/views/settings/project/dynamicSampling'))}
  461. />
  462. </Route>
  463. <Redirect from="server-side-sampling/" to="dynamic-sampling/" />
  464. <Route
  465. path="issue-grouping/"
  466. name={t('Issue Grouping')}
  467. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  468. />
  469. <Route
  470. path="hooks/"
  471. name={t('Service Hooks')}
  472. component={make(
  473. () => import('sentry/views/settings/project/projectServiceHooks')
  474. )}
  475. />
  476. <Route
  477. path="hooks/new/"
  478. name={t('Create Service Hook')}
  479. component={make(
  480. () => import('sentry/views/settings/project/projectCreateServiceHook')
  481. )}
  482. />
  483. <Route
  484. path="hooks/:hookId/"
  485. name={t('Service Hook Details')}
  486. component={make(
  487. () => import('sentry/views/settings/project/projectServiceHookDetails')
  488. )}
  489. />
  490. <Route path="keys/" name={t('Client Keys')}>
  491. <IndexRoute
  492. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  493. />
  494. <Route
  495. path=":keyId/"
  496. name={t('Details')}
  497. component={make(
  498. () => import('sentry/views/settings/project/projectKeys/details')
  499. )}
  500. />
  501. </Route>
  502. <Route
  503. path="user-feedback/"
  504. name={t('User Feedback')}
  505. component={make(
  506. () => import('sentry/views/settings/project/projectUserFeedback')
  507. )}
  508. />
  509. <Redirect from="csp/" to="security-headers/" />
  510. <Route path="security-headers/" name={t('Security Headers')}>
  511. <IndexRoute
  512. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  513. />
  514. <Route
  515. path="csp/"
  516. name={t('Content Security Policy')}
  517. component={make(
  518. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  519. )}
  520. />
  521. <Route
  522. path="expect-ct/"
  523. name={t('Certificate Transparency')}
  524. component={make(
  525. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  526. )}
  527. />
  528. <Route
  529. path="hpkp/"
  530. name={t('HPKP')}
  531. component={make(
  532. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  533. )}
  534. />
  535. </Route>
  536. <Route path="plugins/" name={t('Legacy Integrations')}>
  537. <IndexRoute
  538. component={make(() => import('sentry/views/settings/projectPlugins'))}
  539. />
  540. <Route
  541. path=":pluginId/"
  542. name={t('Integration Details')}
  543. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  544. />
  545. </Route>
  546. <Route path="install/" name={t('Configuration')}>
  547. <IndexRoute
  548. component={make(() => import('sentry/views/projectInstall/overview'))}
  549. />
  550. <Route
  551. path=":platform/"
  552. name={t('Docs')}
  553. component={make(
  554. () => import('sentry/views/projectInstall/platformOrIntegration')
  555. )}
  556. />
  557. </Route>
  558. </Route>
  559. );
  560. const orgSettingsRoutes = (
  561. <Route
  562. component={make(
  563. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  564. )}
  565. >
  566. {hook('routes:organization')}
  567. <IndexRoute
  568. name={t('General')}
  569. component={make(
  570. () => import('sentry/views/settings/organizationGeneralSettings')
  571. )}
  572. />
  573. <Route
  574. path="projects/"
  575. name={t('Projects')}
  576. component={make(() => import('sentry/views/settings/organizationProjects'))}
  577. />
  578. <Route path="api-keys/" name={t('API Key')}>
  579. <IndexRoute
  580. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  581. />
  582. <Route
  583. path=":apiKey/"
  584. name={t('Details')}
  585. component={make(
  586. () =>
  587. import(
  588. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  589. )
  590. )}
  591. />
  592. </Route>
  593. <Route
  594. path="audit-log/"
  595. name={t('Audit Log')}
  596. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  597. />
  598. <Route
  599. path="auth/"
  600. name={t('Auth Providers')}
  601. component={make(() => import('sentry/views/settings/organizationAuth'))}
  602. />
  603. <Redirect from="members/requests" to="members/" />
  604. <Route path="members/" name={t('Members')}>
  605. <Route
  606. component={make(
  607. () =>
  608. import(
  609. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  610. )
  611. )}
  612. >
  613. <IndexRoute
  614. component={make(
  615. () =>
  616. import(
  617. 'sentry/views/settings/organizationMembers/organizationMembersList'
  618. )
  619. )}
  620. />
  621. </Route>
  622. <Route
  623. path=":memberId/"
  624. name={t('Details')}
  625. component={make(
  626. () =>
  627. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  628. )}
  629. />
  630. </Route>
  631. <Route
  632. path="rate-limits/"
  633. name={t('Rate Limits')}
  634. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  635. />
  636. <Route
  637. path="relay/"
  638. name={t('Relay')}
  639. component={make(() => import('sentry/views/settings/organizationRelay'))}
  640. />
  641. <Route
  642. path="repos/"
  643. name={t('Repositories')}
  644. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  645. />
  646. <Route
  647. path="settings/"
  648. component={make(
  649. () => import('sentry/views/settings/organizationGeneralSettings')
  650. )}
  651. />
  652. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  653. <IndexRoute
  654. component={make(
  655. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  656. )}
  657. />
  658. <Route
  659. path="advanced-data-scrubbing/:scrubbingId/"
  660. component={make(
  661. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  662. )}
  663. />
  664. </Route>
  665. <Route path="teams/" name={t('Teams')}>
  666. <IndexRoute
  667. component={make(() => import('sentry/views/settings/organizationTeams'))}
  668. />
  669. <Route
  670. path=":teamId/"
  671. name={t('Team')}
  672. component={make(
  673. () => import('sentry/views/settings/organizationTeams/teamDetails')
  674. )}
  675. >
  676. <IndexRedirect to="members/" />
  677. <Route
  678. path="members/"
  679. name={t('Members')}
  680. component={make(
  681. () => import('sentry/views/settings/organizationTeams/teamMembers')
  682. )}
  683. />
  684. <Route
  685. path="notifications/"
  686. name={t('Notifications')}
  687. component={make(
  688. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  689. )}
  690. />
  691. <Route
  692. path="projects/"
  693. name={t('Projects')}
  694. component={make(
  695. () => import('sentry/views/settings/organizationTeams/teamProjects')
  696. )}
  697. />
  698. <Route
  699. path="settings/"
  700. name={t('Settings')}
  701. component={make(
  702. () => import('sentry/views/settings/organizationTeams/teamSettings')
  703. )}
  704. />
  705. </Route>
  706. </Route>
  707. <Redirect from="plugins/" to="integrations/" />
  708. <Route path="plugins/" name={t('Integrations')}>
  709. <Route
  710. path=":integrationSlug/"
  711. name={t('Integration Details')}
  712. component={make(
  713. () => import('sentry/views/organizationIntegrations/pluginDetailedView')
  714. )}
  715. />
  716. </Route>
  717. <Redirect from="sentry-apps/" to="integrations/" />
  718. <Route path="sentry-apps/" name={t('Integrations')}>
  719. <Route
  720. path=":integrationSlug"
  721. name={t('Details')}
  722. component={make(
  723. () => import('sentry/views/organizationIntegrations/sentryAppDetailedView')
  724. )}
  725. />
  726. </Route>
  727. <Redirect from="document-integrations/" to="integrations/" />
  728. <Route path="document-integrations/" name={t('Integrations')}>
  729. <Route
  730. path=":integrationSlug"
  731. name={t('Details')}
  732. component={make(
  733. () =>
  734. import('sentry/views/organizationIntegrations/docIntegrationDetailedView')
  735. )}
  736. />
  737. </Route>
  738. <Route path="integrations/" name={t('Integrations')}>
  739. <IndexRoute
  740. component={make(
  741. () => import('sentry/views/organizationIntegrations/integrationListDirectory')
  742. )}
  743. />
  744. <Route
  745. path=":integrationSlug"
  746. name={t('Integration Details')}
  747. component={make(
  748. () => import('sentry/views/organizationIntegrations/integrationDetailedView')
  749. )}
  750. />
  751. <Route
  752. path=":providerKey/:integrationId/"
  753. name={t('Configure Integration')}
  754. component={make(
  755. () =>
  756. import(
  757. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  758. )
  759. )}
  760. />
  761. </Route>
  762. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  763. <Route path="developer-settings/" name={t('Developer Settings')}>
  764. <IndexRoute
  765. component={make(
  766. () => import('sentry/views/settings/organizationDeveloperSettings')
  767. )}
  768. />
  769. <Route
  770. path="new-public/"
  771. name={t('Create Integration')}
  772. component={make(
  773. () =>
  774. import(
  775. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  776. )
  777. )}
  778. />
  779. <Route
  780. path="new-internal/"
  781. name={t('Create Integration')}
  782. component={make(
  783. () =>
  784. import(
  785. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  786. )
  787. )}
  788. />
  789. <Route
  790. path=":appSlug/"
  791. name={t('Edit Integration')}
  792. component={make(
  793. () =>
  794. import(
  795. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  796. )
  797. )}
  798. />
  799. <Route
  800. path=":appSlug/dashboard/"
  801. name={t('Integration Dashboard')}
  802. component={make(
  803. () =>
  804. import(
  805. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  806. )
  807. )}
  808. />
  809. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  810. <Route
  811. path="new/"
  812. name={t('Create Sentry Function')}
  813. component={make(
  814. () =>
  815. import(
  816. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  817. )
  818. )}
  819. />
  820. <Route
  821. path=":functionSlug/"
  822. name={t('Edit Sentry Function')}
  823. component={make(
  824. () =>
  825. import(
  826. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  827. )
  828. )}
  829. />
  830. </Route>
  831. </Route>
  832. </Route>
  833. );
  834. const legacySettingsRedirects = (
  835. <Fragment>
  836. <Redirect from=":projectId/" to="projects/:projectId/" />
  837. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  838. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  839. <Redirect
  840. from=":projectId/alerts/rules/:ruleId/"
  841. to="projects/:projectId/alerts/rules/:ruleId/"
  842. />
  843. </Fragment>
  844. );
  845. const settingsRoutes = (
  846. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  847. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  848. {accountSettingsRoutes}
  849. <Route path=":orgId/" name={t('Organization')}>
  850. {orgSettingsRoutes}
  851. {projectSettingsRoutes}
  852. {legacySettingsRedirects}
  853. </Route>
  854. </Route>
  855. );
  856. const projectsRoutes = (
  857. <Route path="/organizations/:orgId/projects/">
  858. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  859. <Route
  860. path="new/"
  861. component={make(() => import('sentry/views/projectInstall/newProject'))}
  862. />
  863. <Route
  864. path=":projectId/getting-started/"
  865. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  866. >
  867. <IndexRoute
  868. component={make(() => import('sentry/views/projectInstall/overview'))}
  869. />
  870. <Route
  871. path=":platform/"
  872. component={make(
  873. () => import('sentry/views/projectInstall/platformOrIntegration')
  874. )}
  875. />
  876. </Route>
  877. <Route
  878. path=":projectId/"
  879. component={make(() => import('sentry/views/projectDetail'))}
  880. />
  881. <Route
  882. path=":projectId/events/:eventId/"
  883. component={errorHandler(ProjectEventRedirect)}
  884. />
  885. </Route>
  886. );
  887. const dashboardRoutes = (
  888. <Fragment>
  889. <Route
  890. path="/organizations/:orgId/dashboards/"
  891. component={make(() => import('sentry/views/dashboardsV2'))}
  892. >
  893. <IndexRoute component={make(() => import('sentry/views/dashboardsV2/manage'))} />
  894. </Route>
  895. <Route
  896. path="/organizations/:orgId/dashboards/new/"
  897. component={make(() => import('sentry/views/dashboardsV2/create'))}
  898. >
  899. <Route
  900. path="widget/:widgetIndex/edit/"
  901. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  902. />
  903. <Route
  904. path="widget/new/"
  905. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  906. />
  907. </Route>
  908. <Route
  909. path="/organizations/:orgId/dashboards/new/:templateId"
  910. component={make(() => import('sentry/views/dashboardsV2/create'))}
  911. >
  912. <Route
  913. path="widget/:widgetId/"
  914. component={make(() => import('sentry/views/dashboardsV2/create'))}
  915. />
  916. </Route>
  917. <Redirect
  918. from="/organizations/:orgId/dashboards/:dashboardId/"
  919. to="/organizations/:orgId/dashboard/:dashboardId/"
  920. />
  921. <Route
  922. path="/organizations/:orgId/dashboard/:dashboardId/"
  923. component={make(() => import('sentry/views/dashboardsV2/view'))}
  924. >
  925. <Route
  926. path="widget/:widgetIndex/edit/"
  927. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  928. />
  929. <Route
  930. path="widget/new/"
  931. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  932. />
  933. <Route
  934. path="widget/:widgetId/"
  935. component={make(() => import('sentry/views/dashboardsV2/view'))}
  936. />
  937. </Route>
  938. </Fragment>
  939. );
  940. const alertRoutes = (
  941. <Route
  942. path="/organizations/:orgId/alerts/"
  943. component={make(() => import('sentry/views/alerts'))}
  944. >
  945. <IndexRoute component={make(() => import('sentry/views/alerts/list/incidents'))} />
  946. <Route path="rules/">
  947. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  948. <Route
  949. path="details/:ruleId/"
  950. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  951. />
  952. <Route
  953. path=":projectId/"
  954. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  955. >
  956. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  957. <Route
  958. path=":ruleId/"
  959. component={make(() => import('sentry/views/alerts/edit'))}
  960. />
  961. </Route>
  962. <Route
  963. path=":projectId/:ruleId/details/"
  964. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  965. >
  966. <IndexRoute
  967. component={make(
  968. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  969. )}
  970. />
  971. </Route>
  972. </Route>
  973. <Route path="metric-rules/">
  974. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  975. <Route
  976. path=":projectId/"
  977. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  978. >
  979. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  980. <Route
  981. path=":ruleId/"
  982. component={make(() => import('sentry/views/alerts/edit'))}
  983. />
  984. </Route>
  985. </Route>
  986. <Route
  987. path="wizard/"
  988. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  989. >
  990. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  991. </Route>
  992. <Route
  993. path="new/"
  994. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  995. >
  996. <IndexRedirect to="/organizations/:orgId/alerts/wizard/" />
  997. <Route
  998. path=":alertType/"
  999. component={make(() => import('sentry/views/alerts/create'))}
  1000. />
  1001. </Route>
  1002. <Route
  1003. path=":alertId/"
  1004. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1005. />
  1006. <Route
  1007. path=":projectId/"
  1008. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1009. >
  1010. <Route path="new/" component={make(() => import('sentry/views/alerts/create'))} />
  1011. <Route
  1012. path="wizard/"
  1013. component={make(() => import('sentry/views/alerts/wizard'))}
  1014. />
  1015. </Route>
  1016. </Route>
  1017. );
  1018. const monitorsRoutes = (
  1019. <Route
  1020. path="/organizations/:orgId/monitors/"
  1021. component={make(() => import('sentry/views/monitors'))}
  1022. >
  1023. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1024. <Route
  1025. path="/organizations/:orgId/monitors/create/"
  1026. component={make(() => import('sentry/views/monitors/create'))}
  1027. />
  1028. <Route
  1029. path="/organizations/:orgId/monitors/:monitorId/"
  1030. component={make(() => import('sentry/views/monitors/details'))}
  1031. />
  1032. <Route
  1033. path="/organizations/:orgId/monitors/:monitorId/edit/"
  1034. component={make(() => import('sentry/views/monitors/edit'))}
  1035. />
  1036. </Route>
  1037. );
  1038. const replayRoutes = (
  1039. <Route
  1040. path="/organizations/:orgId/replays/"
  1041. component={make(() => import('sentry/views/replays'))}
  1042. >
  1043. <IndexRoute component={make(() => import('sentry/views/replays/replays'))} />
  1044. <Route
  1045. path=":replaySlug/"
  1046. component={make(() => import('sentry/views/replays/details'))}
  1047. />
  1048. </Route>
  1049. );
  1050. const releasesRoutes = (
  1051. <Route path="/organizations/:orgId/releases/">
  1052. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1053. <Route
  1054. path=":release/"
  1055. component={make(() => import('sentry/views/releases/detail'))}
  1056. >
  1057. <IndexRoute
  1058. component={make(() => import('sentry/views/releases/detail/overview'))}
  1059. />
  1060. <Route
  1061. path="commits/"
  1062. component={make(
  1063. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1064. )}
  1065. />
  1066. <Route
  1067. path="files-changed/"
  1068. component={make(
  1069. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1070. )}
  1071. />
  1072. <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />
  1073. <Redirect from="all-events/" to="/organizations/:orgId/releases/:release/" />
  1074. </Route>
  1075. </Route>
  1076. );
  1077. const activityRoutes = (
  1078. <Route
  1079. path="/organizations/:orgId/activity/"
  1080. component={make(() => import('sentry/views/organizationActivity'))}
  1081. />
  1082. );
  1083. const statsRoutes = (
  1084. <Route path="/organizations/:orgId/stats/">
  1085. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1086. <Route
  1087. path="issues/"
  1088. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1089. >
  1090. <IndexRoute
  1091. component={make(
  1092. () => import('sentry/views/organizationStats/teamInsights/issues')
  1093. )}
  1094. />
  1095. </Route>
  1096. <Route
  1097. path="health/"
  1098. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1099. >
  1100. <IndexRoute
  1101. component={make(
  1102. () => import('sentry/views/organizationStats/teamInsights/health')
  1103. )}
  1104. />
  1105. </Route>
  1106. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1107. </Route>
  1108. );
  1109. // TODO(mark) Long term this /queries route should go away and /discover
  1110. // should be the canonical route for discover2. We have a redirect right now
  1111. // as /discover was for discover 1 and most of the application is linking to
  1112. // /discover/queries and not /discover
  1113. const discoverRoutes = (
  1114. <Route
  1115. path="/organizations/:orgId/discover/"
  1116. component={make(() => import('sentry/views/eventsV2'))}
  1117. >
  1118. <IndexRedirect to="queries/" />
  1119. <Route
  1120. path="homepage/"
  1121. component={make(() => import('sentry/views/eventsV2/homepage'))}
  1122. />
  1123. <Route
  1124. path="queries/"
  1125. component={make(() => import('sentry/views/eventsV2/landing'))}
  1126. />
  1127. <Route
  1128. path="results/"
  1129. component={make(() => import('sentry/views/eventsV2/results'))}
  1130. />
  1131. <Route
  1132. path=":eventSlug/"
  1133. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1134. />
  1135. </Route>
  1136. );
  1137. const performanceRoutes = (
  1138. <Route
  1139. path="/organizations/:orgId/performance/"
  1140. component={make(() => import('sentry/views/performance'))}
  1141. >
  1142. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1143. <Route
  1144. path="trends/"
  1145. component={make(() => import('sentry/views/performance/trends'))}
  1146. />
  1147. <Route path="/organizations/:orgId/performance/summary/">
  1148. <IndexRoute
  1149. component={make(
  1150. () =>
  1151. import('sentry/views/performance/transactionSummary/transactionOverview')
  1152. )}
  1153. />
  1154. <Route
  1155. path="replays/"
  1156. component={make(
  1157. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1158. )}
  1159. />
  1160. <Route
  1161. path="vitals/"
  1162. component={make(
  1163. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1164. )}
  1165. />
  1166. <Route
  1167. path="tags/"
  1168. component={make(
  1169. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1170. )}
  1171. />
  1172. <Route
  1173. path="events/"
  1174. component={make(
  1175. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1176. )}
  1177. />
  1178. <Route
  1179. path="anomalies/"
  1180. component={make(
  1181. () =>
  1182. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1183. )}
  1184. />
  1185. <Route path="spans/">
  1186. <IndexRoute
  1187. component={make(
  1188. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1189. )}
  1190. />
  1191. <Route
  1192. path=":spanSlug/"
  1193. component={make(
  1194. () =>
  1195. import(
  1196. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1197. )
  1198. )}
  1199. />
  1200. </Route>
  1201. </Route>
  1202. <Route
  1203. path="vitaldetail/"
  1204. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1205. />
  1206. <Route
  1207. path="trace/:traceSlug/"
  1208. component={make(() => import('sentry/views/performance/traceDetails'))}
  1209. />
  1210. <Route
  1211. path=":eventSlug/"
  1212. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1213. />
  1214. </Route>
  1215. );
  1216. const userFeedbackRoutes = (
  1217. <Route
  1218. path="/organizations/:orgId/user-feedback/"
  1219. component={make(() => import('sentry/views/userFeedback'))}
  1220. />
  1221. );
  1222. const issueListRoutes = (
  1223. <Route
  1224. path="/organizations/:orgId/issues/"
  1225. component={errorHandler(IssueListContainer)}
  1226. >
  1227. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1228. <IndexRoute component={errorHandler(IssueListOverview)} />
  1229. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1230. </Route>
  1231. );
  1232. // Once org issues is complete, these routes can be nested under
  1233. // /organizations/:orgId/issues
  1234. const issueDetailsRoutes = (
  1235. <Route
  1236. path="/organizations/:orgId/issues/:groupId/"
  1237. component={make(() => import('sentry/views/organizationGroupDetails'))}
  1238. >
  1239. <IndexRoute
  1240. component={make(
  1241. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1242. )}
  1243. />
  1244. <Route
  1245. path={TabPaths[Tab.REPLAYS]}
  1246. component={make(
  1247. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1248. )}
  1249. />
  1250. <Route
  1251. path={TabPaths[Tab.ACTIVITY]}
  1252. component={make(
  1253. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1254. )}
  1255. />
  1256. <Route
  1257. path={TabPaths[Tab.EVENTS]}
  1258. component={make(
  1259. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1260. )}
  1261. />
  1262. <Route
  1263. path={TabPaths[Tab.TAGS]}
  1264. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1265. />
  1266. <Route
  1267. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1268. component={make(
  1269. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1270. )}
  1271. />
  1272. <Route
  1273. path={TabPaths[Tab.USER_FEEDBACK]}
  1274. component={make(
  1275. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1276. )}
  1277. />
  1278. <Route
  1279. path={TabPaths[Tab.ATTACHMENTS]}
  1280. component={make(
  1281. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1282. )}
  1283. />
  1284. <Route
  1285. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1286. component={make(
  1287. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1288. )}
  1289. />
  1290. <Route
  1291. path={TabPaths[Tab.MERGED]}
  1292. component={make(
  1293. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1294. )}
  1295. />
  1296. <Route
  1297. path={TabPaths[Tab.GROUPING]}
  1298. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1299. />
  1300. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1301. <IndexRoute
  1302. component={make(
  1303. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1304. )}
  1305. />
  1306. <Route
  1307. path={TabPaths[Tab.REPLAYS]}
  1308. component={make(
  1309. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1310. )}
  1311. />
  1312. <Route
  1313. path={TabPaths[Tab.ACTIVITY]}
  1314. component={make(
  1315. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1316. )}
  1317. />
  1318. <Route
  1319. path={TabPaths[Tab.EVENTS]}
  1320. component={make(
  1321. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1322. )}
  1323. />
  1324. <Route
  1325. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1326. component={make(
  1327. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1328. )}
  1329. />
  1330. <Route
  1331. path={TabPaths[Tab.TAGS]}
  1332. component={make(
  1333. () => import('sentry/views/organizationGroupDetails/groupTags')
  1334. )}
  1335. />
  1336. <Route
  1337. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1338. component={make(
  1339. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1340. )}
  1341. />
  1342. <Route
  1343. path={TabPaths[Tab.USER_FEEDBACK]}
  1344. component={make(
  1345. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1346. )}
  1347. />
  1348. <Route
  1349. path={TabPaths[Tab.ATTACHMENTS]}
  1350. component={make(
  1351. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1352. )}
  1353. />
  1354. <Route
  1355. path={TabPaths[Tab.MERGED]}
  1356. component={make(
  1357. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1358. )}
  1359. />
  1360. <Route
  1361. path={TabPaths[Tab.GROUPING]}
  1362. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1363. />
  1364. </Route>
  1365. </Route>
  1366. );
  1367. // These are the "manage" pages. For sentry.io, these are _different_ from
  1368. // the SaaS admin routes in getsentry.
  1369. const adminManageRoutes = (
  1370. <Route
  1371. path="/manage/"
  1372. component={make(() => import('sentry/views/admin/adminLayout'))}
  1373. >
  1374. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1375. <Route
  1376. path="buffer/"
  1377. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1378. />
  1379. <Route
  1380. path="relays/"
  1381. component={make(() => import('sentry/views/admin/adminRelays'))}
  1382. />
  1383. <Route
  1384. path="organizations/"
  1385. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1386. />
  1387. <Route
  1388. path="projects/"
  1389. component={make(() => import('sentry/views/admin/adminProjects'))}
  1390. />
  1391. <Route
  1392. path="queue/"
  1393. component={make(() => import('sentry/views/admin/adminQueue'))}
  1394. />
  1395. <Route
  1396. path="quotas/"
  1397. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1398. />
  1399. <Route
  1400. path="settings/"
  1401. component={make(() => import('sentry/views/admin/adminSettings'))}
  1402. />
  1403. <Route path="users/">
  1404. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1405. <Route
  1406. path=":id"
  1407. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1408. />
  1409. </Route>
  1410. <Route
  1411. path="status/mail/"
  1412. component={make(() => import('sentry/views/admin/adminMail'))}
  1413. />
  1414. <Route
  1415. path="status/environment/"
  1416. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1417. />
  1418. <Route
  1419. path="status/packages/"
  1420. component={make(() => import('sentry/views/admin/adminPackages'))}
  1421. />
  1422. <Route
  1423. path="status/warnings/"
  1424. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1425. />
  1426. </Route>
  1427. );
  1428. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1429. // me why we need the OrganizationRoot root container.
  1430. const legacyOrganizationRootRoutes = (
  1431. <Route component={errorHandler(OrganizationRoot)}>
  1432. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1433. <Route path="/organizations/:orgId/">
  1434. {hook('routes:organization')}
  1435. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1436. <Redirect
  1437. from="/organizations/:orgId/teams/your-teams/"
  1438. to="/settings/:orgId/teams/"
  1439. />
  1440. <Redirect
  1441. from="/organizations/:orgId/teams/all-teams/"
  1442. to="/settings/:orgId/teams/"
  1443. />
  1444. <Redirect
  1445. from="/organizations/:orgId/teams/:teamId/"
  1446. to="/settings/:orgId/teams/:teamId/"
  1447. />
  1448. <Redirect
  1449. from="/organizations/:orgId/teams/:teamId/members/"
  1450. to="/settings/:orgId/teams/:teamId/members/"
  1451. />
  1452. <Redirect
  1453. from="/organizations/:orgId/teams/:teamId/projects/"
  1454. to="/settings/:orgId/teams/:teamId/projects/"
  1455. />
  1456. <Redirect
  1457. from="/organizations/:orgId/teams/:teamId/settings/"
  1458. to="/settings/:orgId/teams/:teamId/settings/"
  1459. />
  1460. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1461. <Redirect
  1462. from="/organizations/:orgId/api-keys/"
  1463. to="/settings/:orgId/api-keys/"
  1464. />
  1465. <Redirect
  1466. from="/organizations/:orgId/api-keys/:apiKey/"
  1467. to="/settings/:orgId/api-keys/:apiKey/"
  1468. />
  1469. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1470. <Redirect
  1471. from="/organizations/:orgId/members/:memberId/"
  1472. to="/settings/:orgId/members/:memberId/"
  1473. />
  1474. <Redirect
  1475. from="/organizations/:orgId/rate-limits/"
  1476. to="/settings/:orgId/rate-limits/"
  1477. />
  1478. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1479. </Route>
  1480. </Route>
  1481. );
  1482. // XXX(epurkhiser): These also exist in the legacyOrganizationRootRoutes. Not
  1483. // sure which one here is more correct.
  1484. const legacyGettingStartedRoutes = (
  1485. <Route
  1486. path="/:orgId/:projectId/getting-started/"
  1487. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1488. >
  1489. <IndexRoute
  1490. component={make(() => import('sentry/views/projectInstall/overview'))}
  1491. />
  1492. <Route
  1493. path=":platform/"
  1494. component={make(
  1495. () => import('sentry/views/projectInstall/platformOrIntegration')
  1496. )}
  1497. />
  1498. </Route>
  1499. );
  1500. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1501. // canonical URLs.
  1502. //
  1503. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1504. // or do these need to be nested into the OrganizationDetails tree?
  1505. const legacyOrgRedirects = (
  1506. <Route path="/:orgId/:projectId/">
  1507. <IndexRoute
  1508. component={errorHandler(
  1509. redirectDeprecatedProjectRoute(
  1510. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1511. )
  1512. )}
  1513. />
  1514. <Route
  1515. path="issues/"
  1516. component={errorHandler(
  1517. redirectDeprecatedProjectRoute(
  1518. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1519. )
  1520. )}
  1521. />
  1522. <Route
  1523. path="dashboard/"
  1524. component={errorHandler(
  1525. redirectDeprecatedProjectRoute(
  1526. ({orgId, projectId}) =>
  1527. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1528. )
  1529. )}
  1530. />
  1531. <Route
  1532. path="user-feedback/"
  1533. component={errorHandler(
  1534. redirectDeprecatedProjectRoute(
  1535. ({orgId, projectId}) =>
  1536. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1537. )
  1538. )}
  1539. />
  1540. <Route
  1541. path="releases/"
  1542. component={errorHandler(
  1543. redirectDeprecatedProjectRoute(
  1544. ({orgId, projectId}) =>
  1545. `/organizations/${orgId}/releases/?project=${projectId}`
  1546. )
  1547. )}
  1548. />
  1549. <Route
  1550. path="releases/:version/"
  1551. component={errorHandler(
  1552. redirectDeprecatedProjectRoute(
  1553. ({orgId, projectId, router}) =>
  1554. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1555. )
  1556. )}
  1557. />
  1558. <Route
  1559. path="releases/:version/new-events/"
  1560. component={errorHandler(
  1561. redirectDeprecatedProjectRoute(
  1562. ({orgId, projectId, router}) =>
  1563. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1564. )
  1565. )}
  1566. />
  1567. <Route
  1568. path="releases/:version/all-events/"
  1569. component={errorHandler(
  1570. redirectDeprecatedProjectRoute(
  1571. ({orgId, projectId, router}) =>
  1572. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1573. )
  1574. )}
  1575. />
  1576. <Route
  1577. path="releases/:version/commits/"
  1578. component={errorHandler(
  1579. redirectDeprecatedProjectRoute(
  1580. ({orgId, projectId, router}) =>
  1581. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1582. )
  1583. )}
  1584. />
  1585. </Route>
  1586. );
  1587. const profilingRoutes = (
  1588. <Route
  1589. path="/organizations/:orgId/profiling/"
  1590. component={make(() => import('sentry/views/profiling'))}
  1591. >
  1592. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1593. <Route
  1594. path="summary/:projectId/"
  1595. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1596. />
  1597. <Route
  1598. path="profile/:projectId/:eventId"
  1599. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1600. >
  1601. <Route
  1602. path="details/"
  1603. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1604. />
  1605. <Route
  1606. path="flamechart/"
  1607. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1608. />
  1609. </Route>
  1610. </Route>
  1611. );
  1612. const organizationRoutes = (
  1613. <Route component={errorHandler(OrganizationDetails)}>
  1614. {settingsRoutes}
  1615. {projectsRoutes}
  1616. {dashboardRoutes}
  1617. {userFeedbackRoutes}
  1618. {issueListRoutes}
  1619. {issueDetailsRoutes}
  1620. {alertRoutes}
  1621. {monitorsRoutes}
  1622. {replayRoutes}
  1623. {releasesRoutes}
  1624. {activityRoutes}
  1625. {statsRoutes}
  1626. {discoverRoutes}
  1627. {performanceRoutes}
  1628. {profilingRoutes}
  1629. {adminManageRoutes}
  1630. {legacyOrganizationRootRoutes}
  1631. {legacyGettingStartedRoutes}
  1632. {legacyOrgRedirects}
  1633. </Route>
  1634. );
  1635. const legacyRedirectRoutes = (
  1636. <Route path="/:orgId/">
  1637. <IndexRedirect to="/organizations/:orgId/" />
  1638. <Route path=":projectId/settings/">
  1639. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  1640. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  1641. <Redirect
  1642. from="alerts/rules/"
  1643. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  1644. />
  1645. <Redirect
  1646. from="alerts/rules/new/"
  1647. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  1648. />
  1649. <Redirect
  1650. from="alerts/rules/:ruleId/"
  1651. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  1652. />
  1653. <Redirect
  1654. from="environments/"
  1655. to="/settings/:orgId/projects/:projectId/environments/"
  1656. />
  1657. <Redirect
  1658. from="environments/hidden/"
  1659. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  1660. />
  1661. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  1662. <Redirect
  1663. from="issue-tracking/"
  1664. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  1665. />
  1666. <Redirect
  1667. from="release-tracking/"
  1668. to="/settings/:orgId/projects/:projectId/release-tracking/"
  1669. />
  1670. <Redirect
  1671. from="ownership/"
  1672. to="/settings/:orgId/projects/:projectId/ownership/"
  1673. />
  1674. <Redirect
  1675. from="data-forwarding/"
  1676. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  1677. />
  1678. <Redirect
  1679. from="debug-symbols/"
  1680. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  1681. />
  1682. <Redirect
  1683. from="processing-issues/"
  1684. to="/settings/:orgId/projects/:projectId/processing-issues/"
  1685. />
  1686. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  1687. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  1688. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  1689. <Redirect
  1690. from="keys/:keyId/"
  1691. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  1692. />
  1693. <Redirect
  1694. from="user-feedback/"
  1695. to="/settings/:orgId/projects/:projectId/user-feedback/"
  1696. />
  1697. <Redirect
  1698. from="security-headers/"
  1699. to="/settings/:orgId/projects/:projectId/security-headers/"
  1700. />
  1701. <Redirect
  1702. from="security-headers/csp/"
  1703. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  1704. />
  1705. <Redirect
  1706. from="security-headers/expect-ct/"
  1707. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  1708. />
  1709. <Redirect
  1710. from="security-headers/hpkp/"
  1711. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  1712. />
  1713. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  1714. <Redirect
  1715. from="plugins/:pluginId/"
  1716. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  1717. />
  1718. <Redirect
  1719. from="integrations/:providerKey/"
  1720. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  1721. />
  1722. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  1723. <Redirect
  1724. from="install/:platform'"
  1725. to="/settings/:orgId/projects/:projectId/install/:platform/"
  1726. />
  1727. </Route>
  1728. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  1729. <Redirect
  1730. from=":projectId/issues/:groupId/"
  1731. to="/organizations/:orgId/issues/:groupId/"
  1732. />
  1733. <Redirect
  1734. from=":projectId/issues/:groupId/events/"
  1735. to="/organizations/:orgId/issues/:groupId/events/"
  1736. />
  1737. <Redirect
  1738. from=":projectId/issues/:groupId/events/:eventId/"
  1739. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  1740. />
  1741. <Redirect
  1742. from=":projectId/issues/:groupId/tags/"
  1743. to="/organizations/:orgId/issues/:groupId/tags/"
  1744. />
  1745. <Redirect
  1746. from=":projectId/issues/:groupId/tags/:tagKey/"
  1747. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  1748. />
  1749. <Redirect
  1750. from=":projectId/issues/:groupId/feedback/"
  1751. to="/organizations/:orgId/issues/:groupId/feedback/"
  1752. />
  1753. <Redirect
  1754. from=":projectId/issues/:groupId/similar/"
  1755. to="/organizations/:orgId/issues/:groupId/similar/"
  1756. />
  1757. <Redirect
  1758. from=":projectId/issues/:groupId/merged/"
  1759. to="/organizations/:orgId/issues/:groupId/merged/"
  1760. />
  1761. <Route
  1762. path=":projectId/events/:eventId/"
  1763. component={errorHandler(ProjectEventRedirect)}
  1764. />
  1765. </Route>
  1766. );
  1767. const appRoutes = (
  1768. <Route>
  1769. {experimentalSpaRoutes}
  1770. <Route path="/" component={errorHandler(App)}>
  1771. {rootRoutes}
  1772. {organizationRoutes}
  1773. {legacyRedirectRoutes}
  1774. <Route path="*" component={errorHandler(RouteNotFound)} />
  1775. </Route>
  1776. </Route>
  1777. );
  1778. return appRoutes;
  1779. }
  1780. // We load routes both when initlaizing the SDK (for routing integrations) and
  1781. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  1782. export const routes = memoize(buildRoutes);