routes.tsx 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898
  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. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  749. <Route name={t('Developer Settings')} path="developer-settings/">
  750. <IndexRoute
  751. component={make(
  752. () => import('sentry/views/settings/organizationDeveloperSettings')
  753. )}
  754. />
  755. <Route
  756. path="new-public/"
  757. name={t('Create Integration')}
  758. component={make(
  759. () =>
  760. import(
  761. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  762. )
  763. )}
  764. />
  765. <Route
  766. path="new-internal/"
  767. name={t('Create Integration')}
  768. component={make(
  769. () =>
  770. import(
  771. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  772. )
  773. )}
  774. />
  775. <Route
  776. path=":appSlug/"
  777. name={t('Edit Integration')}
  778. component={make(
  779. () =>
  780. import(
  781. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  782. )
  783. )}
  784. />
  785. <Route
  786. path=":appSlug/dashboard/"
  787. name={t('Integration Dashboard')}
  788. component={make(
  789. () =>
  790. import(
  791. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  792. )
  793. )}
  794. />
  795. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  796. <Route
  797. path="new/"
  798. name={t('Create Sentry Function')}
  799. component={make(
  800. () =>
  801. import(
  802. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  803. )
  804. )}
  805. />
  806. <Route
  807. path=":functionSlug/"
  808. name={t('Edit Sentry Function')}
  809. component={make(
  810. () =>
  811. import(
  812. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  813. )
  814. )}
  815. />
  816. </Route>
  817. </Route>
  818. </Route>
  819. );
  820. const legacySettingsRedirects = (
  821. <Fragment>
  822. <Redirect from=":projectId/" to="projects/:projectId/" />
  823. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  824. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  825. <Redirect
  826. from=":projectId/alerts/rules/:ruleId/"
  827. to="projects/:projectId/alerts/rules/:ruleId/"
  828. />
  829. </Fragment>
  830. );
  831. const settingsRoutes = (
  832. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  833. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  834. {accountSettingsRoutes}
  835. <Route name={t('Organization')} path=":orgId/">
  836. {orgSettingsRoutes}
  837. {projectSettingsRoutes}
  838. {legacySettingsRedirects}
  839. </Route>
  840. </Route>
  841. );
  842. const projectsRoutes = (
  843. <Route path="/organizations/:orgId/projects/">
  844. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  845. <Route
  846. path="new/"
  847. component={make(() => import('sentry/views/projectInstall/newProject'))}
  848. />
  849. <Route
  850. path=":projectId/getting-started/"
  851. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  852. >
  853. <IndexRoute
  854. component={make(() => import('sentry/views/projectInstall/overview'))}
  855. />
  856. <Route
  857. path=":platform/"
  858. component={make(
  859. () => import('sentry/views/projectInstall/platformOrIntegration')
  860. )}
  861. />
  862. </Route>
  863. <Route
  864. path=":projectId/"
  865. component={make(() => import('sentry/views/projectDetail'))}
  866. />
  867. <Route
  868. path=":projectId/events/:eventId/"
  869. component={errorHandler(ProjectEventRedirect)}
  870. />
  871. </Route>
  872. );
  873. const dashboardRoutes = (
  874. <Fragment>
  875. <Route
  876. path="/organizations/:orgId/dashboards/"
  877. component={make(() => import('sentry/views/dashboardsV2'))}
  878. >
  879. <IndexRoute component={make(() => import('sentry/views/dashboardsV2/manage'))} />
  880. </Route>
  881. <Route
  882. path="/organizations/:orgId/dashboards/new/"
  883. component={make(() => import('sentry/views/dashboardsV2/create'))}
  884. >
  885. <Route
  886. path="widget/:widgetIndex/edit/"
  887. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  888. />
  889. <Route
  890. path="widget/new/"
  891. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  892. />
  893. </Route>
  894. <Route
  895. path="/organizations/:orgId/dashboards/new/:templateId"
  896. component={make(() => import('sentry/views/dashboardsV2/create'))}
  897. >
  898. <Route
  899. path="widget/:widgetId/"
  900. component={make(() => import('sentry/views/dashboardsV2/create'))}
  901. />
  902. </Route>
  903. <Redirect
  904. from="/organizations/:orgId/dashboards/:dashboardId/"
  905. to="/organizations/:orgId/dashboard/:dashboardId/"
  906. />
  907. <Route
  908. path="/organizations/:orgId/dashboard/:dashboardId/"
  909. component={make(() => import('sentry/views/dashboardsV2/view'))}
  910. >
  911. <Route
  912. path="widget/:widgetIndex/edit/"
  913. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  914. />
  915. <Route
  916. path="widget/new/"
  917. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  918. />
  919. <Route
  920. path="widget/:widgetId/"
  921. component={make(() => import('sentry/views/dashboardsV2/view'))}
  922. />
  923. </Route>
  924. </Fragment>
  925. );
  926. const alertRoutes = (
  927. <Route
  928. path="/organizations/:orgId/alerts/"
  929. component={make(() => import('sentry/views/alerts'))}
  930. >
  931. <IndexRoute component={make(() => import('sentry/views/alerts/list/incidents'))} />
  932. <Route path="rules/">
  933. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  934. <Route
  935. path="details/:ruleId/"
  936. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  937. />
  938. <Route
  939. path=":projectId/"
  940. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  941. >
  942. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  943. <Route
  944. path=":ruleId/"
  945. component={make(() => import('sentry/views/alerts/edit'))}
  946. />
  947. </Route>
  948. <Route
  949. path=":projectId/:ruleId/details/"
  950. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  951. >
  952. <IndexRoute
  953. component={make(
  954. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  955. )}
  956. />
  957. </Route>
  958. </Route>
  959. <Route path="metric-rules/">
  960. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  961. <Route
  962. path=":projectId/"
  963. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  964. >
  965. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  966. <Route
  967. path=":ruleId/"
  968. component={make(() => import('sentry/views/alerts/edit'))}
  969. />
  970. </Route>
  971. </Route>
  972. <Route
  973. path="wizard/"
  974. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  975. >
  976. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  977. </Route>
  978. <Route
  979. path="new/"
  980. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  981. >
  982. <IndexRedirect to="/organizations/:orgId/alerts/wizard/" />
  983. <Route
  984. path=":alertType/"
  985. component={make(() => import('sentry/views/alerts/create'))}
  986. />
  987. </Route>
  988. <Route
  989. path=":alertId/"
  990. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  991. />
  992. <Route
  993. path=":projectId/"
  994. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  995. >
  996. <Route path="new/" component={make(() => import('sentry/views/alerts/create'))} />
  997. <Route
  998. path="wizard/"
  999. component={make(() => import('sentry/views/alerts/wizard'))}
  1000. />
  1001. </Route>
  1002. </Route>
  1003. );
  1004. const monitorsRoutes = (
  1005. <Route
  1006. path="/organizations/:orgId/monitors/"
  1007. component={make(() => import('sentry/views/monitors'))}
  1008. >
  1009. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1010. <Route
  1011. path="/organizations/:orgId/monitors/create/"
  1012. component={make(() => import('sentry/views/monitors/create'))}
  1013. />
  1014. <Route
  1015. path="/organizations/:orgId/monitors/:monitorId/"
  1016. component={make(() => import('sentry/views/monitors/details'))}
  1017. />
  1018. <Route
  1019. path="/organizations/:orgId/monitors/:monitorId/edit/"
  1020. component={make(() => import('sentry/views/monitors/edit'))}
  1021. />
  1022. </Route>
  1023. );
  1024. const replayRoutes = (
  1025. <Route
  1026. path="/organizations/:orgId/replays/"
  1027. component={make(() => import('sentry/views/replays'))}
  1028. >
  1029. <IndexRoute component={make(() => import('sentry/views/replays/replays'))} />
  1030. <Route
  1031. path=":replaySlug/"
  1032. component={make(() => import('sentry/views/replays/details'))}
  1033. />
  1034. </Route>
  1035. );
  1036. const releasesRoutes = (
  1037. <Route path="/organizations/:orgId/releases/">
  1038. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1039. <Route
  1040. path=":release/"
  1041. component={make(() => import('sentry/views/releases/detail'))}
  1042. >
  1043. <IndexRoute
  1044. component={make(() => import('sentry/views/releases/detail/overview'))}
  1045. />
  1046. <Route
  1047. path="commits/"
  1048. component={make(
  1049. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1050. )}
  1051. />
  1052. <Route
  1053. path="files-changed/"
  1054. component={make(
  1055. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1056. )}
  1057. />
  1058. <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />
  1059. <Redirect from="all-events/" to="/organizations/:orgId/releases/:release/" />
  1060. </Route>
  1061. </Route>
  1062. );
  1063. const activityRoutes = (
  1064. <Route
  1065. path="/organizations/:orgId/activity/"
  1066. component={make(() => import('sentry/views/organizationActivity'))}
  1067. />
  1068. );
  1069. const statsRoutes = (
  1070. <Route path="/organizations/:orgId/stats/">
  1071. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1072. <Route
  1073. path="issues/"
  1074. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1075. >
  1076. <IndexRoute
  1077. component={make(
  1078. () => import('sentry/views/organizationStats/teamInsights/issues')
  1079. )}
  1080. />
  1081. </Route>
  1082. <Route
  1083. path="health/"
  1084. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1085. >
  1086. <IndexRoute
  1087. component={make(
  1088. () => import('sentry/views/organizationStats/teamInsights/health')
  1089. )}
  1090. />
  1091. </Route>
  1092. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1093. </Route>
  1094. );
  1095. // TODO(mark) Long term this /queries route should go away and /discover
  1096. // should be the canonical route for discover2. We have a redirect right now
  1097. // as /discover was for discover 1 and most of the application is linking to
  1098. // /discover/queries and not /discover
  1099. const discoverRoutes = (
  1100. <Route
  1101. path="/organizations/:orgId/discover/"
  1102. component={make(() => import('sentry/views/eventsV2'))}
  1103. >
  1104. <IndexRedirect to="queries/" />
  1105. <Route
  1106. path="queries/"
  1107. component={make(() => import('sentry/views/eventsV2/landing'))}
  1108. />
  1109. <Route
  1110. path="results/"
  1111. component={make(() => import('sentry/views/eventsV2/results'))}
  1112. />
  1113. <Route
  1114. path=":eventSlug/"
  1115. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1116. />
  1117. </Route>
  1118. );
  1119. const performanceRoutes = (
  1120. <Route
  1121. path="/organizations/:orgId/performance/"
  1122. component={make(() => import('sentry/views/performance'))}
  1123. >
  1124. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1125. <Route
  1126. path="trends/"
  1127. component={make(() => import('sentry/views/performance/trends'))}
  1128. />
  1129. <Route path="/organizations/:orgId/performance/summary/">
  1130. <IndexRoute
  1131. component={make(
  1132. () =>
  1133. import('sentry/views/performance/transactionSummary/transactionOverview')
  1134. )}
  1135. />
  1136. <Route
  1137. path="replays/"
  1138. component={make(
  1139. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1140. )}
  1141. />
  1142. <Route
  1143. path="vitals/"
  1144. component={make(
  1145. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1146. )}
  1147. />
  1148. <Route
  1149. path="tags/"
  1150. component={make(
  1151. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1152. )}
  1153. />
  1154. <Route
  1155. path="events/"
  1156. component={make(
  1157. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1158. )}
  1159. />
  1160. <Route
  1161. path="anomalies/"
  1162. component={make(
  1163. () =>
  1164. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1165. )}
  1166. />
  1167. <Route path="spans/">
  1168. <IndexRoute
  1169. component={make(
  1170. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1171. )}
  1172. />
  1173. <Route
  1174. path=":spanSlug/"
  1175. component={make(
  1176. () =>
  1177. import(
  1178. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1179. )
  1180. )}
  1181. />
  1182. </Route>
  1183. </Route>
  1184. <Route
  1185. path="vitaldetail/"
  1186. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1187. />
  1188. <Route
  1189. path="trace/:traceSlug/"
  1190. component={make(() => import('sentry/views/performance/traceDetails'))}
  1191. />
  1192. <Route
  1193. path=":eventSlug/"
  1194. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1195. />
  1196. </Route>
  1197. );
  1198. const userFeedbackRoutes = (
  1199. <Route
  1200. path="/organizations/:orgId/user-feedback/"
  1201. component={make(() => import('sentry/views/userFeedback'))}
  1202. />
  1203. );
  1204. const issueListRoutes = (
  1205. <Route
  1206. path="/organizations/:orgId/issues/"
  1207. component={errorHandler(IssueListContainer)}
  1208. >
  1209. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1210. <IndexRoute component={errorHandler(IssueListOverview)} />
  1211. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1212. </Route>
  1213. );
  1214. // Once org issues is complete, these routes can be nested under
  1215. // /organizations/:orgId/issues
  1216. const issueDetailsRoutes = (
  1217. <Route
  1218. path="/organizations/:orgId/issues/:groupId/"
  1219. component={make(() => import('sentry/views/organizationGroupDetails'))}
  1220. >
  1221. <IndexRoute
  1222. component={make(
  1223. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1224. )}
  1225. props={{
  1226. currentTab: Tab.DETAILS,
  1227. isEventRoute: false,
  1228. }}
  1229. />
  1230. <Route
  1231. path="replays/"
  1232. component={make(
  1233. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1234. )}
  1235. props={{
  1236. currentTab: Tab.REPLAYS,
  1237. isEventRoute: false,
  1238. }}
  1239. />
  1240. <Route
  1241. path="activity/"
  1242. component={make(
  1243. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1244. )}
  1245. props={{
  1246. currentTab: Tab.ACTIVITY,
  1247. isEventRoute: false,
  1248. }}
  1249. />
  1250. <Route
  1251. path="events/"
  1252. component={make(
  1253. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1254. )}
  1255. props={{
  1256. currentTab: Tab.EVENTS,
  1257. isEventRoute: false,
  1258. }}
  1259. />
  1260. <Route
  1261. path="tags/"
  1262. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1263. props={{
  1264. currentTab: Tab.TAGS,
  1265. isEventRoute: false,
  1266. }}
  1267. />
  1268. <Route
  1269. path="tags/:tagKey/"
  1270. component={make(
  1271. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1272. )}
  1273. props={{
  1274. currentTab: Tab.TAGS,
  1275. isEventRoute: false,
  1276. }}
  1277. />
  1278. <Route
  1279. path="feedback/"
  1280. component={make(
  1281. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1282. )}
  1283. props={{
  1284. currentTab: Tab.USER_FEEDBACK,
  1285. isEventRoute: false,
  1286. }}
  1287. />
  1288. <Route
  1289. path="attachments/"
  1290. component={make(
  1291. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1292. )}
  1293. props={{
  1294. currentTab: Tab.ATTACHMENTS,
  1295. isEventRoute: false,
  1296. }}
  1297. />
  1298. <Route
  1299. path="similar/"
  1300. component={make(
  1301. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1302. )}
  1303. props={{
  1304. currentTab: Tab.SIMILAR_ISSUES,
  1305. isEventRoute: false,
  1306. }}
  1307. />
  1308. <Route
  1309. path="merged/"
  1310. component={make(
  1311. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1312. )}
  1313. props={{
  1314. currentTab: Tab.MERGED,
  1315. isEventRoute: false,
  1316. }}
  1317. />
  1318. <Route
  1319. path="grouping/"
  1320. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1321. props={{
  1322. currentTab: Tab.GROUPING,
  1323. isEventRoute: false,
  1324. }}
  1325. />
  1326. <Route path="events/:eventId/">
  1327. <IndexRoute
  1328. component={make(
  1329. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1330. )}
  1331. props={{
  1332. currentTab: Tab.DETAILS,
  1333. isEventRoute: true,
  1334. }}
  1335. />
  1336. <Route
  1337. path="replays/"
  1338. component={make(
  1339. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1340. )}
  1341. props={{
  1342. currentTab: Tab.REPLAYS,
  1343. isEventRoute: true,
  1344. }}
  1345. />
  1346. <Route
  1347. path="activity/"
  1348. component={make(
  1349. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1350. )}
  1351. props={{
  1352. currentTab: Tab.ACTIVITY,
  1353. isEventRoute: true,
  1354. }}
  1355. />
  1356. <Route
  1357. path="events/"
  1358. component={make(
  1359. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1360. )}
  1361. props={{
  1362. currentTab: Tab.EVENTS,
  1363. isEventRoute: true,
  1364. }}
  1365. />
  1366. <Route
  1367. path="similar/"
  1368. component={make(
  1369. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1370. )}
  1371. props={{
  1372. currentTab: Tab.SIMILAR_ISSUES,
  1373. isEventRoute: true,
  1374. }}
  1375. />
  1376. <Route
  1377. path="tags/"
  1378. component={make(
  1379. () => import('sentry/views/organizationGroupDetails/groupTags')
  1380. )}
  1381. props={{
  1382. currentTab: Tab.TAGS,
  1383. isEventRoute: true,
  1384. }}
  1385. />
  1386. <Route
  1387. path="tags/:tagKey/"
  1388. component={make(
  1389. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1390. )}
  1391. props={{
  1392. currentTab: Tab.TAGS,
  1393. isEventRoute: true,
  1394. }}
  1395. />
  1396. <Route
  1397. path="feedback/"
  1398. component={make(
  1399. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1400. )}
  1401. props={{
  1402. currentTab: Tab.USER_FEEDBACK,
  1403. isEventRoute: true,
  1404. }}
  1405. />
  1406. <Route
  1407. path="attachments/"
  1408. component={make(
  1409. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1410. )}
  1411. props={{
  1412. currentTab: Tab.ATTACHMENTS,
  1413. isEventRoute: true,
  1414. }}
  1415. />
  1416. <Route
  1417. path="merged/"
  1418. component={make(
  1419. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1420. )}
  1421. props={{
  1422. currentTab: Tab.MERGED,
  1423. isEventRoute: true,
  1424. }}
  1425. />
  1426. <Route
  1427. path="grouping/"
  1428. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1429. props={{
  1430. currentTab: Tab.GROUPING,
  1431. isEventRoute: true,
  1432. }}
  1433. />
  1434. </Route>
  1435. </Route>
  1436. );
  1437. // These are the "manage" pages. For sentry.io, these are _different_ from
  1438. // the SaaS admin routes in getsentry.
  1439. const adminManageRoutes = (
  1440. <Route
  1441. path="/manage/"
  1442. component={make(() => import('sentry/views/admin/adminLayout'))}
  1443. >
  1444. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1445. <Route
  1446. path="buffer/"
  1447. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1448. />
  1449. <Route
  1450. path="relays/"
  1451. component={make(() => import('sentry/views/admin/adminRelays'))}
  1452. />
  1453. <Route
  1454. path="organizations/"
  1455. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1456. />
  1457. <Route
  1458. path="projects/"
  1459. component={make(() => import('sentry/views/admin/adminProjects'))}
  1460. />
  1461. <Route
  1462. path="queue/"
  1463. component={make(() => import('sentry/views/admin/adminQueue'))}
  1464. />
  1465. <Route
  1466. path="quotas/"
  1467. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1468. />
  1469. <Route
  1470. path="settings/"
  1471. component={make(() => import('sentry/views/admin/adminSettings'))}
  1472. />
  1473. <Route path="users/">
  1474. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1475. <Route
  1476. path=":id"
  1477. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1478. />
  1479. </Route>
  1480. <Route
  1481. path="status/mail/"
  1482. component={make(() => import('sentry/views/admin/adminMail'))}
  1483. />
  1484. <Route
  1485. path="status/environment/"
  1486. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1487. />
  1488. <Route
  1489. path="status/packages/"
  1490. component={make(() => import('sentry/views/admin/adminPackages'))}
  1491. />
  1492. <Route
  1493. path="status/warnings/"
  1494. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1495. />
  1496. {hook('routes:admin')}
  1497. </Route>
  1498. );
  1499. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1500. // me why we need the OrganizationRoot root container.
  1501. const legacyOrganizationRootRoutes = (
  1502. <Route component={errorHandler(OrganizationRoot)}>
  1503. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1504. <Route path="/organizations/:orgId/">
  1505. {hook('routes:organization')}
  1506. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1507. <Redirect
  1508. from="/organizations/:orgId/teams/your-teams/"
  1509. to="/settings/:orgId/teams/"
  1510. />
  1511. <Redirect
  1512. from="/organizations/:orgId/teams/all-teams/"
  1513. to="/settings/:orgId/teams/"
  1514. />
  1515. <Redirect
  1516. from="/organizations/:orgId/teams/:teamId/"
  1517. to="/settings/:orgId/teams/:teamId/"
  1518. />
  1519. <Redirect
  1520. from="/organizations/:orgId/teams/:teamId/members/"
  1521. to="/settings/:orgId/teams/:teamId/members/"
  1522. />
  1523. <Redirect
  1524. from="/organizations/:orgId/teams/:teamId/projects/"
  1525. to="/settings/:orgId/teams/:teamId/projects/"
  1526. />
  1527. <Redirect
  1528. from="/organizations/:orgId/teams/:teamId/settings/"
  1529. to="/settings/:orgId/teams/:teamId/settings/"
  1530. />
  1531. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1532. <Redirect
  1533. from="/organizations/:orgId/api-keys/"
  1534. to="/settings/:orgId/api-keys/"
  1535. />
  1536. <Redirect
  1537. from="/organizations/:orgId/api-keys/:apiKey/"
  1538. to="/settings/:orgId/api-keys/:apiKey/"
  1539. />
  1540. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1541. <Redirect
  1542. from="/organizations/:orgId/members/:memberId/"
  1543. to="/settings/:orgId/members/:memberId/"
  1544. />
  1545. <Redirect
  1546. from="/organizations/:orgId/rate-limits/"
  1547. to="/settings/:orgId/rate-limits/"
  1548. />
  1549. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1550. </Route>
  1551. </Route>
  1552. );
  1553. // XXX(epurkhiser): These also exist in the legacyOrganizationRootRoutes. Not
  1554. // sure which one here is more correct.
  1555. const legacyGettingStartedRoutes = (
  1556. <Route
  1557. path="/:orgId/:projectId/getting-started/"
  1558. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1559. >
  1560. <IndexRoute
  1561. component={make(() => import('sentry/views/projectInstall/overview'))}
  1562. />
  1563. <Route
  1564. path=":platform/"
  1565. component={make(
  1566. () => import('sentry/views/projectInstall/platformOrIntegration')
  1567. )}
  1568. />
  1569. </Route>
  1570. );
  1571. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1572. // canonical URLs.
  1573. //
  1574. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1575. // or do these need to be nested into the OrganizationDetails tree?
  1576. const legacyOrgRedirects = (
  1577. <Route path="/:orgId/:projectId/">
  1578. <IndexRoute
  1579. component={errorHandler(
  1580. redirectDeprecatedProjectRoute(
  1581. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1582. )
  1583. )}
  1584. />
  1585. <Route
  1586. path="issues/"
  1587. component={errorHandler(
  1588. redirectDeprecatedProjectRoute(
  1589. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1590. )
  1591. )}
  1592. />
  1593. <Route
  1594. path="dashboard/"
  1595. component={errorHandler(
  1596. redirectDeprecatedProjectRoute(
  1597. ({orgId, projectId}) =>
  1598. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1599. )
  1600. )}
  1601. />
  1602. <Route
  1603. path="user-feedback/"
  1604. component={errorHandler(
  1605. redirectDeprecatedProjectRoute(
  1606. ({orgId, projectId}) =>
  1607. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1608. )
  1609. )}
  1610. />
  1611. <Route
  1612. path="releases/"
  1613. component={errorHandler(
  1614. redirectDeprecatedProjectRoute(
  1615. ({orgId, projectId}) =>
  1616. `/organizations/${orgId}/releases/?project=${projectId}`
  1617. )
  1618. )}
  1619. />
  1620. <Route
  1621. path="releases/:version/"
  1622. component={errorHandler(
  1623. redirectDeprecatedProjectRoute(
  1624. ({orgId, projectId, router}) =>
  1625. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1626. )
  1627. )}
  1628. />
  1629. <Route
  1630. path="releases/:version/new-events/"
  1631. component={errorHandler(
  1632. redirectDeprecatedProjectRoute(
  1633. ({orgId, projectId, router}) =>
  1634. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1635. )
  1636. )}
  1637. />
  1638. <Route
  1639. path="releases/:version/all-events/"
  1640. component={errorHandler(
  1641. redirectDeprecatedProjectRoute(
  1642. ({orgId, projectId, router}) =>
  1643. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1644. )
  1645. )}
  1646. />
  1647. <Route
  1648. path="releases/:version/commits/"
  1649. component={errorHandler(
  1650. redirectDeprecatedProjectRoute(
  1651. ({orgId, projectId, router}) =>
  1652. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1653. )
  1654. )}
  1655. />
  1656. </Route>
  1657. );
  1658. const profilingRoutes = (
  1659. <Route
  1660. path="/organizations/:orgId/profiling/"
  1661. component={make(() => import('sentry/views/profiling'))}
  1662. >
  1663. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1664. <Route
  1665. path="summary/:projectId/"
  1666. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1667. />
  1668. <Route
  1669. path="profile/:projectId/:eventId"
  1670. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1671. >
  1672. <Route
  1673. path="details/"
  1674. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1675. />
  1676. <Route
  1677. path="flamechart/"
  1678. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1679. />
  1680. </Route>
  1681. </Route>
  1682. );
  1683. const organizationRoutes = (
  1684. <Route component={errorHandler(OrganizationDetails)}>
  1685. {settingsRoutes}
  1686. {projectsRoutes}
  1687. {dashboardRoutes}
  1688. {userFeedbackRoutes}
  1689. {issueListRoutes}
  1690. {issueDetailsRoutes}
  1691. {alertRoutes}
  1692. {monitorsRoutes}
  1693. {replayRoutes}
  1694. {releasesRoutes}
  1695. {activityRoutes}
  1696. {statsRoutes}
  1697. {discoverRoutes}
  1698. {performanceRoutes}
  1699. {profilingRoutes}
  1700. {adminManageRoutes}
  1701. {legacyOrganizationRootRoutes}
  1702. {legacyGettingStartedRoutes}
  1703. {legacyOrgRedirects}
  1704. </Route>
  1705. );
  1706. const legacyRedirectRoutes = (
  1707. <Route path="/:orgId/">
  1708. <IndexRedirect to="/organizations/:orgId/" />
  1709. <Route path=":projectId/settings/">
  1710. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  1711. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  1712. <Redirect
  1713. from="alerts/rules/"
  1714. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  1715. />
  1716. <Redirect
  1717. from="alerts/rules/new/"
  1718. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  1719. />
  1720. <Redirect
  1721. from="alerts/rules/:ruleId/"
  1722. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  1723. />
  1724. <Redirect
  1725. from="environments/"
  1726. to="/settings/:orgId/projects/:projectId/environments/"
  1727. />
  1728. <Redirect
  1729. from="environments/hidden/"
  1730. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  1731. />
  1732. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  1733. <Redirect
  1734. from="issue-tracking/"
  1735. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  1736. />
  1737. <Redirect
  1738. from="release-tracking/"
  1739. to="/settings/:orgId/projects/:projectId/release-tracking/"
  1740. />
  1741. <Redirect
  1742. from="ownership/"
  1743. to="/settings/:orgId/projects/:projectId/ownership/"
  1744. />
  1745. <Redirect
  1746. from="data-forwarding/"
  1747. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  1748. />
  1749. <Redirect
  1750. from="debug-symbols/"
  1751. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  1752. />
  1753. <Redirect
  1754. from="processing-issues/"
  1755. to="/settings/:orgId/projects/:projectId/processing-issues/"
  1756. />
  1757. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  1758. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  1759. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  1760. <Redirect
  1761. from="keys/:keyId/"
  1762. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  1763. />
  1764. <Redirect
  1765. from="user-feedback/"
  1766. to="/settings/:orgId/projects/:projectId/user-feedback/"
  1767. />
  1768. <Redirect
  1769. from="security-headers/"
  1770. to="/settings/:orgId/projects/:projectId/security-headers/"
  1771. />
  1772. <Redirect
  1773. from="security-headers/csp/"
  1774. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  1775. />
  1776. <Redirect
  1777. from="security-headers/expect-ct/"
  1778. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  1779. />
  1780. <Redirect
  1781. from="security-headers/hpkp/"
  1782. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  1783. />
  1784. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  1785. <Redirect
  1786. from="plugins/:pluginId/"
  1787. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  1788. />
  1789. <Redirect
  1790. from="integrations/:providerKey/"
  1791. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  1792. />
  1793. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  1794. <Redirect
  1795. from="install/:platform'"
  1796. to="/settings/:orgId/projects/:projectId/install/:platform/"
  1797. />
  1798. </Route>
  1799. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  1800. <Redirect
  1801. from=":projectId/issues/:groupId/"
  1802. to="/organizations/:orgId/issues/:groupId/"
  1803. />
  1804. <Redirect
  1805. from=":projectId/issues/:groupId/events/"
  1806. to="/organizations/:orgId/issues/:groupId/events/"
  1807. />
  1808. <Redirect
  1809. from=":projectId/issues/:groupId/events/:eventId/"
  1810. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  1811. />
  1812. <Redirect
  1813. from=":projectId/issues/:groupId/tags/"
  1814. to="/organizations/:orgId/issues/:groupId/tags/"
  1815. />
  1816. <Redirect
  1817. from=":projectId/issues/:groupId/tags/:tagKey/"
  1818. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  1819. />
  1820. <Redirect
  1821. from=":projectId/issues/:groupId/feedback/"
  1822. to="/organizations/:orgId/issues/:groupId/feedback/"
  1823. />
  1824. <Redirect
  1825. from=":projectId/issues/:groupId/similar/"
  1826. to="/organizations/:orgId/issues/:groupId/similar/"
  1827. />
  1828. <Redirect
  1829. from=":projectId/issues/:groupId/merged/"
  1830. to="/organizations/:orgId/issues/:groupId/merged/"
  1831. />
  1832. <Route
  1833. path=":projectId/events/:eventId/"
  1834. component={errorHandler(ProjectEventRedirect)}
  1835. />
  1836. </Route>
  1837. );
  1838. const appRoutes = (
  1839. <Route>
  1840. {experimentalSpaRoutes}
  1841. <Route path="/" component={errorHandler(App)}>
  1842. {rootRoutes}
  1843. {organizationRoutes}
  1844. {legacyRedirectRoutes}
  1845. {hook('routes')}
  1846. <Route path="*" component={errorHandler(RouteNotFound)} />
  1847. </Route>
  1848. </Route>
  1849. );
  1850. return appRoutes;
  1851. }
  1852. // We load routes both when initlaizing the SDK (for routing integrations) and
  1853. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  1854. export const routes = memoize(buildRoutes);