routes.tsx 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450
  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, usingCustomerDomain} 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 withDomainRedirect from 'sentry/utils/withDomainRedirect';
  18. import withDomainRequired from 'sentry/utils/withDomainRequired';
  19. import App from 'sentry/views/app';
  20. import AuthLayout from 'sentry/views/auth/layout';
  21. import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
  22. import IssueListContainer from 'sentry/views/issueList';
  23. import IssueListOverview from 'sentry/views/issueList/overview';
  24. import OrganizationContextContainer from 'sentry/views/organizationContextContainer';
  25. import OrganizationDetails from 'sentry/views/organizationDetails';
  26. import OrganizationRoot from 'sentry/views/organizationRoot';
  27. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  28. import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
  29. import RouteNotFound from 'sentry/views/routeNotFound';
  30. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  31. type CustomProps = {
  32. name?: string;
  33. };
  34. /**
  35. * We add some additional props to our routes
  36. */
  37. const Route = BaseRoute as React.ComponentClass<
  38. React.PropsWithChildren<RouteProps & CustomProps>
  39. >;
  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. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  44. // pirvate routing tree.
  45. /**
  46. * Factory function to produce a component that will render the SafeLazyLoad
  47. * _with_ the required props.
  48. */
  49. export function makeLazyloadComponent<C extends React.ComponentType<any>>(
  50. resolve: () => Promise<{default: C}>
  51. ) {
  52. // XXX: Assign the component to a variable so it has a displayname
  53. function RouteLazyLoad(props: React.ComponentProps<C>) {
  54. // we can use this hook to set the organization as it's
  55. // a child of the organization context
  56. return <SafeLazyLoad {...props} component={resolve} />;
  57. }
  58. return RouteLazyLoad;
  59. }
  60. // Shorthand to avoid extra line wrapping
  61. const make = makeLazyloadComponent;
  62. function buildRoutes() {
  63. // Read this to understand where to add new routes, how / why the routing
  64. // tree is structured the way it is, and how the lazy-loading /
  65. // code-splitting works for pages.
  66. //
  67. // ## Formatting
  68. //
  69. // NOTE that there are intentionally NO blank lines within route tree blocks.
  70. // This helps make it easier to navigate within the file by using your
  71. // editors shortcuts to jump between 'paragraphs' of code.
  72. //
  73. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  74. //
  75. //
  76. // ## Lazy loading
  77. //
  78. // * The `SafeLazyLoad` component
  79. //
  80. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  81. // errorHandler wrapped version). This means the rendered component for the
  82. // route will only be loaded when the route is loaded. This helps us
  83. // "code-split" the app.
  84. //
  85. // ## Hooks
  86. //
  87. // There are a number of `hook()` routes placed within the routing tree to
  88. // allow for additional routes to be augmented into the application via the
  89. // hookStore mechanism.
  90. //
  91. //
  92. // ## The structure
  93. //
  94. // * `experimentalSpaRoutes`
  95. //
  96. // These routes are specifically for the experimental single-page-app mode,
  97. // where Sentry is run separate from Django. These are NOT part of the root
  98. // <App /> component.
  99. //
  100. // Right now these are mainly used for authentication pages. In the future
  101. // they would be used for other pages like registration.
  102. //
  103. // * `rootRoutes`
  104. //
  105. // These routes live directly under the <App /> container, and generally
  106. // are not specific to an organization.
  107. //
  108. // * `settingsRoutes`
  109. //
  110. // This is the route tree for all of `/settings/`. This route tree is
  111. // composed of a few different sub-trees.
  112. //
  113. // - `accountSettingsRoutes` User specific settings
  114. // - `orgSettingsRoutes` Specific to a organization
  115. // - `projectSettingsRoutes` Specific to a project
  116. // - `legacySettingsRedirects` Routes that used to exist in settings
  117. //
  118. // * `organizationRoutes`
  119. //
  120. // This is where a majority of the app routes live. This is wrapped with
  121. // the <OrganizationDetails /> component, which provides the sidebar and
  122. // organization context.
  123. //
  124. // When adding new routes make sure you have both a route that starts
  125. // with `/organizations/:orgId` and also 'customer-domains' route that
  126. // does not include `/organizations/:orgId`. Often you'll only need to
  127. // worry about this for the container route for that section of the UI.
  128. // Child routes should access the current organization with `useOrganization()`
  129. // or `withOrganization()` methods.
  130. //
  131. // Within these routes are a variety of subroutes. They are not all
  132. // listed here as the subroutes will be added and removed, and most are
  133. // self explanatory.
  134. //
  135. // * `legacyRedirectRoutes`
  136. //
  137. // This route tree contains <Redirect /> routes for many old legacy paths.
  138. //
  139. // You may also find <Redirect />'s collocated next to the feature routes
  140. // they have redirects for. A good rule here is to place 'helper' redirects
  141. // next to the routes they redirect to, and place 'legacy route' redirects
  142. // for routes that have completely changed in this tree.
  143. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  144. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  145. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  146. <Route path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  147. </Route>
  148. ) : null;
  149. const rootRoutes = (
  150. <Fragment>
  151. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  152. {hook('routes:root')}
  153. <Route
  154. path="/accept/:orgId/:memberId/:token/"
  155. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  156. />
  157. <Route
  158. path="/accept/:memberId/:token/"
  159. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  160. />
  161. <Route
  162. path="/accept-transfer/"
  163. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  164. />
  165. <Route
  166. path="/extensions/external-install/:integrationSlug/:installationId"
  167. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  168. />
  169. <Route
  170. path="/extensions/:integrationSlug/link/"
  171. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  172. />
  173. <Route
  174. path="/sentry-apps/:sentryAppSlug/external-install/"
  175. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  176. />
  177. <Redirect from="/account/" to="/settings/account/details/" />
  178. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  179. {/* TODO: remove share/issue orgless url */}
  180. <Route
  181. path="/share/issue/:shareId/"
  182. component={make(() => import('sentry/views/sharedGroupDetails'))}
  183. />
  184. <Route
  185. path="/organizations/:orgId/share/issue/:shareId/"
  186. component={make(() => import('sentry/views/sharedGroupDetails'))}
  187. />
  188. <Route
  189. path="/organizations/new/"
  190. component={make(() => import('sentry/views/organizationCreate'))}
  191. />
  192. {usingCustomerDomain && (
  193. <Route
  194. path="/data-export/:dataExportId"
  195. component={withDomainRequired(
  196. make(() => import('sentry/views/dataExport/dataDownload'))
  197. )}
  198. key="orgless-data-export-route"
  199. />
  200. )}
  201. <Route
  202. path="/organizations/:orgId/data-export/:dataExportId"
  203. component={withDomainRedirect(
  204. make(() => import('sentry/views/dataExport/dataDownload'))
  205. )}
  206. key="org-data-export"
  207. />
  208. {usingCustomerDomain && (
  209. <Route
  210. path="/disabled-member/"
  211. component={withDomainRequired(
  212. make(() => import('sentry/views/disabledMember'))
  213. )}
  214. key="orgless-disabled-member-route"
  215. />
  216. )}
  217. <Route
  218. path="/organizations/:orgId/disabled-member/"
  219. component={withDomainRedirect(make(() => import('sentry/views/disabledMember')))}
  220. key="org-disabled-member"
  221. />
  222. {usingCustomerDomain && (
  223. <Route
  224. path="/join-request/"
  225. component={withDomainRequired(
  226. make(() => import('sentry/views/organizationJoinRequest'))
  227. )}
  228. key="orgless-join-request"
  229. />
  230. )}
  231. <Route
  232. path="/join-request/:orgId/"
  233. component={withDomainRedirect(
  234. make(() => import('sentry/views/organizationJoinRequest'))
  235. )}
  236. key="org-join-request"
  237. />
  238. {usingCustomerDomain && (
  239. <Route
  240. path="/onboarding/"
  241. component={errorHandler(withDomainRequired(OrganizationContextContainer))}
  242. key="orgless-onboarding"
  243. >
  244. <IndexRedirect to="welcome/" />
  245. <Route
  246. path=":step/"
  247. component={make(() => import('sentry/views/onboarding'))}
  248. />
  249. </Route>
  250. )}
  251. <Route
  252. path="/onboarding/:orgId/"
  253. component={withDomainRedirect(errorHandler(OrganizationContextContainer))}
  254. key="org-onboarding"
  255. >
  256. <IndexRedirect to="welcome/" />
  257. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  258. </Route>
  259. {usingCustomerDomain && (
  260. <Route
  261. path="/stories/"
  262. component={make(() => import('sentry/views/stories/index'))}
  263. key="orgless-stories"
  264. />
  265. )}
  266. <Route
  267. path="/organizations/:orgId/stories/"
  268. component={withDomainRedirect(make(() => import('sentry/views/stories/index')))}
  269. key="org-stories"
  270. />
  271. </Fragment>
  272. );
  273. const accountSettingsRoutes = (
  274. <Route
  275. path="account/"
  276. name={t('Account')}
  277. component={make(
  278. () => import('sentry/views/settings/account/accountSettingsLayout')
  279. )}
  280. >
  281. <IndexRedirect to="details/" />
  282. <Route
  283. path="details/"
  284. name={t('Details')}
  285. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  286. />
  287. <Route path="notifications/" name={t('Notifications')}>
  288. <IndexRoute
  289. component={make(
  290. () =>
  291. import(
  292. 'sentry/views/settings/account/notifications/notificationSettingsController'
  293. )
  294. )}
  295. />
  296. <Route
  297. path=":fineTuneType/"
  298. name={t('Fine Tune Alerts')}
  299. component={make(
  300. () =>
  301. import(
  302. 'sentry/views/settings/account/accountNotificationFineTuningController'
  303. )
  304. )}
  305. />
  306. </Route>
  307. <Route
  308. path="emails/"
  309. name={t('Emails')}
  310. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  311. />
  312. <Route
  313. path="authorizations/"
  314. component={make(
  315. () => import('sentry/views/settings/account/accountAuthorizations')
  316. )}
  317. />
  318. <Route path="security/" name={t('Security')}>
  319. <Route
  320. component={make(
  321. () =>
  322. import(
  323. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  324. )
  325. )}
  326. >
  327. <IndexRoute
  328. component={make(
  329. () => import('sentry/views/settings/account/accountSecurity')
  330. )}
  331. />
  332. <Route
  333. path="session-history/"
  334. name={t('Session History')}
  335. component={make(
  336. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  337. )}
  338. />
  339. <Route
  340. path="mfa/:authId/"
  341. name={t('Details')}
  342. component={make(
  343. () =>
  344. import(
  345. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  346. )
  347. )}
  348. />
  349. </Route>
  350. <Route
  351. path="mfa/:authId/enroll/"
  352. name={t('Enroll')}
  353. component={make(
  354. () =>
  355. import(
  356. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  357. )
  358. )}
  359. />
  360. </Route>
  361. <Route
  362. path="subscriptions/"
  363. name={t('Subscriptions')}
  364. component={make(
  365. () => import('sentry/views/settings/account/accountSubscriptions')
  366. )}
  367. />
  368. <Route
  369. path="identities/"
  370. name={t('Identities')}
  371. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  372. />
  373. <Route path="api/" name={t('API')}>
  374. <IndexRedirect to="auth-tokens/" />
  375. <Route path="auth-tokens/" name={t('User Auth Tokens')}>
  376. <IndexRoute
  377. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  378. />
  379. <Route
  380. path="new-token/"
  381. name={t('Create New Token')}
  382. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  383. />
  384. </Route>
  385. <Route path="applications/" name={t('Applications')}>
  386. <IndexRoute
  387. component={make(
  388. () => import('sentry/views/settings/account/apiApplications')
  389. )}
  390. />
  391. <Route
  392. path=":appId/"
  393. name={t('Details')}
  394. component={make(
  395. () => import('sentry/views/settings/account/apiApplications/details')
  396. )}
  397. />
  398. </Route>
  399. {hook('routes:api')}
  400. </Route>
  401. <Route
  402. path="close-account/"
  403. name={t('Close Account')}
  404. component={make(() => import('sentry/views/settings/account/accountClose'))}
  405. />
  406. </Route>
  407. );
  408. const projectSettingsRoutes = (
  409. <Route
  410. path="projects/:projectId/"
  411. name={t('Project')}
  412. component={make(
  413. () => import('sentry/views/settings/project/projectSettingsLayout')
  414. )}
  415. >
  416. <IndexRoute
  417. name={t('General')}
  418. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  419. />
  420. <Redirect from="install/" to="/projects/:projectId/getting-started/" />
  421. <Route
  422. path="teams/"
  423. name={t('Teams')}
  424. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  425. />
  426. <Route
  427. path="alerts/"
  428. name={t('Alerts')}
  429. component={make(() => import('sentry/views/settings/projectAlerts'))}
  430. >
  431. <IndexRoute
  432. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  433. />
  434. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  435. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  436. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  437. <Redirect
  438. from="metric-rules/new/"
  439. to="/organizations/:orgId/alerts/:projectId/new/"
  440. />
  441. <Redirect
  442. from="rules/:ruleId/"
  443. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  444. />
  445. <Redirect
  446. from="metric-rules/:ruleId/"
  447. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  448. />
  449. </Route>
  450. <Route
  451. path="environments/"
  452. name={t('Environments')}
  453. component={make(
  454. () => import('sentry/views/settings/project/projectEnvironments')
  455. )}
  456. >
  457. <IndexRoute />
  458. <Route path="hidden/" />
  459. </Route>
  460. <Route
  461. path="tags/"
  462. name={t('Tags')}
  463. component={make(() => import('sentry/views/settings/projectTags'))}
  464. />
  465. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  466. <Route
  467. path="release-tracking/"
  468. name={t('Release Tracking')}
  469. component={make(
  470. () => import('sentry/views/settings/project/projectReleaseTracking')
  471. )}
  472. />
  473. <Route
  474. path="ownership/"
  475. name={t('Ownership Rules')}
  476. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  477. />
  478. <Route
  479. path="data-forwarding/"
  480. name={t('Data Forwarding')}
  481. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  482. />
  483. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  484. <IndexRoute
  485. component={make(
  486. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  487. )}
  488. />
  489. <Route
  490. path="advanced-data-scrubbing/:scrubbingId/"
  491. component={make(
  492. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  493. )}
  494. />
  495. </Route>
  496. <Route
  497. path="debug-symbols/"
  498. name={t('Debug Information Files')}
  499. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  500. />
  501. <Route
  502. path="proguard/"
  503. name={t('ProGuard Mappings')}
  504. component={make(() => import('sentry/views/settings/projectProguard'))}
  505. />
  506. <Route
  507. path="performance/"
  508. name={t('Performance')}
  509. component={make(() => import('sentry/views/settings/projectPerformance'))}
  510. />
  511. <Route path="source-maps/" name={t('Source Maps')}>
  512. <IndexRoute
  513. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  514. />
  515. <Route
  516. path="artifact-bundles/"
  517. name={t('Artifact Bundles')}
  518. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  519. >
  520. <Route
  521. name={t('Artifact Bundle')}
  522. path=":bundleId/"
  523. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  524. />
  525. </Route>
  526. <Route
  527. path="release-bundles/"
  528. name={t('Release Bundles')}
  529. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  530. >
  531. <Route
  532. name={t('Release Bundle')}
  533. path=":bundleId/"
  534. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  535. />
  536. </Route>
  537. <Redirect from=":name/" to="release-bundles/:name/" />
  538. </Route>
  539. <Route
  540. path="processing-issues/"
  541. name={t('Processing Issues')}
  542. component={make(
  543. () => import('sentry/views/settings/project/projectProcessingIssues')
  544. )}
  545. />
  546. <Route
  547. path="filters/"
  548. name={t('Inbound Filters')}
  549. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  550. >
  551. <IndexRedirect to="data-filters/" />
  552. <Route path=":filterType/" />
  553. </Route>
  554. <Redirect from="dynamic-sampling/" to="performance/" />
  555. <Route
  556. path="issue-grouping/"
  557. name={t('Issue Grouping')}
  558. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  559. />
  560. <Route
  561. path="hooks/"
  562. name={t('Service Hooks')}
  563. component={make(
  564. () => import('sentry/views/settings/project/projectServiceHooks')
  565. )}
  566. />
  567. <Route
  568. path="hooks/new/"
  569. name={t('Create Service Hook')}
  570. component={make(
  571. () => import('sentry/views/settings/project/projectCreateServiceHook')
  572. )}
  573. />
  574. <Route
  575. path="hooks/:hookId/"
  576. name={t('Service Hook Details')}
  577. component={make(
  578. () => import('sentry/views/settings/project/projectServiceHookDetails')
  579. )}
  580. />
  581. <Route path="keys/" name={t('Client Keys')}>
  582. <IndexRoute
  583. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  584. />
  585. <Route
  586. path=":keyId/"
  587. name={t('Details')}
  588. component={make(
  589. () => import('sentry/views/settings/project/projectKeys/details')
  590. )}
  591. />
  592. </Route>
  593. <Route
  594. path="loader-script/"
  595. name={t('Loader Script')}
  596. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  597. />
  598. <Route
  599. path="user-feedback/"
  600. name={t('User Feedback')}
  601. component={make(
  602. () => import('sentry/views/settings/project/projectUserFeedback')
  603. )}
  604. />
  605. <Redirect from="csp/" to="security-headers/" />
  606. <Route path="security-headers/" name={t('Security Headers')}>
  607. <IndexRoute
  608. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  609. />
  610. <Route
  611. path="csp/"
  612. name={t('Content Security Policy')}
  613. component={make(
  614. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  615. )}
  616. />
  617. <Route
  618. path="expect-ct/"
  619. name={t('Certificate Transparency')}
  620. component={make(
  621. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  622. )}
  623. />
  624. <Route
  625. path="hpkp/"
  626. name={t('HPKP')}
  627. component={make(
  628. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  629. )}
  630. />
  631. </Route>
  632. <Route path="plugins/" name={t('Legacy Integrations')}>
  633. <IndexRoute
  634. component={make(() => import('sentry/views/settings/projectPlugins'))}
  635. />
  636. <Route
  637. path=":pluginId/"
  638. name={t('Integration Details')}
  639. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  640. />
  641. </Route>
  642. </Route>
  643. );
  644. const orgSettingsRoutes = (
  645. <Route
  646. component={make(
  647. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  648. )}
  649. >
  650. {hook('routes:organization')}
  651. {!usingCustomerDomain && (
  652. <IndexRoute
  653. name={t('General')}
  654. component={make(
  655. () => import('sentry/views/settings/organizationGeneralSettings')
  656. )}
  657. />
  658. )}
  659. {usingCustomerDomain && (
  660. <Route
  661. path="/settings/organization/"
  662. name={t('General')}
  663. component={make(
  664. () => import('sentry/views/settings/organizationGeneralSettings')
  665. )}
  666. />
  667. )}
  668. <Route
  669. path="projects/"
  670. name={t('Projects')}
  671. component={make(() => import('sentry/views/settings/organizationProjects'))}
  672. />
  673. <Route path="api-keys/" name={t('API Key')}>
  674. <IndexRoute
  675. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  676. />
  677. <Route
  678. path=":apiKey/"
  679. name={t('Details')}
  680. component={make(
  681. () =>
  682. import(
  683. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  684. )
  685. )}
  686. />
  687. </Route>
  688. <Route
  689. path="audit-log/"
  690. name={t('Audit Log')}
  691. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  692. />
  693. <Route
  694. path="auth/"
  695. name={t('Auth Providers')}
  696. component={make(() => import('sentry/views/settings/organizationAuth'))}
  697. />
  698. <Redirect from="members/requests" to="members/" />
  699. <Route path="members/" name={t('Members')}>
  700. <Route
  701. component={make(
  702. () =>
  703. import(
  704. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  705. )
  706. )}
  707. >
  708. <IndexRoute
  709. component={make(
  710. () =>
  711. import(
  712. 'sentry/views/settings/organizationMembers/organizationMembersList'
  713. )
  714. )}
  715. />
  716. </Route>
  717. <Route
  718. path=":memberId/"
  719. name={t('Details')}
  720. component={make(
  721. () =>
  722. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  723. )}
  724. />
  725. </Route>
  726. <Route
  727. path="rate-limits/"
  728. name={t('Rate Limits')}
  729. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  730. />
  731. <Route
  732. path="relay/"
  733. name={t('Relay')}
  734. component={make(() => import('sentry/views/settings/organizationRelay'))}
  735. />
  736. <Route
  737. path="repos/"
  738. name={t('Repositories')}
  739. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  740. />
  741. <Route
  742. path="settings/"
  743. component={make(
  744. () => import('sentry/views/settings/organizationGeneralSettings')
  745. )}
  746. />
  747. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  748. <IndexRoute
  749. component={make(
  750. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  751. )}
  752. />
  753. <Route
  754. path="advanced-data-scrubbing/:scrubbingId/"
  755. component={make(
  756. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  757. )}
  758. />
  759. </Route>
  760. <Route path="teams/" name={t('Teams')}>
  761. <IndexRoute
  762. component={make(() => import('sentry/views/settings/organizationTeams'))}
  763. />
  764. <Route
  765. path=":teamId/"
  766. name={t('Team')}
  767. component={make(
  768. () => import('sentry/views/settings/organizationTeams/teamDetails')
  769. )}
  770. >
  771. <IndexRedirect to="members/" />
  772. <Route
  773. path="members/"
  774. name={t('Members')}
  775. component={make(
  776. () => import('sentry/views/settings/organizationTeams/teamMembers')
  777. )}
  778. />
  779. <Route
  780. path="notifications/"
  781. name={t('Notifications')}
  782. component={make(
  783. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  784. )}
  785. />
  786. <Route
  787. path="projects/"
  788. name={t('Projects')}
  789. component={make(
  790. () => import('sentry/views/settings/organizationTeams/teamProjects')
  791. )}
  792. />
  793. <Route
  794. path="settings/"
  795. name={t('Settings')}
  796. component={make(
  797. () => import('sentry/views/settings/organizationTeams/teamSettings')
  798. )}
  799. />
  800. </Route>
  801. </Route>
  802. <Redirect from="plugins/" to="integrations/" />
  803. <Route path="plugins/" name={t('Integrations')}>
  804. <Route
  805. path=":integrationSlug/"
  806. name={t('Integration Details')}
  807. component={make(
  808. () =>
  809. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  810. )}
  811. />
  812. </Route>
  813. <Redirect from="sentry-apps/" to="integrations/" />
  814. <Route path="sentry-apps/" name={t('Integrations')}>
  815. <Route
  816. path=":integrationSlug"
  817. name={t('Details')}
  818. component={make(
  819. () =>
  820. import(
  821. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  822. )
  823. )}
  824. />
  825. </Route>
  826. <Redirect from="document-integrations/" to="integrations/" />
  827. <Route path="document-integrations/" name={t('Integrations')}>
  828. <Route
  829. path=":integrationSlug"
  830. name={t('Details')}
  831. component={make(
  832. () =>
  833. import(
  834. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  835. )
  836. )}
  837. />
  838. </Route>
  839. <Route path="integrations/" name={t('Integrations')}>
  840. <IndexRoute
  841. component={make(
  842. () =>
  843. import(
  844. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  845. )
  846. )}
  847. />
  848. <Route
  849. path=":integrationSlug"
  850. name={t('Integration Details')}
  851. component={make(
  852. () =>
  853. import(
  854. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  855. )
  856. )}
  857. />
  858. <Route
  859. path=":providerKey/:integrationId/"
  860. name={t('Configure Integration')}
  861. component={make(
  862. () =>
  863. import(
  864. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  865. )
  866. )}
  867. />
  868. </Route>
  869. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  870. <Route path="developer-settings/" name={t('Custom Integrations')}>
  871. <IndexRoute
  872. component={make(
  873. () => import('sentry/views/settings/organizationDeveloperSettings')
  874. )}
  875. />
  876. <Route
  877. path="new-public/"
  878. name={t('Create Integration')}
  879. component={make(
  880. () =>
  881. import(
  882. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  883. )
  884. )}
  885. />
  886. <Route
  887. path="new-internal/"
  888. name={t('Create Integration')}
  889. component={make(
  890. () =>
  891. import(
  892. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  893. )
  894. )}
  895. />
  896. <Route
  897. path=":appSlug/"
  898. name={t('Edit Integration')}
  899. component={make(
  900. () =>
  901. import(
  902. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  903. )
  904. )}
  905. />
  906. <Route
  907. path=":appSlug/dashboard/"
  908. name={t('Integration Dashboard')}
  909. component={make(
  910. () =>
  911. import(
  912. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  913. )
  914. )}
  915. />
  916. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  917. <Route
  918. path="new/"
  919. name={t('Create Sentry Function')}
  920. component={make(
  921. () =>
  922. import(
  923. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  924. )
  925. )}
  926. />
  927. <Route
  928. path=":functionSlug/"
  929. name={t('Edit Sentry Function')}
  930. component={make(
  931. () =>
  932. import(
  933. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  934. )
  935. )}
  936. />
  937. </Route>
  938. </Route>
  939. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  940. <IndexRoute
  941. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  942. />
  943. <Route
  944. path="new-token/"
  945. name={t('Create New Auth Token')}
  946. component={make(
  947. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  948. )}
  949. />
  950. <Route
  951. path=":tokenId/"
  952. name={t('Edit Auth Token')}
  953. component={make(
  954. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  955. )}
  956. />
  957. </Route>
  958. </Route>
  959. );
  960. const legacySettingsRedirects = (
  961. <Fragment>
  962. <Redirect from=":projectId/" to="projects/:projectId/" />
  963. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  964. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  965. <Redirect
  966. from=":projectId/alerts/rules/:ruleId/"
  967. to="projects/:projectId/alerts/rules/:ruleId/"
  968. />
  969. </Fragment>
  970. );
  971. const settingsRoutes = (
  972. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  973. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  974. {accountSettingsRoutes}
  975. <Fragment>
  976. {usingCustomerDomain && (
  977. <Route
  978. name={t('Organization')}
  979. component={withDomainRequired(NoOp)}
  980. key="orgless-settings-route"
  981. >
  982. {orgSettingsRoutes}
  983. {projectSettingsRoutes}
  984. </Route>
  985. )}
  986. <Route
  987. path=":orgId/"
  988. name={t('Organization')}
  989. component={withDomainRedirect(NoOp)}
  990. key="org-settings"
  991. >
  992. {orgSettingsRoutes}
  993. {projectSettingsRoutes}
  994. {legacySettingsRedirects}
  995. </Route>
  996. </Fragment>
  997. </Route>
  998. );
  999. const projectsChildRoutes = (
  1000. <Fragment>
  1001. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1002. <Route
  1003. path="new/"
  1004. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1005. />
  1006. <Route
  1007. path=":projectId/"
  1008. component={make(() => import('sentry/views/projectDetail'))}
  1009. />
  1010. <Route
  1011. path=":projectId/events/:eventId/"
  1012. component={errorHandler(ProjectEventRedirect)}
  1013. />
  1014. <Route
  1015. path=":projectId/getting-started/"
  1016. component={make(
  1017. () => import('sentry/views/projectInstall/platformOrIntegration')
  1018. )}
  1019. />
  1020. </Fragment>
  1021. );
  1022. const projectsRoutes = (
  1023. <Fragment>
  1024. {usingCustomerDomain && (
  1025. <Route
  1026. path="/projects/"
  1027. component={make(() => import('sentry/views/projects/'))}
  1028. key="orgless-projects-route"
  1029. >
  1030. {projectsChildRoutes}
  1031. </Route>
  1032. )}
  1033. <Route
  1034. path="/organizations/:orgId/projects/"
  1035. component={make(() => import('sentry/views/projects/'))}
  1036. key="org-projects"
  1037. >
  1038. {projectsChildRoutes}
  1039. </Route>
  1040. </Fragment>
  1041. );
  1042. const dashboardWidgetRoutes = (
  1043. <Fragment>
  1044. <Route
  1045. path="widget/:widgetIndex/edit/"
  1046. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1047. />
  1048. <Route
  1049. path="widget/new/"
  1050. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1051. />
  1052. <Route
  1053. path="widget/:widgetId/"
  1054. component={make(() => import('sentry/views/dashboards/view'))}
  1055. />
  1056. </Fragment>
  1057. );
  1058. const dashboardRoutes = (
  1059. <Fragment>
  1060. <Fragment>
  1061. {usingCustomerDomain && (
  1062. <Route
  1063. path="/dashboards/"
  1064. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1065. key="orgless-dashboards-route"
  1066. >
  1067. <IndexRoute
  1068. component={make(() => import('sentry/views/dashboards/manage'))}
  1069. />
  1070. </Route>
  1071. )}
  1072. <Route
  1073. path="/organizations/:orgId/dashboards/"
  1074. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1075. key="org-dashboards"
  1076. >
  1077. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1078. </Route>
  1079. </Fragment>
  1080. <Fragment>
  1081. {usingCustomerDomain && (
  1082. <Route
  1083. path="/dashboards/new/"
  1084. component={withDomainRequired(
  1085. make(() => import('sentry/views/dashboards/create'))
  1086. )}
  1087. key="orgless-dashboards-new-route"
  1088. >
  1089. <Route
  1090. path="widget/:widgetIndex/edit/"
  1091. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1092. />
  1093. <Route
  1094. path="widget/new/"
  1095. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1096. />
  1097. </Route>
  1098. )}
  1099. <Route
  1100. path="/organizations/:orgId/dashboards/new/"
  1101. component={withDomainRedirect(
  1102. make(() => import('sentry/views/dashboards/create'))
  1103. )}
  1104. key="org-dashboards-new"
  1105. >
  1106. <Route
  1107. path="widget/:widgetIndex/edit/"
  1108. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1109. />
  1110. <Route
  1111. path="widget/new/"
  1112. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1113. />
  1114. </Route>
  1115. </Fragment>
  1116. <Fragment>
  1117. {usingCustomerDomain && (
  1118. <Route
  1119. path="/dashboards/new/:templateId"
  1120. component={withDomainRequired(
  1121. make(() => import('sentry/views/dashboards/create'))
  1122. )}
  1123. key="orgless-dashboards-new-template-route"
  1124. >
  1125. <Route
  1126. path="widget/:widgetId/"
  1127. component={make(() => import('sentry/views/dashboards/create'))}
  1128. />
  1129. </Route>
  1130. )}
  1131. <Route
  1132. path="/organizations/:orgId/dashboards/new/:templateId"
  1133. component={withDomainRedirect(
  1134. make(() => import('sentry/views/dashboards/create'))
  1135. )}
  1136. key="org-dashboards-new-template"
  1137. >
  1138. <Route
  1139. path="widget/:widgetId/"
  1140. component={make(() => import('sentry/views/dashboards/create'))}
  1141. />
  1142. </Route>
  1143. </Fragment>
  1144. <Redirect
  1145. from="/organizations/:orgId/dashboards/:dashboardId/"
  1146. to="/organizations/:orgId/dashboard/:dashboardId/"
  1147. />
  1148. {usingCustomerDomain && (
  1149. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1150. )}
  1151. <Fragment>
  1152. {usingCustomerDomain && (
  1153. <Route
  1154. path="/dashboard/:dashboardId/"
  1155. component={withDomainRequired(
  1156. make(() => import('sentry/views/dashboards/view'))
  1157. )}
  1158. key="orgless-dashboards-dashboard-id-route"
  1159. >
  1160. {dashboardWidgetRoutes}
  1161. </Route>
  1162. )}
  1163. <Route
  1164. path="/organizations/:orgId/dashboard/:dashboardId/"
  1165. component={withDomainRedirect(
  1166. make(() => import('sentry/views/dashboards/view'))
  1167. )}
  1168. key="org-dashboards-dashboard-id"
  1169. >
  1170. {dashboardWidgetRoutes}
  1171. </Route>
  1172. </Fragment>
  1173. </Fragment>
  1174. );
  1175. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1176. return (
  1177. <Fragment>
  1178. <IndexRoute
  1179. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1180. />
  1181. <Route path="rules/">
  1182. <IndexRoute
  1183. component={make(
  1184. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1185. )}
  1186. />
  1187. <Route
  1188. path="details/:ruleId/"
  1189. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1190. />
  1191. <Route
  1192. path=":projectId/"
  1193. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1194. >
  1195. <IndexRedirect
  1196. to={
  1197. forCustomerDomain
  1198. ? '/alerts/rules/'
  1199. : '/organizations/:orgId/alerts/rules/'
  1200. }
  1201. />
  1202. <Route
  1203. path=":ruleId/"
  1204. component={make(() => import('sentry/views/alerts/edit'))}
  1205. />
  1206. </Route>
  1207. <Route path=":projectId/:ruleId/details/">
  1208. <IndexRoute
  1209. component={make(
  1210. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1211. )}
  1212. />
  1213. </Route>
  1214. </Route>
  1215. <Route path="metric-rules/">
  1216. <IndexRedirect
  1217. to={
  1218. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1219. }
  1220. />
  1221. <Route
  1222. path=":projectId/"
  1223. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1224. >
  1225. <IndexRedirect
  1226. to={
  1227. forCustomerDomain
  1228. ? '/alerts/rules/'
  1229. : '/organizations/:orgId/alerts/rules/'
  1230. }
  1231. />
  1232. <Route
  1233. path=":ruleId/"
  1234. component={make(() => import('sentry/views/alerts/edit'))}
  1235. />
  1236. </Route>
  1237. </Route>
  1238. <Route
  1239. path="wizard/"
  1240. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1241. >
  1242. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1243. </Route>
  1244. <Route
  1245. path="new/"
  1246. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1247. >
  1248. <IndexRedirect
  1249. to={
  1250. forCustomerDomain
  1251. ? '/alerts/wizard/'
  1252. : '/organizations/:orgId/alerts/wizard/'
  1253. }
  1254. />
  1255. <Route
  1256. path=":alertType/"
  1257. component={make(() => import('sentry/views/alerts/create'))}
  1258. />
  1259. </Route>
  1260. <Route
  1261. path=":alertId/"
  1262. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1263. />
  1264. <Route
  1265. path=":projectId/"
  1266. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1267. >
  1268. <Route
  1269. path="new/"
  1270. component={make(() => import('sentry/views/alerts/create'))}
  1271. />
  1272. <Route
  1273. path="wizard/"
  1274. component={make(() => import('sentry/views/alerts/wizard'))}
  1275. />
  1276. </Route>
  1277. </Fragment>
  1278. );
  1279. };
  1280. const alertRoutes = (
  1281. <Fragment>
  1282. {usingCustomerDomain && (
  1283. <Route
  1284. path="/alerts/"
  1285. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1286. key="orgless-alerts-route"
  1287. >
  1288. {alertChildRoutes({forCustomerDomain: true})}
  1289. </Route>
  1290. )}
  1291. <Route
  1292. path="/organizations/:orgId/alerts/"
  1293. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1294. key="org-alerts"
  1295. >
  1296. {alertChildRoutes({forCustomerDomain: false})}
  1297. </Route>
  1298. </Fragment>
  1299. );
  1300. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1301. return (
  1302. <Fragment>
  1303. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1304. <Route
  1305. path={
  1306. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1307. }
  1308. component={make(() => import('sentry/views/monitors/create'))}
  1309. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1310. />
  1311. <Route
  1312. path={
  1313. forCustomerDomain
  1314. ? '/crons/:monitorSlug/'
  1315. : '/organizations/:orgId/crons/:monitorSlug/'
  1316. }
  1317. component={make(() => import('sentry/views/monitors/details'))}
  1318. key={
  1319. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1320. }
  1321. />
  1322. <Route
  1323. path={
  1324. forCustomerDomain
  1325. ? '/crons/:monitorSlug/edit/'
  1326. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1327. }
  1328. component={make(() => import('sentry/views/monitors/edit'))}
  1329. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1330. />
  1331. </Fragment>
  1332. );
  1333. };
  1334. const cronsRoutes = (
  1335. <Fragment>
  1336. {usingCustomerDomain && (
  1337. <Route
  1338. path="/crons/"
  1339. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1340. key="orgless-monitors-route"
  1341. >
  1342. {cronsChildRoutes({forCustomerDomain: true})}
  1343. </Route>
  1344. )}
  1345. <Route
  1346. path="/organizations/:orgId/crons/"
  1347. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1348. key="org-monitors"
  1349. >
  1350. {cronsChildRoutes({forCustomerDomain: false})}
  1351. </Route>
  1352. </Fragment>
  1353. );
  1354. const replayChildRoutes = (
  1355. <Fragment>
  1356. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1357. <Route
  1358. path="selectors/"
  1359. component={make(
  1360. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1361. )}
  1362. />
  1363. <Route
  1364. path=":replaySlug/"
  1365. component={make(() => import('sentry/views/replays/details'))}
  1366. />
  1367. </Fragment>
  1368. );
  1369. const replayRoutes = (
  1370. <Fragment>
  1371. {usingCustomerDomain && (
  1372. <Route
  1373. path="/replays/"
  1374. component={withDomainRequired(make(() => import('sentry/views/replays/index')))}
  1375. key="orgless-replays-route"
  1376. >
  1377. {replayChildRoutes}
  1378. </Route>
  1379. )}
  1380. <Route
  1381. path="/organizations/:orgId/replays/"
  1382. component={withDomainRedirect(make(() => import('sentry/views/replays/index')))}
  1383. key="org-replays"
  1384. >
  1385. {replayChildRoutes}
  1386. </Route>
  1387. </Fragment>
  1388. );
  1389. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1390. return (
  1391. <Fragment>
  1392. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1393. <Route
  1394. path=":release/"
  1395. component={make(() => import('sentry/views/releases/detail'))}
  1396. >
  1397. <IndexRoute
  1398. component={make(() => import('sentry/views/releases/detail/overview'))}
  1399. />
  1400. <Route
  1401. path="commits/"
  1402. component={make(
  1403. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1404. )}
  1405. />
  1406. <Route
  1407. path="files-changed/"
  1408. component={make(
  1409. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1410. )}
  1411. />
  1412. {forCustomerDomain ? null : (
  1413. <Fragment>
  1414. <Redirect
  1415. from="new-events/"
  1416. to="/organizations/:orgId/releases/:release/"
  1417. />
  1418. <Redirect
  1419. from="all-events/"
  1420. to="/organizations/:orgId/releases/:release/"
  1421. />
  1422. </Fragment>
  1423. )}
  1424. </Route>
  1425. </Fragment>
  1426. );
  1427. };
  1428. const releasesRoutes = (
  1429. <Fragment>
  1430. {usingCustomerDomain && (
  1431. <Route
  1432. path="/releases/"
  1433. component={withDomainRequired(NoOp)}
  1434. key="orgless-releases-route"
  1435. >
  1436. {releasesChildRoutes({forCustomerDomain: true})}
  1437. </Route>
  1438. )}
  1439. <Route
  1440. path="/organizations/:orgId/releases/"
  1441. component={withDomainRedirect(NoOp)}
  1442. key="org-releases"
  1443. >
  1444. {releasesChildRoutes({forCustomerDomain: false})}
  1445. </Route>
  1446. </Fragment>
  1447. );
  1448. const activityRoutes = (
  1449. <Fragment>
  1450. {usingCustomerDomain && (
  1451. <Route
  1452. path="/activity/"
  1453. component={withDomainRequired(
  1454. make(() => import('sentry/views/organizationActivity'))
  1455. )}
  1456. key="orgless-activity-route"
  1457. />
  1458. )}
  1459. <Route
  1460. path="/organizations/:orgId/activity/"
  1461. component={withDomainRedirect(
  1462. make(() => import('sentry/views/organizationActivity'))
  1463. )}
  1464. key="org-activity"
  1465. />
  1466. </Fragment>
  1467. );
  1468. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1469. return (
  1470. <Fragment>
  1471. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1472. <Route
  1473. path="issues/"
  1474. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1475. >
  1476. <IndexRoute
  1477. component={make(
  1478. () => import('sentry/views/organizationStats/teamInsights/issues')
  1479. )}
  1480. />
  1481. </Route>
  1482. <Route
  1483. path="health/"
  1484. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1485. >
  1486. <IndexRoute
  1487. component={make(
  1488. () => import('sentry/views/organizationStats/teamInsights/health')
  1489. )}
  1490. />
  1491. </Route>
  1492. {forCustomerDomain ? null : (
  1493. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1494. )}
  1495. </Fragment>
  1496. );
  1497. };
  1498. const statsRoutes = (
  1499. <Fragment>
  1500. {usingCustomerDomain && (
  1501. <Route
  1502. path="/stats/"
  1503. component={withDomainRequired(NoOp)}
  1504. key="orgless-stats-route"
  1505. >
  1506. {statsChildRoutes({forCustomerDomain: true})}
  1507. </Route>
  1508. )}
  1509. <Route
  1510. path="/organizations/:orgId/stats/"
  1511. component={withDomainRedirect(NoOp)}
  1512. key="org-stats"
  1513. >
  1514. {statsChildRoutes({forCustomerDomain: false})}
  1515. </Route>
  1516. </Fragment>
  1517. );
  1518. // TODO(mark) Long term this /queries route should go away and /discover
  1519. // should be the canonical route for discover2. We have a redirect right now
  1520. // as /discover was for discover 1 and most of the application is linking to
  1521. // /discover/queries and not /discover
  1522. const discoverChildRoutes = (
  1523. <Fragment>
  1524. <IndexRedirect to="queries/" />
  1525. <Route
  1526. path="homepage/"
  1527. component={make(() => import('sentry/views/discover/homepage'))}
  1528. />
  1529. <Route
  1530. path="queries/"
  1531. component={make(() => import('sentry/views/discover/landing'))}
  1532. />
  1533. <Route
  1534. path="results/"
  1535. component={make(() => import('sentry/views/discover/results'))}
  1536. />
  1537. <Route
  1538. path=":eventSlug/"
  1539. component={make(() => import('sentry/views/discover/eventDetails'))}
  1540. />
  1541. </Fragment>
  1542. );
  1543. const discoverRoutes = (
  1544. <Fragment>
  1545. {usingCustomerDomain && (
  1546. <Route
  1547. path="/discover/"
  1548. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1549. key="orgless-discover-route"
  1550. >
  1551. {discoverChildRoutes}
  1552. </Route>
  1553. )}
  1554. <Route
  1555. path="/organizations/:orgId/discover/"
  1556. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1557. key="org-discover-route"
  1558. >
  1559. {discoverChildRoutes}
  1560. </Route>
  1561. </Fragment>
  1562. );
  1563. const performanceChildRoutes = (
  1564. <Fragment>
  1565. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1566. <Route
  1567. path="trends/"
  1568. component={make(() => import('sentry/views/performance/trends'))}
  1569. />
  1570. <Route path="database/">
  1571. <IndexRoute
  1572. component={make(
  1573. () => import('sentry/views/performance/database/databaseLandingPage')
  1574. )}
  1575. />
  1576. <Route
  1577. path="spans/span/:groupId/"
  1578. component={make(
  1579. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1580. )}
  1581. />
  1582. </Route>
  1583. <Route path="browser/">
  1584. <Route path="interactions/">
  1585. <IndexRoute
  1586. component={make(
  1587. () => import('sentry/views/performance/browser/interactionsLandingPage')
  1588. )}
  1589. />
  1590. <Route
  1591. path="summary/"
  1592. component={make(
  1593. () => import('sentry/views/performance/browser/interactionSummary/index')
  1594. )}
  1595. />
  1596. </Route>
  1597. <Route
  1598. path="pageloads/"
  1599. component={make(
  1600. () =>
  1601. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1602. )}
  1603. />
  1604. <Route
  1605. path="resources/"
  1606. component={make(
  1607. () => import('sentry/views/performance/browser/resources/index')
  1608. )}
  1609. />
  1610. </Route>
  1611. <Route path="summary/">
  1612. <IndexRoute
  1613. component={make(
  1614. () =>
  1615. import('sentry/views/performance/transactionSummary/transactionOverview')
  1616. )}
  1617. />
  1618. <Route
  1619. path="replays/"
  1620. component={make(
  1621. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1622. )}
  1623. />
  1624. <Route
  1625. path="vitals/"
  1626. component={make(
  1627. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1628. )}
  1629. />
  1630. <Route
  1631. path="tags/"
  1632. component={make(
  1633. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1634. )}
  1635. />
  1636. <Route
  1637. path="events/"
  1638. component={make(
  1639. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1640. )}
  1641. />
  1642. <Route
  1643. path="anomalies/"
  1644. component={make(
  1645. () =>
  1646. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1647. )}
  1648. />
  1649. <Route
  1650. path="profiles/"
  1651. component={make(
  1652. () =>
  1653. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1654. )}
  1655. />
  1656. <Route
  1657. path="aggregateWaterfall/"
  1658. component={make(
  1659. () =>
  1660. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1661. )}
  1662. />
  1663. <Route path="spans/">
  1664. <IndexRoute
  1665. component={make(
  1666. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1667. )}
  1668. />
  1669. <Route
  1670. path=":spanSlug/"
  1671. component={make(
  1672. () =>
  1673. import(
  1674. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1675. )
  1676. )}
  1677. />
  1678. </Route>
  1679. </Route>
  1680. <Route
  1681. path="vitaldetail/"
  1682. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1683. />
  1684. <Route
  1685. path="trace/:traceSlug/"
  1686. component={make(() => import('sentry/views/performance/traceDetails'))}
  1687. />
  1688. <Route
  1689. path=":eventSlug/"
  1690. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1691. />
  1692. </Fragment>
  1693. );
  1694. const performanceRoutes = (
  1695. <Fragment>
  1696. {usingCustomerDomain && (
  1697. <Route
  1698. path="/performance/"
  1699. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1700. key="orgless-performance-route"
  1701. >
  1702. {performanceChildRoutes}
  1703. </Route>
  1704. )}
  1705. <Route
  1706. path="/organizations/:orgId/performance/"
  1707. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1708. key="org-performance"
  1709. >
  1710. {performanceChildRoutes}
  1711. </Route>
  1712. </Fragment>
  1713. );
  1714. const starfishChildRoutes = (
  1715. <Fragment>
  1716. <IndexRoute
  1717. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1718. />
  1719. <Route path="endpoint-overview/">
  1720. <IndexRoute
  1721. component={make(
  1722. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1723. )}
  1724. />
  1725. <Route
  1726. path="span/:groupId/"
  1727. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1728. />
  1729. </Route>
  1730. <Redirect from="database/" to="/performance/database" />
  1731. <Route path="initialization/">
  1732. <IndexRoute
  1733. component={make(
  1734. () => import('sentry/views/starfish/modules/mobile/initialization')
  1735. )}
  1736. />
  1737. </Route>
  1738. <Route path="pageload/">
  1739. <IndexRoute
  1740. component={make(() => import('sentry/views/starfish/modules/mobile/pageload'))}
  1741. />
  1742. <Route
  1743. path="spans/"
  1744. component={make(
  1745. () => import('sentry/views/starfish/views/screens/screenLoadSpans')
  1746. )}
  1747. />
  1748. </Route>
  1749. <Route path="responsiveness/">
  1750. <IndexRoute
  1751. component={make(
  1752. () => import('sentry/views/starfish/modules/mobile/responsiveness')
  1753. )}
  1754. />
  1755. </Route>
  1756. <Route path="spans/">
  1757. <IndexRoute component={make(() => import('sentry/views/starfish/views/spans'))} />
  1758. <Route
  1759. path="span/:groupId/"
  1760. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1761. />
  1762. </Route>
  1763. </Fragment>
  1764. );
  1765. const starfishRoutes = (
  1766. <Fragment>
  1767. {usingCustomerDomain && (
  1768. <Route
  1769. path="/starfish/"
  1770. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1771. key="orgless-starfish-route"
  1772. >
  1773. {starfishChildRoutes}
  1774. </Route>
  1775. )}
  1776. <Route
  1777. path="/organizations/:orgId/starfish/"
  1778. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1779. key="org-starfish"
  1780. >
  1781. {starfishChildRoutes}
  1782. </Route>
  1783. </Fragment>
  1784. );
  1785. const userFeedbackRoutes = (
  1786. <Fragment>
  1787. {usingCustomerDomain && (
  1788. <Route
  1789. path="/user-feedback/"
  1790. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1791. key="orgless-user-feedback-route"
  1792. />
  1793. )}
  1794. <Route
  1795. path="/organizations/:orgId/user-feedback/"
  1796. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1797. key="org-user-feedback"
  1798. />
  1799. </Fragment>
  1800. );
  1801. const feedbackChildRoutes = (
  1802. <Fragment>
  1803. <IndexRoute
  1804. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1805. />
  1806. </Fragment>
  1807. );
  1808. const feedbackv2Routes = (
  1809. <Fragment>
  1810. {usingCustomerDomain && (
  1811. <Route
  1812. path="/feedback/"
  1813. component={withDomainRequired(
  1814. make(() => import('sentry/views/feedback/index'))
  1815. )}
  1816. key="orgless-feedback-list-route"
  1817. >
  1818. {feedbackChildRoutes}
  1819. </Route>
  1820. )}
  1821. <Route
  1822. path="/organizations/:orgId/feedback/"
  1823. component={withDomainRedirect(make(() => import('sentry/views/feedback/index')))}
  1824. key="org-feedback-list-route"
  1825. >
  1826. {feedbackChildRoutes}
  1827. </Route>
  1828. </Fragment>
  1829. );
  1830. const issueListRoutes = (
  1831. <Fragment>
  1832. {usingCustomerDomain && (
  1833. <Route
  1834. path="/issues/(searches/:searchId/)"
  1835. component={withDomainRequired(errorHandler(IssueListContainer))}
  1836. key="orgless-issues-route"
  1837. >
  1838. <IndexRoute component={errorHandler(IssueListOverview)} />
  1839. </Route>
  1840. )}
  1841. <Route
  1842. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1843. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1844. key="org-issues"
  1845. >
  1846. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1847. <IndexRoute component={errorHandler(IssueListOverview)} />
  1848. </Route>
  1849. </Fragment>
  1850. );
  1851. // Once org issues is complete, these routes can be nested under
  1852. // /organizations/:orgId/issues
  1853. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1854. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1855. return (
  1856. <Fragment>
  1857. <IndexRoute
  1858. component={hoc(
  1859. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1860. )}
  1861. />
  1862. <Route
  1863. path={TabPaths[Tab.REPLAYS]}
  1864. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1865. />
  1866. <Route
  1867. path={TabPaths[Tab.ACTIVITY]}
  1868. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1869. />
  1870. <Route
  1871. path={TabPaths[Tab.EVENTS]}
  1872. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1873. />
  1874. <Route
  1875. path={TabPaths[Tab.TAGS]}
  1876. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1877. />
  1878. <Route
  1879. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1880. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1881. />
  1882. <Route
  1883. path={TabPaths[Tab.USER_FEEDBACK]}
  1884. component={hoc(
  1885. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1886. )}
  1887. />
  1888. <Route
  1889. path={TabPaths[Tab.ATTACHMENTS]}
  1890. component={hoc(
  1891. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1892. )}
  1893. />
  1894. <Route
  1895. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1896. component={hoc(
  1897. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1898. )}
  1899. />
  1900. <Route
  1901. path={TabPaths[Tab.MERGED]}
  1902. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1903. />
  1904. </Fragment>
  1905. );
  1906. };
  1907. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1908. <Fragment>
  1909. {issueTabs({forCustomerDomain})}
  1910. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1911. {issueTabs({forCustomerDomain})}
  1912. </Route>
  1913. </Fragment>
  1914. );
  1915. const issueDetailsRoutes = (
  1916. <Fragment>
  1917. <Route
  1918. path="/organizations/:orgId/issues/:groupId/"
  1919. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1920. key="org-issues-group-id"
  1921. >
  1922. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1923. </Route>
  1924. {usingCustomerDomain && (
  1925. <Route
  1926. path="/issues/:groupId/"
  1927. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1928. key="orgless-issues-group-id-route"
  1929. >
  1930. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1931. </Route>
  1932. )}
  1933. </Fragment>
  1934. );
  1935. // These are the "manage" pages. For sentry.io, these are _different_ from
  1936. // the SaaS admin routes in getsentry.
  1937. const adminManageRoutes = (
  1938. <Route
  1939. path="/manage/"
  1940. component={make(() => import('sentry/views/admin/adminLayout'))}
  1941. >
  1942. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1943. <Route
  1944. path="buffer/"
  1945. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1946. />
  1947. <Route
  1948. path="relays/"
  1949. component={make(() => import('sentry/views/admin/adminRelays'))}
  1950. />
  1951. <Route
  1952. path="organizations/"
  1953. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1954. />
  1955. <Route
  1956. path="projects/"
  1957. component={make(() => import('sentry/views/admin/adminProjects'))}
  1958. />
  1959. <Route
  1960. path="queue/"
  1961. component={make(() => import('sentry/views/admin/adminQueue'))}
  1962. />
  1963. <Route
  1964. path="quotas/"
  1965. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1966. />
  1967. <Route
  1968. path="settings/"
  1969. component={make(() => import('sentry/views/admin/adminSettings'))}
  1970. />
  1971. <Route path="users/">
  1972. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1973. <Route
  1974. path=":id"
  1975. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1976. />
  1977. </Route>
  1978. <Route
  1979. path="status/mail/"
  1980. component={make(() => import('sentry/views/admin/adminMail'))}
  1981. />
  1982. <Route
  1983. path="status/environment/"
  1984. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1985. />
  1986. <Route
  1987. path="status/packages/"
  1988. component={make(() => import('sentry/views/admin/adminPackages'))}
  1989. />
  1990. <Route
  1991. path="status/warnings/"
  1992. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1993. />
  1994. </Route>
  1995. );
  1996. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1997. // me why we need the OrganizationRoot root container.
  1998. const legacyOrganizationRootRoutes = (
  1999. <Route component={errorHandler(OrganizationRoot)}>
  2000. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  2001. <Route path="/organizations/:orgId/">
  2002. {hook('routes:organization')}
  2003. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  2004. <Redirect
  2005. from="/organizations/:orgId/teams/your-teams/"
  2006. to="/settings/:orgId/teams/"
  2007. />
  2008. <Redirect
  2009. from="/organizations/:orgId/teams/all-teams/"
  2010. to="/settings/:orgId/teams/"
  2011. />
  2012. <Redirect
  2013. from="/organizations/:orgId/teams/:teamId/"
  2014. to="/settings/:orgId/teams/:teamId/"
  2015. />
  2016. <Redirect
  2017. from="/organizations/:orgId/teams/:teamId/members/"
  2018. to="/settings/:orgId/teams/:teamId/members/"
  2019. />
  2020. <Redirect
  2021. from="/organizations/:orgId/teams/:teamId/projects/"
  2022. to="/settings/:orgId/teams/:teamId/projects/"
  2023. />
  2024. <Redirect
  2025. from="/organizations/:orgId/teams/:teamId/settings/"
  2026. to="/settings/:orgId/teams/:teamId/settings/"
  2027. />
  2028. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  2029. <Redirect
  2030. from="/organizations/:orgId/api-keys/"
  2031. to="/settings/:orgId/api-keys/"
  2032. />
  2033. <Redirect
  2034. from="/organizations/:orgId/api-keys/:apiKey/"
  2035. to="/settings/:orgId/api-keys/:apiKey/"
  2036. />
  2037. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  2038. <Redirect
  2039. from="/organizations/:orgId/members/:memberId/"
  2040. to="/settings/:orgId/members/:memberId/"
  2041. />
  2042. <Redirect
  2043. from="/organizations/:orgId/rate-limits/"
  2044. to="/settings/:orgId/rate-limits/"
  2045. />
  2046. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  2047. </Route>
  2048. </Route>
  2049. );
  2050. const gettingStartedRoutes = (
  2051. <Fragment>
  2052. {usingCustomerDomain && (
  2053. <Fragment>
  2054. <Redirect
  2055. from="/getting-started/:projectId/"
  2056. to="/projects/:projectId/getting-started/"
  2057. />
  2058. <Redirect
  2059. from="/getting-started/:projectId/:platform/"
  2060. to="/projects/:projectId/getting-started/"
  2061. />
  2062. </Fragment>
  2063. )}
  2064. <Redirect
  2065. from="/:orgId/:projectId/getting-started/"
  2066. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2067. />
  2068. <Redirect
  2069. from="/:orgId/:projectId/getting-started/:platform/"
  2070. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2071. />
  2072. </Fragment>
  2073. );
  2074. const profilingChildRoutes = (
  2075. <Fragment>
  2076. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2077. <Route
  2078. path="summary/:projectId/"
  2079. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2080. />
  2081. <Route
  2082. path="profile/:projectId/:eventId/"
  2083. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2084. >
  2085. {/* @TODO Remove flamechart route name */}
  2086. <Route
  2087. path="flamechart/"
  2088. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2089. />
  2090. <Route
  2091. path="flamegraph/"
  2092. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2093. />
  2094. </Route>
  2095. </Fragment>
  2096. );
  2097. const profilingRoutes = (
  2098. <Fragment>
  2099. {usingCustomerDomain && (
  2100. <Route
  2101. path="/profiling/"
  2102. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2103. key="orgless-profiling-route"
  2104. >
  2105. {profilingChildRoutes}
  2106. </Route>
  2107. )}
  2108. <Route
  2109. path="/organizations/:orgId/profiling/"
  2110. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2111. key="org-profiling"
  2112. >
  2113. {profilingChildRoutes}
  2114. </Route>
  2115. </Fragment>
  2116. );
  2117. const ddmChildRoutes = (
  2118. <Fragment>
  2119. <IndexRoute component={make(() => import('sentry/views/ddm/ddm'))} />
  2120. </Fragment>
  2121. );
  2122. const ddmRoutes = (
  2123. <Fragment>
  2124. {usingCustomerDomain && (
  2125. <Route
  2126. path="/ddm/"
  2127. component={withDomainRequired(make(() => import('sentry/views/ddm')))}
  2128. key="orgless-ddm-route"
  2129. >
  2130. {ddmChildRoutes}
  2131. </Route>
  2132. )}
  2133. <Route
  2134. path="/organizations/:orgId/ddm/"
  2135. component={withDomainRedirect(make(() => import('sentry/views/ddm')))}
  2136. key="org-ddm"
  2137. >
  2138. {ddmChildRoutes}
  2139. </Route>
  2140. </Fragment>
  2141. );
  2142. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2143. // canonical URLs.
  2144. //
  2145. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2146. // or do these need to be nested into the OrganizationDetails tree?
  2147. const legacyOrgRedirects = (
  2148. <Route path="/:orgId/:projectId/">
  2149. <IndexRoute
  2150. component={errorHandler(
  2151. redirectDeprecatedProjectRoute(
  2152. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2153. )
  2154. )}
  2155. />
  2156. <Route
  2157. path="issues/"
  2158. component={errorHandler(
  2159. redirectDeprecatedProjectRoute(
  2160. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2161. )
  2162. )}
  2163. />
  2164. <Route
  2165. path="dashboard/"
  2166. component={errorHandler(
  2167. redirectDeprecatedProjectRoute(
  2168. ({orgId, projectId}) =>
  2169. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2170. )
  2171. )}
  2172. />
  2173. <Route
  2174. path="user-feedback/"
  2175. component={errorHandler(
  2176. redirectDeprecatedProjectRoute(
  2177. ({orgId, projectId}) =>
  2178. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2179. )
  2180. )}
  2181. />
  2182. <Route
  2183. path="releases/"
  2184. component={errorHandler(
  2185. redirectDeprecatedProjectRoute(
  2186. ({orgId, projectId}) =>
  2187. `/organizations/${orgId}/releases/?project=${projectId}`
  2188. )
  2189. )}
  2190. />
  2191. <Route
  2192. path="releases/:version/"
  2193. component={errorHandler(
  2194. redirectDeprecatedProjectRoute(
  2195. ({orgId, projectId, router}) =>
  2196. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2197. )
  2198. )}
  2199. />
  2200. <Route
  2201. path="releases/:version/new-events/"
  2202. component={errorHandler(
  2203. redirectDeprecatedProjectRoute(
  2204. ({orgId, projectId, router}) =>
  2205. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2206. )
  2207. )}
  2208. />
  2209. <Route
  2210. path="releases/:version/all-events/"
  2211. component={errorHandler(
  2212. redirectDeprecatedProjectRoute(
  2213. ({orgId, projectId, router}) =>
  2214. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2215. )
  2216. )}
  2217. />
  2218. <Route
  2219. path="releases/:version/commits/"
  2220. component={errorHandler(
  2221. redirectDeprecatedProjectRoute(
  2222. ({orgId, projectId, router}) =>
  2223. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2224. )
  2225. )}
  2226. />
  2227. </Route>
  2228. );
  2229. const organizationRoutes = (
  2230. <Route component={errorHandler(OrganizationDetails)}>
  2231. {settingsRoutes}
  2232. {projectsRoutes}
  2233. {dashboardRoutes}
  2234. {userFeedbackRoutes}
  2235. {feedbackv2Routes}
  2236. {issueListRoutes}
  2237. {issueDetailsRoutes}
  2238. {alertRoutes}
  2239. {cronsRoutes}
  2240. {replayRoutes}
  2241. {releasesRoutes}
  2242. {activityRoutes}
  2243. {statsRoutes}
  2244. {discoverRoutes}
  2245. {performanceRoutes}
  2246. {starfishRoutes}
  2247. {profilingRoutes}
  2248. {ddmRoutes}
  2249. {gettingStartedRoutes}
  2250. {adminManageRoutes}
  2251. {legacyOrganizationRootRoutes}
  2252. {legacyOrgRedirects}
  2253. </Route>
  2254. );
  2255. const legacyRedirectRoutes = (
  2256. <Route path="/:orgId/">
  2257. <IndexRedirect to="/organizations/:orgId/" />
  2258. <Route path=":projectId/settings/">
  2259. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2260. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2261. <Redirect
  2262. from="alerts/rules/"
  2263. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2264. />
  2265. <Redirect
  2266. from="alerts/rules/new/"
  2267. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2268. />
  2269. <Redirect
  2270. from="alerts/rules/:ruleId/"
  2271. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2272. />
  2273. <Redirect
  2274. from="environments/"
  2275. to="/settings/:orgId/projects/:projectId/environments/"
  2276. />
  2277. <Redirect
  2278. from="environments/hidden/"
  2279. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2280. />
  2281. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2282. <Redirect
  2283. from="issue-tracking/"
  2284. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2285. />
  2286. <Redirect
  2287. from="release-tracking/"
  2288. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2289. />
  2290. <Redirect
  2291. from="ownership/"
  2292. to="/settings/:orgId/projects/:projectId/ownership/"
  2293. />
  2294. <Redirect
  2295. from="data-forwarding/"
  2296. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2297. />
  2298. <Redirect
  2299. from="debug-symbols/"
  2300. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2301. />
  2302. <Redirect
  2303. from="processing-issues/"
  2304. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2305. />
  2306. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2307. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2308. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2309. <Redirect
  2310. from="keys/:keyId/"
  2311. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2312. />
  2313. <Redirect
  2314. from="user-feedback/"
  2315. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2316. />
  2317. <Redirect
  2318. from="security-headers/"
  2319. to="/settings/:orgId/projects/:projectId/security-headers/"
  2320. />
  2321. <Redirect
  2322. from="security-headers/csp/"
  2323. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2324. />
  2325. <Redirect
  2326. from="security-headers/expect-ct/"
  2327. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2328. />
  2329. <Redirect
  2330. from="security-headers/hpkp/"
  2331. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2332. />
  2333. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2334. <Redirect
  2335. from="plugins/:pluginId/"
  2336. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2337. />
  2338. <Redirect
  2339. from="integrations/:providerKey/"
  2340. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2341. />
  2342. </Route>
  2343. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2344. <Redirect
  2345. from=":projectId/issues/:groupId/"
  2346. to="/organizations/:orgId/issues/:groupId/"
  2347. />
  2348. <Redirect
  2349. from=":projectId/issues/:groupId/events/"
  2350. to="/organizations/:orgId/issues/:groupId/events/"
  2351. />
  2352. <Redirect
  2353. from=":projectId/issues/:groupId/events/:eventId/"
  2354. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2355. />
  2356. <Redirect
  2357. from=":projectId/issues/:groupId/tags/"
  2358. to="/organizations/:orgId/issues/:groupId/tags/"
  2359. />
  2360. <Redirect
  2361. from=":projectId/issues/:groupId/tags/:tagKey/"
  2362. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2363. />
  2364. <Redirect
  2365. from=":projectId/issues/:groupId/feedback/"
  2366. to="/organizations/:orgId/issues/:groupId/feedback/"
  2367. />
  2368. <Redirect
  2369. from=":projectId/issues/:groupId/similar/"
  2370. to="/organizations/:orgId/issues/:groupId/similar/"
  2371. />
  2372. <Redirect
  2373. from=":projectId/issues/:groupId/merged/"
  2374. to="/organizations/:orgId/issues/:groupId/merged/"
  2375. />
  2376. <Route
  2377. path=":projectId/events/:eventId/"
  2378. component={errorHandler(ProjectEventRedirect)}
  2379. />
  2380. </Route>
  2381. );
  2382. const appRoutes = (
  2383. <Route>
  2384. {experimentalSpaRoutes}
  2385. <Route path="/" component={errorHandler(App)}>
  2386. {rootRoutes}
  2387. {organizationRoutes}
  2388. {legacyRedirectRoutes}
  2389. <Route path="*" component={errorHandler(RouteNotFound)} />
  2390. </Route>
  2391. </Route>
  2392. );
  2393. return appRoutes;
  2394. }
  2395. // We load routes both when initializing the SDK (for routing integrations) and
  2396. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2397. export const routes = memoize(buildRoutes);
  2398. // Exported for use in tests.
  2399. export {buildRoutes};
  2400. function NoOp(props: {children: React.ReactNode}) {
  2401. return <Fragment>{props.children}</Fragment>;
  2402. }