routes.tsx 80 KB

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