routes.tsx 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492
  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 releaseThresholdRoutes = (
  1449. <Fragment>
  1450. {usingCustomerDomain && (
  1451. <Route
  1452. path="/release-thresholds/"
  1453. component={withDomainRequired(NoOp)}
  1454. key="orgless-release-thresholds-route"
  1455. >
  1456. <IndexRoute
  1457. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1458. />
  1459. </Route>
  1460. )}
  1461. <Route
  1462. path="/organizations/:orgId/release-thresholds/"
  1463. component={withDomainRedirect(NoOp)}
  1464. key="org-release-thresholds"
  1465. >
  1466. <IndexRoute
  1467. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1468. />
  1469. </Route>
  1470. </Fragment>
  1471. );
  1472. const activityRoutes = (
  1473. <Fragment>
  1474. {usingCustomerDomain && (
  1475. <Route
  1476. path="/activity/"
  1477. component={withDomainRequired(
  1478. make(() => import('sentry/views/organizationActivity'))
  1479. )}
  1480. key="orgless-activity-route"
  1481. />
  1482. )}
  1483. <Route
  1484. path="/organizations/:orgId/activity/"
  1485. component={withDomainRedirect(
  1486. make(() => import('sentry/views/organizationActivity'))
  1487. )}
  1488. key="org-activity"
  1489. />
  1490. </Fragment>
  1491. );
  1492. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1493. return (
  1494. <Fragment>
  1495. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1496. <Route
  1497. path="issues/"
  1498. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1499. >
  1500. <IndexRoute
  1501. component={make(
  1502. () => import('sentry/views/organizationStats/teamInsights/issues')
  1503. )}
  1504. />
  1505. </Route>
  1506. <Route
  1507. path="health/"
  1508. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1509. >
  1510. <IndexRoute
  1511. component={make(
  1512. () => import('sentry/views/organizationStats/teamInsights/health')
  1513. )}
  1514. />
  1515. </Route>
  1516. {forCustomerDomain ? null : (
  1517. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1518. )}
  1519. </Fragment>
  1520. );
  1521. };
  1522. const statsRoutes = (
  1523. <Fragment>
  1524. {usingCustomerDomain && (
  1525. <Route
  1526. path="/stats/"
  1527. component={withDomainRequired(NoOp)}
  1528. key="orgless-stats-route"
  1529. >
  1530. {statsChildRoutes({forCustomerDomain: true})}
  1531. </Route>
  1532. )}
  1533. <Route
  1534. path="/organizations/:orgId/stats/"
  1535. component={withDomainRedirect(NoOp)}
  1536. key="org-stats"
  1537. >
  1538. {statsChildRoutes({forCustomerDomain: false})}
  1539. </Route>
  1540. </Fragment>
  1541. );
  1542. // TODO(mark) Long term this /queries route should go away and /discover
  1543. // should be the canonical route for discover2. We have a redirect right now
  1544. // as /discover was for discover 1 and most of the application is linking to
  1545. // /discover/queries and not /discover
  1546. const discoverChildRoutes = (
  1547. <Fragment>
  1548. <IndexRedirect to="queries/" />
  1549. <Route
  1550. path="homepage/"
  1551. component={make(() => import('sentry/views/discover/homepage'))}
  1552. />
  1553. <Route
  1554. path="queries/"
  1555. component={make(() => import('sentry/views/discover/landing'))}
  1556. />
  1557. <Route
  1558. path="results/"
  1559. component={make(() => import('sentry/views/discover/results'))}
  1560. />
  1561. <Route
  1562. path=":eventSlug/"
  1563. component={make(() => import('sentry/views/discover/eventDetails'))}
  1564. />
  1565. </Fragment>
  1566. );
  1567. const discoverRoutes = (
  1568. <Fragment>
  1569. {usingCustomerDomain && (
  1570. <Route
  1571. path="/discover/"
  1572. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1573. key="orgless-discover-route"
  1574. >
  1575. {discoverChildRoutes}
  1576. </Route>
  1577. )}
  1578. <Route
  1579. path="/organizations/:orgId/discover/"
  1580. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1581. key="org-discover-route"
  1582. >
  1583. {discoverChildRoutes}
  1584. </Route>
  1585. </Fragment>
  1586. );
  1587. const performanceChildRoutes = (
  1588. <Fragment>
  1589. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1590. <Route
  1591. path="trends/"
  1592. component={make(() => import('sentry/views/performance/trends'))}
  1593. />
  1594. <Route path="database/">
  1595. <IndexRoute
  1596. component={make(
  1597. () => import('sentry/views/performance/database/databaseLandingPage')
  1598. )}
  1599. />
  1600. <Route
  1601. path="spans/span/:groupId/"
  1602. component={make(
  1603. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1604. )}
  1605. />
  1606. </Route>
  1607. <Route path="browser/">
  1608. <Route path="interactions/">
  1609. <IndexRoute
  1610. component={make(
  1611. () => import('sentry/views/performance/browser/interactionsLandingPage')
  1612. )}
  1613. />
  1614. <Route
  1615. path="summary/"
  1616. component={make(
  1617. () => import('sentry/views/performance/browser/interactionSummary/index')
  1618. )}
  1619. />
  1620. </Route>
  1621. <Route path="pageloads/">
  1622. <IndexRoute
  1623. component={make(
  1624. () =>
  1625. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1626. )}
  1627. />
  1628. <Route
  1629. path="overview/"
  1630. component={make(
  1631. () => import('sentry/views/performance/browser/webVitals/pageOverview')
  1632. )}
  1633. />
  1634. </Route>
  1635. <Route path="resources/">
  1636. <IndexRoute
  1637. component={make(
  1638. () => import('sentry/views/performance/browser/resources/index')
  1639. )}
  1640. />
  1641. <Route
  1642. path="spans/span/:groupId/"
  1643. component={make(
  1644. () =>
  1645. import(
  1646. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1647. )
  1648. )}
  1649. />
  1650. </Route>
  1651. </Route>
  1652. <Route path="summary/">
  1653. <IndexRoute
  1654. component={make(
  1655. () =>
  1656. import('sentry/views/performance/transactionSummary/transactionOverview')
  1657. )}
  1658. />
  1659. <Route
  1660. path="replays/"
  1661. component={make(
  1662. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1663. )}
  1664. />
  1665. <Route
  1666. path="vitals/"
  1667. component={make(
  1668. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1669. )}
  1670. />
  1671. <Route
  1672. path="tags/"
  1673. component={make(
  1674. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1675. )}
  1676. />
  1677. <Route
  1678. path="events/"
  1679. component={make(
  1680. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1681. )}
  1682. />
  1683. <Route
  1684. path="anomalies/"
  1685. component={make(
  1686. () =>
  1687. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1688. )}
  1689. />
  1690. <Route
  1691. path="profiles/"
  1692. component={make(
  1693. () =>
  1694. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1695. )}
  1696. />
  1697. <Route
  1698. path="aggregateWaterfall/"
  1699. component={make(
  1700. () =>
  1701. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1702. )}
  1703. />
  1704. <Route path="spans/">
  1705. <IndexRoute
  1706. component={make(
  1707. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1708. )}
  1709. />
  1710. <Route
  1711. path=":spanSlug/"
  1712. component={make(
  1713. () =>
  1714. import(
  1715. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1716. )
  1717. )}
  1718. />
  1719. </Route>
  1720. </Route>
  1721. <Route
  1722. path="vitaldetail/"
  1723. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1724. />
  1725. <Route
  1726. path="trace/:traceSlug/"
  1727. component={make(() => import('sentry/views/performance/traceDetails'))}
  1728. />
  1729. <Route
  1730. path=":eventSlug/"
  1731. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1732. />
  1733. </Fragment>
  1734. );
  1735. const performanceRoutes = (
  1736. <Fragment>
  1737. {usingCustomerDomain && (
  1738. <Route
  1739. path="/performance/"
  1740. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1741. key="orgless-performance-route"
  1742. >
  1743. {performanceChildRoutes}
  1744. </Route>
  1745. )}
  1746. <Route
  1747. path="/organizations/:orgId/performance/"
  1748. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1749. key="org-performance"
  1750. >
  1751. {performanceChildRoutes}
  1752. </Route>
  1753. </Fragment>
  1754. );
  1755. const starfishChildRoutes = (
  1756. <Fragment>
  1757. <IndexRoute
  1758. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1759. />
  1760. <Route path="endpoint-overview/">
  1761. <IndexRoute
  1762. component={make(
  1763. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1764. )}
  1765. />
  1766. <Route
  1767. path="span/:groupId/"
  1768. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1769. />
  1770. </Route>
  1771. <Redirect from="database/" to="/performance/database" />
  1772. <Route path="initialization/">
  1773. <IndexRoute
  1774. component={make(
  1775. () => import('sentry/views/starfish/modules/mobile/initialization')
  1776. )}
  1777. />
  1778. </Route>
  1779. <Route path="pageload/">
  1780. <IndexRoute
  1781. component={make(() => import('sentry/views/starfish/modules/mobile/pageload'))}
  1782. />
  1783. <Route
  1784. path="spans/"
  1785. component={make(
  1786. () => import('sentry/views/starfish/views/screens/screenLoadSpans')
  1787. )}
  1788. />
  1789. </Route>
  1790. <Route path="responsiveness/">
  1791. <IndexRoute
  1792. component={make(
  1793. () => import('sentry/views/starfish/modules/mobile/responsiveness')
  1794. )}
  1795. />
  1796. </Route>
  1797. <Route path="spans/">
  1798. <IndexRoute component={make(() => import('sentry/views/starfish/views/spans'))} />
  1799. <Route
  1800. path="span/:groupId/"
  1801. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1802. />
  1803. </Route>
  1804. </Fragment>
  1805. );
  1806. const starfishRoutes = (
  1807. <Fragment>
  1808. {usingCustomerDomain && (
  1809. <Route
  1810. path="/starfish/"
  1811. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1812. key="orgless-starfish-route"
  1813. >
  1814. {starfishChildRoutes}
  1815. </Route>
  1816. )}
  1817. <Route
  1818. path="/organizations/:orgId/starfish/"
  1819. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1820. key="org-starfish"
  1821. >
  1822. {starfishChildRoutes}
  1823. </Route>
  1824. </Fragment>
  1825. );
  1826. const userFeedbackRoutes = (
  1827. <Fragment>
  1828. {usingCustomerDomain && (
  1829. <Route
  1830. path="/user-feedback/"
  1831. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1832. key="orgless-user-feedback-route"
  1833. />
  1834. )}
  1835. <Route
  1836. path="/organizations/:orgId/user-feedback/"
  1837. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1838. key="org-user-feedback"
  1839. />
  1840. </Fragment>
  1841. );
  1842. const feedbackChildRoutes = (
  1843. <Fragment>
  1844. <IndexRoute
  1845. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1846. />
  1847. </Fragment>
  1848. );
  1849. const feedbackv2Routes = (
  1850. <Fragment>
  1851. {usingCustomerDomain && (
  1852. <Route
  1853. path="/feedback/"
  1854. component={withDomainRequired(
  1855. make(() => import('sentry/views/feedback/index'))
  1856. )}
  1857. key="orgless-feedback-list-route"
  1858. >
  1859. {feedbackChildRoutes}
  1860. </Route>
  1861. )}
  1862. <Route
  1863. path="/organizations/:orgId/feedback/"
  1864. component={withDomainRedirect(make(() => import('sentry/views/feedback/index')))}
  1865. key="org-feedback-list-route"
  1866. >
  1867. {feedbackChildRoutes}
  1868. </Route>
  1869. </Fragment>
  1870. );
  1871. const issueListRoutes = (
  1872. <Fragment>
  1873. {usingCustomerDomain && (
  1874. <Route
  1875. path="/issues/(searches/:searchId/)"
  1876. component={withDomainRequired(errorHandler(IssueListContainer))}
  1877. key="orgless-issues-route"
  1878. >
  1879. <IndexRoute component={errorHandler(IssueListOverview)} />
  1880. </Route>
  1881. )}
  1882. <Route
  1883. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1884. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1885. key="org-issues"
  1886. >
  1887. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1888. <IndexRoute component={errorHandler(IssueListOverview)} />
  1889. </Route>
  1890. </Fragment>
  1891. );
  1892. // Once org issues is complete, these routes can be nested under
  1893. // /organizations/:orgId/issues
  1894. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1895. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1896. return (
  1897. <Fragment>
  1898. <IndexRoute
  1899. component={hoc(
  1900. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1901. )}
  1902. />
  1903. <Route
  1904. path={TabPaths[Tab.REPLAYS]}
  1905. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1906. />
  1907. <Route
  1908. path={TabPaths[Tab.ACTIVITY]}
  1909. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1910. />
  1911. <Route
  1912. path={TabPaths[Tab.EVENTS]}
  1913. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1914. />
  1915. <Route
  1916. path={TabPaths[Tab.TAGS]}
  1917. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1918. />
  1919. <Route
  1920. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1921. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1922. />
  1923. <Route
  1924. path={TabPaths[Tab.USER_FEEDBACK]}
  1925. component={hoc(
  1926. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1927. )}
  1928. />
  1929. <Route
  1930. path={TabPaths[Tab.ATTACHMENTS]}
  1931. component={hoc(
  1932. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1933. )}
  1934. />
  1935. <Route
  1936. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1937. component={hoc(
  1938. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1939. )}
  1940. />
  1941. <Route
  1942. path={TabPaths[Tab.MERGED]}
  1943. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1944. />
  1945. </Fragment>
  1946. );
  1947. };
  1948. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1949. <Fragment>
  1950. {issueTabs({forCustomerDomain})}
  1951. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1952. {issueTabs({forCustomerDomain})}
  1953. </Route>
  1954. </Fragment>
  1955. );
  1956. const issueDetailsRoutes = (
  1957. <Fragment>
  1958. <Route
  1959. path="/organizations/:orgId/issues/:groupId/"
  1960. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1961. key="org-issues-group-id"
  1962. >
  1963. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1964. </Route>
  1965. {usingCustomerDomain && (
  1966. <Route
  1967. path="/issues/:groupId/"
  1968. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1969. key="orgless-issues-group-id-route"
  1970. >
  1971. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1972. </Route>
  1973. )}
  1974. </Fragment>
  1975. );
  1976. // These are the "manage" pages. For sentry.io, these are _different_ from
  1977. // the SaaS admin routes in getsentry.
  1978. const adminManageRoutes = (
  1979. <Route
  1980. path="/manage/"
  1981. component={make(() => import('sentry/views/admin/adminLayout'))}
  1982. >
  1983. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1984. <Route
  1985. path="buffer/"
  1986. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1987. />
  1988. <Route
  1989. path="relays/"
  1990. component={make(() => import('sentry/views/admin/adminRelays'))}
  1991. />
  1992. <Route
  1993. path="organizations/"
  1994. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1995. />
  1996. <Route
  1997. path="projects/"
  1998. component={make(() => import('sentry/views/admin/adminProjects'))}
  1999. />
  2000. <Route
  2001. path="queue/"
  2002. component={make(() => import('sentry/views/admin/adminQueue'))}
  2003. />
  2004. <Route
  2005. path="quotas/"
  2006. component={make(() => import('sentry/views/admin/adminQuotas'))}
  2007. />
  2008. <Route
  2009. path="settings/"
  2010. component={make(() => import('sentry/views/admin/adminSettings'))}
  2011. />
  2012. <Route path="users/">
  2013. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  2014. <Route
  2015. path=":id"
  2016. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  2017. />
  2018. </Route>
  2019. <Route
  2020. path="status/mail/"
  2021. component={make(() => import('sentry/views/admin/adminMail'))}
  2022. />
  2023. <Route
  2024. path="status/environment/"
  2025. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  2026. />
  2027. <Route
  2028. path="status/packages/"
  2029. component={make(() => import('sentry/views/admin/adminPackages'))}
  2030. />
  2031. <Route
  2032. path="status/warnings/"
  2033. component={make(() => import('sentry/views/admin/adminWarnings'))}
  2034. />
  2035. </Route>
  2036. );
  2037. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  2038. // me why we need the OrganizationRoot root container.
  2039. const legacyOrganizationRootRoutes = (
  2040. <Route component={errorHandler(OrganizationRoot)}>
  2041. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  2042. <Route path="/organizations/:orgId/">
  2043. {hook('routes:organization')}
  2044. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  2045. <Redirect
  2046. from="/organizations/:orgId/teams/your-teams/"
  2047. to="/settings/:orgId/teams/"
  2048. />
  2049. <Redirect
  2050. from="/organizations/:orgId/teams/all-teams/"
  2051. to="/settings/:orgId/teams/"
  2052. />
  2053. <Redirect
  2054. from="/organizations/:orgId/teams/:teamId/"
  2055. to="/settings/:orgId/teams/:teamId/"
  2056. />
  2057. <Redirect
  2058. from="/organizations/:orgId/teams/:teamId/members/"
  2059. to="/settings/:orgId/teams/:teamId/members/"
  2060. />
  2061. <Redirect
  2062. from="/organizations/:orgId/teams/:teamId/projects/"
  2063. to="/settings/:orgId/teams/:teamId/projects/"
  2064. />
  2065. <Redirect
  2066. from="/organizations/:orgId/teams/:teamId/settings/"
  2067. to="/settings/:orgId/teams/:teamId/settings/"
  2068. />
  2069. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  2070. <Redirect
  2071. from="/organizations/:orgId/api-keys/"
  2072. to="/settings/:orgId/api-keys/"
  2073. />
  2074. <Redirect
  2075. from="/organizations/:orgId/api-keys/:apiKey/"
  2076. to="/settings/:orgId/api-keys/:apiKey/"
  2077. />
  2078. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  2079. <Redirect
  2080. from="/organizations/:orgId/members/:memberId/"
  2081. to="/settings/:orgId/members/:memberId/"
  2082. />
  2083. <Redirect
  2084. from="/organizations/:orgId/rate-limits/"
  2085. to="/settings/:orgId/rate-limits/"
  2086. />
  2087. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  2088. </Route>
  2089. </Route>
  2090. );
  2091. const gettingStartedRoutes = (
  2092. <Fragment>
  2093. {usingCustomerDomain && (
  2094. <Fragment>
  2095. <Redirect
  2096. from="/getting-started/:projectId/"
  2097. to="/projects/:projectId/getting-started/"
  2098. />
  2099. <Redirect
  2100. from="/getting-started/:projectId/:platform/"
  2101. to="/projects/:projectId/getting-started/"
  2102. />
  2103. </Fragment>
  2104. )}
  2105. <Redirect
  2106. from="/:orgId/:projectId/getting-started/"
  2107. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2108. />
  2109. <Redirect
  2110. from="/:orgId/:projectId/getting-started/:platform/"
  2111. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2112. />
  2113. </Fragment>
  2114. );
  2115. const profilingChildRoutes = (
  2116. <Fragment>
  2117. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2118. <Route
  2119. path="summary/:projectId/"
  2120. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2121. />
  2122. <Route
  2123. path="profile/:projectId/:eventId/"
  2124. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2125. >
  2126. {/* @TODO Remove flamechart route name */}
  2127. <Route
  2128. path="flamechart/"
  2129. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2130. />
  2131. <Route
  2132. path="flamegraph/"
  2133. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2134. />
  2135. </Route>
  2136. </Fragment>
  2137. );
  2138. const profilingRoutes = (
  2139. <Fragment>
  2140. {usingCustomerDomain && (
  2141. <Route
  2142. path="/profiling/"
  2143. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2144. key="orgless-profiling-route"
  2145. >
  2146. {profilingChildRoutes}
  2147. </Route>
  2148. )}
  2149. <Route
  2150. path="/organizations/:orgId/profiling/"
  2151. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2152. key="org-profiling"
  2153. >
  2154. {profilingChildRoutes}
  2155. </Route>
  2156. </Fragment>
  2157. );
  2158. const ddmChildRoutes = (
  2159. <Fragment>
  2160. <IndexRoute component={make(() => import('sentry/views/ddm/ddm'))} />
  2161. </Fragment>
  2162. );
  2163. const ddmRoutes = (
  2164. <Fragment>
  2165. {usingCustomerDomain && (
  2166. <Route
  2167. path="/ddm/"
  2168. component={withDomainRequired(make(() => import('sentry/views/ddm')))}
  2169. key="orgless-ddm-route"
  2170. >
  2171. {ddmChildRoutes}
  2172. </Route>
  2173. )}
  2174. <Route
  2175. path="/organizations/:orgId/ddm/"
  2176. component={withDomainRedirect(make(() => import('sentry/views/ddm')))}
  2177. key="org-ddm"
  2178. >
  2179. {ddmChildRoutes}
  2180. </Route>
  2181. </Fragment>
  2182. );
  2183. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2184. // canonical URLs.
  2185. //
  2186. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2187. // or do these need to be nested into the OrganizationDetails tree?
  2188. const legacyOrgRedirects = (
  2189. <Route path="/:orgId/:projectId/">
  2190. <IndexRoute
  2191. component={errorHandler(
  2192. redirectDeprecatedProjectRoute(
  2193. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2194. )
  2195. )}
  2196. />
  2197. <Route
  2198. path="issues/"
  2199. component={errorHandler(
  2200. redirectDeprecatedProjectRoute(
  2201. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2202. )
  2203. )}
  2204. />
  2205. <Route
  2206. path="dashboard/"
  2207. component={errorHandler(
  2208. redirectDeprecatedProjectRoute(
  2209. ({orgId, projectId}) =>
  2210. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2211. )
  2212. )}
  2213. />
  2214. <Route
  2215. path="user-feedback/"
  2216. component={errorHandler(
  2217. redirectDeprecatedProjectRoute(
  2218. ({orgId, projectId}) =>
  2219. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2220. )
  2221. )}
  2222. />
  2223. <Route
  2224. path="releases/"
  2225. component={errorHandler(
  2226. redirectDeprecatedProjectRoute(
  2227. ({orgId, projectId}) =>
  2228. `/organizations/${orgId}/releases/?project=${projectId}`
  2229. )
  2230. )}
  2231. />
  2232. <Route
  2233. path="releases/:version/"
  2234. component={errorHandler(
  2235. redirectDeprecatedProjectRoute(
  2236. ({orgId, projectId, router}) =>
  2237. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2238. )
  2239. )}
  2240. />
  2241. <Route
  2242. path="releases/:version/new-events/"
  2243. component={errorHandler(
  2244. redirectDeprecatedProjectRoute(
  2245. ({orgId, projectId, router}) =>
  2246. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2247. )
  2248. )}
  2249. />
  2250. <Route
  2251. path="releases/:version/all-events/"
  2252. component={errorHandler(
  2253. redirectDeprecatedProjectRoute(
  2254. ({orgId, projectId, router}) =>
  2255. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2256. )
  2257. )}
  2258. />
  2259. <Route
  2260. path="releases/:version/commits/"
  2261. component={errorHandler(
  2262. redirectDeprecatedProjectRoute(
  2263. ({orgId, projectId, router}) =>
  2264. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2265. )
  2266. )}
  2267. />
  2268. </Route>
  2269. );
  2270. const organizationRoutes = (
  2271. <Route component={errorHandler(OrganizationDetails)}>
  2272. {settingsRoutes}
  2273. {projectsRoutes}
  2274. {dashboardRoutes}
  2275. {userFeedbackRoutes}
  2276. {feedbackv2Routes}
  2277. {issueListRoutes}
  2278. {issueDetailsRoutes}
  2279. {alertRoutes}
  2280. {cronsRoutes}
  2281. {replayRoutes}
  2282. {releasesRoutes}
  2283. {releaseThresholdRoutes}
  2284. {activityRoutes}
  2285. {statsRoutes}
  2286. {discoverRoutes}
  2287. {performanceRoutes}
  2288. {starfishRoutes}
  2289. {profilingRoutes}
  2290. {ddmRoutes}
  2291. {gettingStartedRoutes}
  2292. {adminManageRoutes}
  2293. {legacyOrganizationRootRoutes}
  2294. {legacyOrgRedirects}
  2295. </Route>
  2296. );
  2297. const legacyRedirectRoutes = (
  2298. <Route path="/:orgId/">
  2299. <IndexRedirect to="/organizations/:orgId/" />
  2300. <Route path=":projectId/settings/">
  2301. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2302. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2303. <Redirect
  2304. from="alerts/rules/"
  2305. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2306. />
  2307. <Redirect
  2308. from="alerts/rules/new/"
  2309. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2310. />
  2311. <Redirect
  2312. from="alerts/rules/:ruleId/"
  2313. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2314. />
  2315. <Redirect
  2316. from="environments/"
  2317. to="/settings/:orgId/projects/:projectId/environments/"
  2318. />
  2319. <Redirect
  2320. from="environments/hidden/"
  2321. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2322. />
  2323. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2324. <Redirect
  2325. from="issue-tracking/"
  2326. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2327. />
  2328. <Redirect
  2329. from="release-tracking/"
  2330. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2331. />
  2332. <Redirect
  2333. from="ownership/"
  2334. to="/settings/:orgId/projects/:projectId/ownership/"
  2335. />
  2336. <Redirect
  2337. from="data-forwarding/"
  2338. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2339. />
  2340. <Redirect
  2341. from="debug-symbols/"
  2342. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2343. />
  2344. <Redirect
  2345. from="processing-issues/"
  2346. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2347. />
  2348. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2349. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2350. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2351. <Redirect
  2352. from="keys/:keyId/"
  2353. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2354. />
  2355. <Redirect
  2356. from="user-feedback/"
  2357. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2358. />
  2359. <Redirect
  2360. from="security-headers/"
  2361. to="/settings/:orgId/projects/:projectId/security-headers/"
  2362. />
  2363. <Redirect
  2364. from="security-headers/csp/"
  2365. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2366. />
  2367. <Redirect
  2368. from="security-headers/expect-ct/"
  2369. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2370. />
  2371. <Redirect
  2372. from="security-headers/hpkp/"
  2373. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2374. />
  2375. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2376. <Redirect
  2377. from="plugins/:pluginId/"
  2378. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2379. />
  2380. <Redirect
  2381. from="integrations/:providerKey/"
  2382. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2383. />
  2384. </Route>
  2385. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2386. <Redirect
  2387. from=":projectId/issues/:groupId/"
  2388. to="/organizations/:orgId/issues/:groupId/"
  2389. />
  2390. <Redirect
  2391. from=":projectId/issues/:groupId/events/"
  2392. to="/organizations/:orgId/issues/:groupId/events/"
  2393. />
  2394. <Redirect
  2395. from=":projectId/issues/:groupId/events/:eventId/"
  2396. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2397. />
  2398. <Redirect
  2399. from=":projectId/issues/:groupId/tags/"
  2400. to="/organizations/:orgId/issues/:groupId/tags/"
  2401. />
  2402. <Redirect
  2403. from=":projectId/issues/:groupId/tags/:tagKey/"
  2404. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2405. />
  2406. <Redirect
  2407. from=":projectId/issues/:groupId/feedback/"
  2408. to="/organizations/:orgId/issues/:groupId/feedback/"
  2409. />
  2410. <Redirect
  2411. from=":projectId/issues/:groupId/similar/"
  2412. to="/organizations/:orgId/issues/:groupId/similar/"
  2413. />
  2414. <Redirect
  2415. from=":projectId/issues/:groupId/merged/"
  2416. to="/organizations/:orgId/issues/:groupId/merged/"
  2417. />
  2418. <Route
  2419. path=":projectId/events/:eventId/"
  2420. component={errorHandler(ProjectEventRedirect)}
  2421. />
  2422. </Route>
  2423. );
  2424. const appRoutes = (
  2425. <Route>
  2426. {experimentalSpaRoutes}
  2427. <Route path="/" component={errorHandler(App)}>
  2428. {rootRoutes}
  2429. {organizationRoutes}
  2430. {legacyRedirectRoutes}
  2431. <Route path="*" component={errorHandler(RouteNotFound)} />
  2432. </Route>
  2433. </Route>
  2434. );
  2435. return appRoutes;
  2436. }
  2437. // We load routes both when initializing the SDK (for routing integrations) and
  2438. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2439. export const routes = memoize(buildRoutes);
  2440. // Exported for use in tests.
  2441. export {buildRoutes};
  2442. function NoOp(props: {children: React.ReactNode}) {
  2443. return <Fragment>{props.children}</Fragment>;
  2444. }