routes.tsx 80 KB

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