routes.tsx 60 KB

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