routes.tsx 60 KB

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