routes.tsx 62 KB

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