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