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 OrganizationContainer from 'sentry/views/organizationContainer';
  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 <OrganizationLayout /> component, which renders the sidebar and
  121. // loads the organiztion into context (though in some cases, there may be
  122. // no organiztion)
  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 component={errorHandler(OrganizationContainer)}>
  166. <Route
  167. path="/extensions/external-install/:integrationSlug/:installationId"
  168. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  169. />
  170. <Route
  171. path="/extensions/:integrationSlug/link/"
  172. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  173. />
  174. </Route>
  175. <Route
  176. path="/sentry-apps/:sentryAppSlug/external-install/"
  177. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  178. />
  179. <Redirect from="/account/" to="/settings/account/details/" />
  180. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  181. {/* TODO: remove share/issue orgless url */}
  182. <Route
  183. path="/share/issue/:shareId/"
  184. component={make(() => import('sentry/views/sharedGroupDetails'))}
  185. />
  186. <Route
  187. path="/organizations/:orgId/share/issue/:shareId/"
  188. component={make(() => import('sentry/views/sharedGroupDetails'))}
  189. />
  190. {USING_CUSTOMER_DOMAIN && (
  191. <Route
  192. path="/unsubscribe/project/:id/"
  193. component={make(() => import('sentry/views/unsubscribe/project'))}
  194. />
  195. )}
  196. <Route
  197. path="/unsubscribe/:orgId/project/:id/"
  198. component={make(() => import('sentry/views/unsubscribe/project'))}
  199. />
  200. {USING_CUSTOMER_DOMAIN && (
  201. <Route
  202. path="/unsubscribe/issue/:id/"
  203. component={make(() => import('sentry/views/unsubscribe/issue'))}
  204. />
  205. )}
  206. <Route
  207. path="/unsubscribe/:orgId/issue/:id/"
  208. component={make(() => import('sentry/views/unsubscribe/issue'))}
  209. />
  210. <Route
  211. path="/organizations/new/"
  212. component={make(() => import('sentry/views/organizationCreate'))}
  213. />
  214. {USING_CUSTOMER_DOMAIN && (
  215. <Route
  216. path="/data-export/:dataExportId"
  217. component={withDomainRequired(
  218. make(() => import('sentry/views/dataExport/dataDownload'))
  219. )}
  220. key="orgless-data-export-route"
  221. />
  222. )}
  223. <Route
  224. path="/organizations/:orgId/data-export/:dataExportId"
  225. component={withDomainRedirect(
  226. make(() => import('sentry/views/dataExport/dataDownload'))
  227. )}
  228. key="org-data-export"
  229. />
  230. <Route component={errorHandler(OrganizationContainer)}>
  231. {USING_CUSTOMER_DOMAIN && (
  232. <Route
  233. path="/disabled-member/"
  234. component={withDomainRequired(
  235. make(() => import('sentry/views/disabledMember'))
  236. )}
  237. key="orgless-disabled-member-route"
  238. />
  239. )}
  240. <Route
  241. path="/organizations/:orgId/disabled-member/"
  242. component={withDomainRedirect(
  243. make(() => import('sentry/views/disabledMember'))
  244. )}
  245. key="org-disabled-member"
  246. />
  247. </Route>
  248. {USING_CUSTOMER_DOMAIN && (
  249. <Route
  250. path="/restore/"
  251. component={make(() => import('sentry/views/organizationRestore'))}
  252. />
  253. )}
  254. <Route
  255. path="/organizations/:orgId/restore/"
  256. component={make(() => import('sentry/views/organizationRestore'))}
  257. />
  258. {USING_CUSTOMER_DOMAIN && (
  259. <Route
  260. path="/join-request/"
  261. component={withDomainRequired(
  262. make(() => import('sentry/views/organizationJoinRequest'))
  263. )}
  264. key="orgless-join-request"
  265. />
  266. )}
  267. <Route
  268. path="/join-request/:orgId/"
  269. component={withDomainRedirect(
  270. make(() => import('sentry/views/organizationJoinRequest'))
  271. )}
  272. key="org-join-request"
  273. />
  274. <Route
  275. path="/relocation/"
  276. component={make(() => import('sentry/views/relocation'))}
  277. key="orgless-relocation"
  278. >
  279. <IndexRedirect to="get-started/" />
  280. <Route path=":step/" component={make(() => import('sentry/views/relocation'))} />
  281. </Route>
  282. {USING_CUSTOMER_DOMAIN && (
  283. <Route
  284. path="/onboarding/"
  285. component={errorHandler(withDomainRequired(OrganizationContainer))}
  286. key="orgless-onboarding"
  287. >
  288. <IndexRedirect to="welcome/" />
  289. <Route
  290. path=":step/"
  291. component={make(() => import('sentry/views/onboarding'))}
  292. />
  293. </Route>
  294. )}
  295. <Route
  296. path="/onboarding/:orgId/"
  297. component={withDomainRedirect(errorHandler(OrganizationContainer))}
  298. key="org-onboarding"
  299. >
  300. <IndexRedirect to="welcome/" />
  301. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  302. </Route>
  303. {USING_CUSTOMER_DOMAIN && (
  304. <Route
  305. path="/stories/"
  306. component={make(() => import('sentry/views/stories/index'))}
  307. key="orgless-stories"
  308. />
  309. )}
  310. <Route
  311. path="/organizations/:orgId/stories/"
  312. component={withDomainRedirect(make(() => import('sentry/views/stories/index')))}
  313. key="org-stories"
  314. />
  315. </Fragment>
  316. );
  317. const accountSettingsRoutes = (
  318. <Route
  319. path="account/"
  320. name={t('Account')}
  321. component={make(
  322. () => import('sentry/views/settings/account/accountSettingsLayout')
  323. )}
  324. >
  325. <IndexRedirect to="details/" />
  326. <Route
  327. path="details/"
  328. name={t('Details')}
  329. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  330. />
  331. <Route path="notifications/" name={t('Notifications')}>
  332. <IndexRoute
  333. component={make(
  334. () =>
  335. import(
  336. 'sentry/views/settings/account/notifications/notificationSettingsController'
  337. )
  338. )}
  339. />
  340. <Route
  341. path=":fineTuneType/"
  342. name={t('Fine Tune Alerts')}
  343. component={make(
  344. () =>
  345. import(
  346. 'sentry/views/settings/account/accountNotificationFineTuningController'
  347. )
  348. )}
  349. />
  350. </Route>
  351. <Route
  352. path="emails/"
  353. name={t('Emails')}
  354. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  355. />
  356. <Route
  357. path="authorizations/"
  358. component={make(
  359. () => import('sentry/views/settings/account/accountAuthorizations')
  360. )}
  361. />
  362. <Route path="security/" name={t('Security')}>
  363. <Route
  364. component={make(
  365. () =>
  366. import(
  367. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  368. )
  369. )}
  370. >
  371. <IndexRoute
  372. component={make(
  373. () => import('sentry/views/settings/account/accountSecurity')
  374. )}
  375. />
  376. <Route
  377. path="session-history/"
  378. name={t('Session History')}
  379. component={make(
  380. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  381. )}
  382. />
  383. <Route
  384. path="mfa/:authId/"
  385. name={t('Details')}
  386. component={make(
  387. () =>
  388. import(
  389. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  390. )
  391. )}
  392. />
  393. </Route>
  394. <Route
  395. path="mfa/:authId/enroll/"
  396. name={t('Enroll')}
  397. component={make(
  398. () =>
  399. import(
  400. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  401. )
  402. )}
  403. />
  404. </Route>
  405. <Route
  406. path="subscriptions/"
  407. name={t('Subscriptions')}
  408. component={make(
  409. () => import('sentry/views/settings/account/accountSubscriptions')
  410. )}
  411. />
  412. <Route
  413. path="identities/"
  414. name={t('Identities')}
  415. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  416. />
  417. <Route path="api/" name={t('API')}>
  418. <IndexRedirect to="auth-tokens/" />
  419. <Route path="auth-tokens/" name={t('User Auth Tokens')}>
  420. <IndexRoute
  421. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  422. />
  423. <Route
  424. path="new-token/"
  425. name={t('Create New Token')}
  426. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  427. />
  428. </Route>
  429. <Route path="applications/" name={t('Applications')}>
  430. <IndexRoute
  431. component={make(
  432. () => import('sentry/views/settings/account/apiApplications')
  433. )}
  434. />
  435. <Route
  436. path=":appId/"
  437. name={t('Details')}
  438. component={make(
  439. () => import('sentry/views/settings/account/apiApplications/details')
  440. )}
  441. />
  442. </Route>
  443. {hook('routes:api')}
  444. </Route>
  445. <Route
  446. path="close-account/"
  447. name={t('Close Account')}
  448. component={make(() => import('sentry/views/settings/account/accountClose'))}
  449. />
  450. </Route>
  451. );
  452. const projectSettingsRoutes = (
  453. <Route
  454. path="projects/:projectId/"
  455. name={t('Project')}
  456. component={make(
  457. () => import('sentry/views/settings/project/projectSettingsLayout')
  458. )}
  459. >
  460. <IndexRoute
  461. name={t('General')}
  462. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  463. />
  464. <Redirect from="install/" to="/projects/:projectId/getting-started/" />
  465. <Route
  466. path="teams/"
  467. name={t('Teams')}
  468. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  469. />
  470. <Route
  471. path="alerts/"
  472. name={t('Alerts')}
  473. component={make(() => import('sentry/views/settings/projectAlerts'))}
  474. >
  475. <IndexRoute
  476. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  477. />
  478. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  479. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  480. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  481. <Redirect
  482. from="metric-rules/new/"
  483. to="/organizations/:orgId/alerts/:projectId/new/"
  484. />
  485. <Redirect
  486. from="rules/:ruleId/"
  487. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  488. />
  489. <Redirect
  490. from="metric-rules/:ruleId/"
  491. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  492. />
  493. </Route>
  494. <Route
  495. path="environments/"
  496. name={t('Environments')}
  497. component={make(
  498. () => import('sentry/views/settings/project/projectEnvironments')
  499. )}
  500. >
  501. <IndexRoute />
  502. <Route path="hidden/" />
  503. </Route>
  504. <Route
  505. path="tags/"
  506. name={t('Tags')}
  507. component={make(() => import('sentry/views/settings/projectTags'))}
  508. />
  509. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  510. <Route
  511. path="release-tracking/"
  512. name={t('Release Tracking')}
  513. component={make(
  514. () => import('sentry/views/settings/project/projectReleaseTracking')
  515. )}
  516. />
  517. <Route
  518. path="ownership/"
  519. name={t('Ownership Rules')}
  520. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  521. />
  522. <Route
  523. path="data-forwarding/"
  524. name={t('Data Forwarding')}
  525. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  526. />
  527. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  528. <IndexRoute
  529. component={make(
  530. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  531. )}
  532. />
  533. <Route
  534. path="advanced-data-scrubbing/:scrubbingId/"
  535. component={make(
  536. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  537. )}
  538. />
  539. </Route>
  540. <Route
  541. path="debug-symbols/"
  542. name={t('Debug Information Files')}
  543. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  544. />
  545. <Route
  546. path="proguard/"
  547. name={t('ProGuard Mappings')}
  548. component={make(() => import('sentry/views/settings/projectProguard'))}
  549. />
  550. <Route
  551. path="performance/"
  552. name={t('Performance')}
  553. component={make(() => import('sentry/views/settings/projectPerformance'))}
  554. />
  555. <Route path="metrics/" name={t('Metrics')}>
  556. <IndexRoute
  557. component={make(() => import('sentry/views/settings/projectMetrics'))}
  558. />
  559. <Route
  560. name={t('Metrics Details')}
  561. path=":mri/"
  562. component={make(
  563. () => import('sentry/views/settings/projectMetrics/projectMetricsDetails')
  564. )}
  565. />
  566. </Route>
  567. <Route
  568. path="replays/"
  569. name={t('Replays')}
  570. component={make(() => import('sentry/views/settings/project/projectReplays'))}
  571. />
  572. <Route path="source-maps/" name={t('Source Maps')}>
  573. <IndexRoute
  574. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  575. />
  576. <Route
  577. path="artifact-bundles/"
  578. name={t('Artifact Bundles')}
  579. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  580. >
  581. <Route
  582. name={t('Artifact Bundle')}
  583. path=":bundleId/"
  584. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  585. />
  586. </Route>
  587. <Route
  588. path="release-bundles/"
  589. name={t('Release Bundles')}
  590. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  591. >
  592. <Route
  593. name={t('Release Bundle')}
  594. path=":bundleId/"
  595. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  596. />
  597. </Route>
  598. <Redirect from=":name/" to="release-bundles/:name/" />
  599. </Route>
  600. <Route
  601. path="processing-issues/"
  602. name={t('Processing Issues')}
  603. component={make(
  604. () => import('sentry/views/settings/project/projectProcessingIssues')
  605. )}
  606. />
  607. <Route
  608. path="filters/"
  609. name={t('Inbound Filters')}
  610. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  611. >
  612. <IndexRedirect to="data-filters/" />
  613. <Route path=":filterType/" />
  614. </Route>
  615. <Redirect from="dynamic-sampling/" to="performance/" />
  616. <Route
  617. path="issue-grouping/"
  618. name={t('Issue Grouping')}
  619. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  620. />
  621. <Route
  622. path="hooks/"
  623. name={t('Service Hooks')}
  624. component={make(
  625. () => import('sentry/views/settings/project/projectServiceHooks')
  626. )}
  627. />
  628. <Route
  629. path="hooks/new/"
  630. name={t('Create Service Hook')}
  631. component={make(
  632. () => import('sentry/views/settings/project/projectCreateServiceHook')
  633. )}
  634. />
  635. <Route
  636. path="hooks/:hookId/"
  637. name={t('Service Hook Details')}
  638. component={make(
  639. () => import('sentry/views/settings/project/projectServiceHookDetails')
  640. )}
  641. />
  642. <Route path="keys/" name={t('Client Keys')}>
  643. <IndexRoute
  644. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  645. />
  646. <Route
  647. path=":keyId/"
  648. name={t('Details')}
  649. component={make(
  650. () => import('sentry/views/settings/project/projectKeys/details')
  651. )}
  652. />
  653. </Route>
  654. <Route
  655. path="loader-script/"
  656. name={t('Loader Script')}
  657. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  658. />
  659. <Route
  660. path="user-feedback/"
  661. name={t('User Feedback')}
  662. component={make(
  663. () => import('sentry/views/settings/project/projectUserFeedback')
  664. )}
  665. />
  666. <Redirect from="csp/" to="security-headers/" />
  667. <Route path="security-headers/" name={t('Security Headers')}>
  668. <IndexRoute
  669. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  670. />
  671. <Route
  672. path="csp/"
  673. name={t('Content Security Policy')}
  674. component={make(
  675. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  676. )}
  677. />
  678. <Route
  679. path="expect-ct/"
  680. name={t('Certificate Transparency')}
  681. component={make(
  682. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  683. )}
  684. />
  685. <Route
  686. path="hpkp/"
  687. name={t('HPKP')}
  688. component={make(
  689. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  690. )}
  691. />
  692. </Route>
  693. <Route path="plugins/" name={t('Legacy Integrations')}>
  694. <IndexRoute
  695. component={make(() => import('sentry/views/settings/projectPlugins'))}
  696. />
  697. <Route
  698. path=":pluginId/"
  699. name={t('Integration Details')}
  700. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  701. />
  702. </Route>
  703. </Route>
  704. );
  705. const orgSettingsRoutes = (
  706. <Route
  707. component={make(
  708. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  709. )}
  710. >
  711. {hook('routes:organization')}
  712. {!USING_CUSTOMER_DOMAIN && (
  713. <IndexRoute
  714. name={t('General')}
  715. component={make(
  716. () => import('sentry/views/settings/organizationGeneralSettings')
  717. )}
  718. />
  719. )}
  720. {USING_CUSTOMER_DOMAIN && (
  721. <Route
  722. path="/settings/organization/"
  723. name={t('General')}
  724. component={make(
  725. () => import('sentry/views/settings/organizationGeneralSettings')
  726. )}
  727. />
  728. )}
  729. <Route
  730. path="projects/"
  731. name={t('Projects')}
  732. component={make(() => import('sentry/views/settings/organizationProjects'))}
  733. />
  734. <Route path="api-keys/" name={t('API Key')}>
  735. <IndexRoute
  736. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  737. />
  738. <Route
  739. path=":apiKey/"
  740. name={t('Details')}
  741. component={make(
  742. () =>
  743. import(
  744. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  745. )
  746. )}
  747. />
  748. </Route>
  749. <Route
  750. path="audit-log/"
  751. name={t('Audit Log')}
  752. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  753. />
  754. <Route
  755. path="auth/"
  756. name={t('Auth Providers')}
  757. component={make(() => import('sentry/views/settings/organizationAuth'))}
  758. />
  759. <Redirect from="members/requests" to="members/" />
  760. <Route path="members/" name={t('Members')}>
  761. <Route
  762. component={make(
  763. () =>
  764. import(
  765. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  766. )
  767. )}
  768. >
  769. <IndexRoute
  770. component={make(
  771. () =>
  772. import(
  773. 'sentry/views/settings/organizationMembers/organizationMembersList'
  774. )
  775. )}
  776. />
  777. </Route>
  778. <Route
  779. path=":memberId/"
  780. name={t('Details')}
  781. component={make(
  782. () =>
  783. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  784. )}
  785. />
  786. </Route>
  787. <Route
  788. path="rate-limits/"
  789. name={t('Rate Limits')}
  790. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  791. />
  792. <Route
  793. path="relay/"
  794. name={t('Relay')}
  795. component={make(() => import('sentry/views/settings/organizationRelay'))}
  796. />
  797. <Route
  798. path="repos/"
  799. name={t('Repositories')}
  800. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  801. />
  802. <Route
  803. path="settings/"
  804. component={make(
  805. () => import('sentry/views/settings/organizationGeneralSettings')
  806. )}
  807. />
  808. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  809. <IndexRoute
  810. component={make(
  811. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  812. )}
  813. />
  814. <Route
  815. path="advanced-data-scrubbing/:scrubbingId/"
  816. component={make(
  817. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  818. )}
  819. />
  820. </Route>
  821. <Route path="teams/" name={t('Teams')}>
  822. <IndexRoute
  823. component={make(() => import('sentry/views/settings/organizationTeams'))}
  824. />
  825. <Route
  826. path=":teamId/"
  827. name={t('Team')}
  828. component={make(
  829. () => import('sentry/views/settings/organizationTeams/teamDetails')
  830. )}
  831. >
  832. <IndexRedirect to="members/" />
  833. <Route
  834. path="members/"
  835. name={t('Members')}
  836. component={make(
  837. () => import('sentry/views/settings/organizationTeams/teamMembers')
  838. )}
  839. />
  840. <Route
  841. path="notifications/"
  842. name={t('Notifications')}
  843. component={make(
  844. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  845. )}
  846. />
  847. <Route
  848. path="projects/"
  849. name={t('Projects')}
  850. component={make(
  851. () => import('sentry/views/settings/organizationTeams/teamProjects')
  852. )}
  853. />
  854. <Route
  855. path="settings/"
  856. name={t('Settings')}
  857. component={make(
  858. () => import('sentry/views/settings/organizationTeams/teamSettings')
  859. )}
  860. />
  861. </Route>
  862. </Route>
  863. <Redirect from="plugins/" to="integrations/" />
  864. <Route path="plugins/" name={t('Integrations')}>
  865. <Route
  866. path=":integrationSlug/"
  867. name={t('Integration Details')}
  868. component={make(
  869. () =>
  870. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  871. )}
  872. />
  873. </Route>
  874. <Redirect from="sentry-apps/" to="integrations/" />
  875. <Route path="sentry-apps/" name={t('Integrations')}>
  876. <Route
  877. path=":integrationSlug"
  878. name={t('Details')}
  879. component={make(
  880. () =>
  881. import(
  882. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  883. )
  884. )}
  885. />
  886. </Route>
  887. <Redirect from="document-integrations/" to="integrations/" />
  888. <Route path="document-integrations/" name={t('Integrations')}>
  889. <Route
  890. path=":integrationSlug"
  891. name={t('Details')}
  892. component={make(
  893. () =>
  894. import(
  895. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  896. )
  897. )}
  898. />
  899. </Route>
  900. <Route path="integrations/" name={t('Integrations')}>
  901. <IndexRoute
  902. component={make(
  903. () =>
  904. import(
  905. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  906. )
  907. )}
  908. />
  909. <Route
  910. path=":integrationSlug"
  911. name={t('Integration Details')}
  912. component={make(
  913. () =>
  914. import(
  915. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  916. )
  917. )}
  918. />
  919. <Route
  920. path=":providerKey/:integrationId/"
  921. name={t('Configure Integration')}
  922. component={make(
  923. () =>
  924. import(
  925. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  926. )
  927. )}
  928. />
  929. </Route>
  930. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  931. <Route path="developer-settings/" name={t('Custom Integrations')}>
  932. <IndexRoute
  933. component={make(
  934. () => import('sentry/views/settings/organizationDeveloperSettings')
  935. )}
  936. />
  937. <Route
  938. path="new-public/"
  939. name={t('Create Integration')}
  940. component={make(
  941. () =>
  942. import(
  943. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  944. )
  945. )}
  946. />
  947. <Route
  948. path="new-internal/"
  949. name={t('Create Integration')}
  950. component={make(
  951. () =>
  952. import(
  953. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  954. )
  955. )}
  956. />
  957. <Route
  958. path=":appSlug/"
  959. name={t('Edit Integration')}
  960. component={make(
  961. () =>
  962. import(
  963. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  964. )
  965. )}
  966. />
  967. <Route
  968. path=":appSlug/dashboard/"
  969. name={t('Integration Dashboard')}
  970. component={make(
  971. () =>
  972. import(
  973. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  974. )
  975. )}
  976. />
  977. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  978. <Route
  979. path="new/"
  980. name={t('Create Sentry Function')}
  981. component={make(
  982. () =>
  983. import(
  984. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  985. )
  986. )}
  987. />
  988. <Route
  989. path=":functionSlug/"
  990. name={t('Edit Sentry Function')}
  991. component={make(
  992. () =>
  993. import(
  994. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  995. )
  996. )}
  997. />
  998. </Route>
  999. </Route>
  1000. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  1001. <IndexRoute
  1002. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  1003. />
  1004. <Route
  1005. path="new-token/"
  1006. name={t('Create New Auth Token')}
  1007. component={make(
  1008. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  1009. )}
  1010. />
  1011. <Route
  1012. path=":tokenId/"
  1013. name={t('Edit Auth Token')}
  1014. component={make(
  1015. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  1016. )}
  1017. />
  1018. </Route>
  1019. <Route
  1020. path="early-features/"
  1021. name={t('Early Features')}
  1022. component={make(() => import('sentry/views/settings/earlyFeatures'))}
  1023. />
  1024. </Route>
  1025. );
  1026. const legacySettingsRedirects = (
  1027. <Fragment>
  1028. <Redirect from=":projectId/" to="projects/:projectId/" />
  1029. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  1030. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  1031. <Redirect
  1032. from=":projectId/alerts/rules/:ruleId/"
  1033. to="projects/:projectId/alerts/rules/:ruleId/"
  1034. />
  1035. </Fragment>
  1036. );
  1037. const settingsRoutes = (
  1038. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  1039. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  1040. {accountSettingsRoutes}
  1041. <Fragment>
  1042. {USING_CUSTOMER_DOMAIN && (
  1043. <Route
  1044. name={t('Organization')}
  1045. component={withDomainRequired(NoOp)}
  1046. key="orgless-settings-route"
  1047. >
  1048. {orgSettingsRoutes}
  1049. {projectSettingsRoutes}
  1050. </Route>
  1051. )}
  1052. <Route
  1053. path=":orgId/"
  1054. name={t('Organization')}
  1055. component={withDomainRedirect(NoOp)}
  1056. key="org-settings"
  1057. >
  1058. {orgSettingsRoutes}
  1059. {projectSettingsRoutes}
  1060. {legacySettingsRedirects}
  1061. </Route>
  1062. </Fragment>
  1063. </Route>
  1064. );
  1065. const projectsChildRoutes = (
  1066. <Fragment>
  1067. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1068. <Route
  1069. path="new/"
  1070. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1071. />
  1072. <Route
  1073. path=":projectId/"
  1074. component={make(() => import('sentry/views/projectDetail'))}
  1075. />
  1076. <Route
  1077. path=":projectId/events/:eventId/"
  1078. component={errorHandler(ProjectEventRedirect)}
  1079. />
  1080. <Route
  1081. path=":projectId/getting-started/"
  1082. component={make(
  1083. () => import('sentry/views/projectInstall/platformOrIntegration')
  1084. )}
  1085. />
  1086. </Fragment>
  1087. );
  1088. const projectsRoutes = (
  1089. <Fragment>
  1090. {USING_CUSTOMER_DOMAIN && (
  1091. <Route
  1092. path="/projects/"
  1093. component={make(() => import('sentry/views/projects/'))}
  1094. key="orgless-projects-route"
  1095. >
  1096. {projectsChildRoutes}
  1097. </Route>
  1098. )}
  1099. <Route
  1100. path="/organizations/:orgId/projects/"
  1101. component={make(() => import('sentry/views/projects/'))}
  1102. key="org-projects"
  1103. >
  1104. {projectsChildRoutes}
  1105. </Route>
  1106. </Fragment>
  1107. );
  1108. const dashboardWidgetRoutes = (
  1109. <Fragment>
  1110. <Route
  1111. path="widget/:widgetIndex/edit/"
  1112. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1113. />
  1114. <Route
  1115. path="widget/new/"
  1116. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1117. />
  1118. <Route
  1119. path="widget/:widgetId/"
  1120. component={make(() => import('sentry/views/dashboards/view'))}
  1121. />
  1122. </Fragment>
  1123. );
  1124. const dashboardRoutes = (
  1125. <Fragment>
  1126. <Fragment>
  1127. {USING_CUSTOMER_DOMAIN && (
  1128. <Route
  1129. path="/dashboards/"
  1130. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1131. key="orgless-dashboards-route"
  1132. >
  1133. <IndexRoute
  1134. component={make(() => import('sentry/views/dashboards/manage'))}
  1135. />
  1136. </Route>
  1137. )}
  1138. <Route
  1139. path="/organizations/:orgId/dashboards/"
  1140. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1141. key="org-dashboards"
  1142. >
  1143. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1144. </Route>
  1145. </Fragment>
  1146. <Fragment>
  1147. {USING_CUSTOMER_DOMAIN && (
  1148. <Route
  1149. path="/dashboards/new/"
  1150. component={withDomainRequired(
  1151. make(() => import('sentry/views/dashboards/create'))
  1152. )}
  1153. key="orgless-dashboards-new-route"
  1154. >
  1155. <Route
  1156. path="widget/:widgetIndex/edit/"
  1157. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1158. />
  1159. <Route
  1160. path="widget/new/"
  1161. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1162. />
  1163. </Route>
  1164. )}
  1165. <Route
  1166. path="/organizations/:orgId/dashboards/new/"
  1167. component={withDomainRedirect(
  1168. make(() => import('sentry/views/dashboards/create'))
  1169. )}
  1170. key="org-dashboards-new"
  1171. >
  1172. <Route
  1173. path="widget/:widgetIndex/edit/"
  1174. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1175. />
  1176. <Route
  1177. path="widget/new/"
  1178. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1179. />
  1180. </Route>
  1181. </Fragment>
  1182. <Fragment>
  1183. {USING_CUSTOMER_DOMAIN && (
  1184. <Route
  1185. path="/dashboards/new/:templateId"
  1186. component={withDomainRequired(
  1187. make(() => import('sentry/views/dashboards/create'))
  1188. )}
  1189. key="orgless-dashboards-new-template-route"
  1190. >
  1191. <Route
  1192. path="widget/:widgetId/"
  1193. component={make(() => import('sentry/views/dashboards/create'))}
  1194. />
  1195. </Route>
  1196. )}
  1197. <Route
  1198. path="/organizations/:orgId/dashboards/new/:templateId"
  1199. component={withDomainRedirect(
  1200. make(() => import('sentry/views/dashboards/create'))
  1201. )}
  1202. key="org-dashboards-new-template"
  1203. >
  1204. <Route
  1205. path="widget/:widgetId/"
  1206. component={make(() => import('sentry/views/dashboards/create'))}
  1207. />
  1208. </Route>
  1209. </Fragment>
  1210. <Redirect
  1211. from="/organizations/:orgId/dashboards/:dashboardId/"
  1212. to="/organizations/:orgId/dashboard/:dashboardId/"
  1213. />
  1214. {USING_CUSTOMER_DOMAIN && (
  1215. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1216. )}
  1217. <Fragment>
  1218. {USING_CUSTOMER_DOMAIN && (
  1219. <Route
  1220. path="/dashboard/:dashboardId/"
  1221. component={withDomainRequired(
  1222. make(() => import('sentry/views/dashboards/view'))
  1223. )}
  1224. key="orgless-dashboards-dashboard-id-route"
  1225. >
  1226. {dashboardWidgetRoutes}
  1227. </Route>
  1228. )}
  1229. <Route
  1230. path="/organizations/:orgId/dashboard/:dashboardId/"
  1231. component={withDomainRedirect(
  1232. make(() => import('sentry/views/dashboards/view'))
  1233. )}
  1234. key="org-dashboards-dashboard-id"
  1235. >
  1236. {dashboardWidgetRoutes}
  1237. </Route>
  1238. </Fragment>
  1239. </Fragment>
  1240. );
  1241. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1242. return (
  1243. <Fragment>
  1244. <IndexRoute
  1245. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1246. />
  1247. <Route path="rules/">
  1248. <IndexRoute
  1249. component={make(
  1250. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1251. )}
  1252. />
  1253. <Route
  1254. path="details/:ruleId/"
  1255. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1256. />
  1257. <Route
  1258. path=":projectId/"
  1259. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1260. >
  1261. <IndexRedirect
  1262. to={
  1263. forCustomerDomain
  1264. ? '/alerts/rules/'
  1265. : '/organizations/:orgId/alerts/rules/'
  1266. }
  1267. />
  1268. <Route
  1269. path=":ruleId/"
  1270. component={make(() => import('sentry/views/alerts/edit'))}
  1271. />
  1272. </Route>
  1273. <Route path=":projectId/:ruleId/details/">
  1274. <IndexRoute
  1275. component={make(
  1276. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1277. )}
  1278. />
  1279. </Route>
  1280. </Route>
  1281. <Route path="metric-rules/">
  1282. <IndexRedirect
  1283. to={
  1284. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1285. }
  1286. />
  1287. <Route
  1288. path=":projectId/"
  1289. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1290. >
  1291. <IndexRedirect
  1292. to={
  1293. forCustomerDomain
  1294. ? '/alerts/rules/'
  1295. : '/organizations/:orgId/alerts/rules/'
  1296. }
  1297. />
  1298. <Route
  1299. path=":ruleId/"
  1300. component={make(() => import('sentry/views/alerts/edit'))}
  1301. />
  1302. </Route>
  1303. </Route>
  1304. <Route
  1305. path="wizard/"
  1306. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1307. >
  1308. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1309. </Route>
  1310. <Route
  1311. path="new/"
  1312. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1313. >
  1314. <IndexRedirect
  1315. to={
  1316. forCustomerDomain
  1317. ? '/alerts/wizard/'
  1318. : '/organizations/:orgId/alerts/wizard/'
  1319. }
  1320. />
  1321. <Route
  1322. path=":alertType/"
  1323. component={make(() => import('sentry/views/alerts/create'))}
  1324. />
  1325. </Route>
  1326. <Route
  1327. path=":alertId/"
  1328. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1329. />
  1330. <Route
  1331. path=":projectId/"
  1332. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1333. >
  1334. <Route
  1335. path="new/"
  1336. component={make(() => import('sentry/views/alerts/create'))}
  1337. />
  1338. <Route
  1339. path="wizard/"
  1340. component={make(() => import('sentry/views/alerts/wizard'))}
  1341. />
  1342. </Route>
  1343. </Fragment>
  1344. );
  1345. };
  1346. const alertRoutes = (
  1347. <Fragment>
  1348. {USING_CUSTOMER_DOMAIN && (
  1349. <Route
  1350. path="/alerts/"
  1351. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1352. key="orgless-alerts-route"
  1353. >
  1354. {alertChildRoutes({forCustomerDomain: true})}
  1355. </Route>
  1356. )}
  1357. <Route
  1358. path="/organizations/:orgId/alerts/"
  1359. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1360. key="org-alerts"
  1361. >
  1362. {alertChildRoutes({forCustomerDomain: false})}
  1363. </Route>
  1364. </Fragment>
  1365. );
  1366. const cronsChildRoutes = (
  1367. <Fragment>
  1368. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1369. <Route
  1370. path="create/"
  1371. component={make(() => import('sentry/views/monitors/create'))}
  1372. />
  1373. <Route
  1374. path=":monitorSlug/"
  1375. component={make(() => import('sentry/views/monitors/details'))}
  1376. />
  1377. <Route
  1378. path=":monitorSlug/edit/"
  1379. component={make(() => import('sentry/views/monitors/edit'))}
  1380. />
  1381. </Fragment>
  1382. );
  1383. const cronsRoutes = (
  1384. <Fragment>
  1385. {USING_CUSTOMER_DOMAIN && (
  1386. <Route
  1387. path="/crons/"
  1388. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1389. key="orgless-monitors-route"
  1390. >
  1391. {cronsChildRoutes}
  1392. </Route>
  1393. )}
  1394. <Route
  1395. path="/organizations/:orgId/crons/"
  1396. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1397. key="org-monitors"
  1398. >
  1399. {cronsChildRoutes}
  1400. </Route>
  1401. </Fragment>
  1402. );
  1403. const replayChildRoutes = (
  1404. <Fragment>
  1405. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1406. <Route
  1407. path="selectors/"
  1408. component={make(
  1409. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1410. )}
  1411. />
  1412. <Route
  1413. path=":replaySlug/"
  1414. component={make(() => import('sentry/views/replays/details'))}
  1415. />
  1416. </Fragment>
  1417. );
  1418. const replayRoutes = (
  1419. <Fragment>
  1420. {USING_CUSTOMER_DOMAIN && (
  1421. <Route
  1422. path="/replays/"
  1423. component={withDomainRequired(make(() => import('sentry/views/replays/index')))}
  1424. key="orgless-replays-route"
  1425. >
  1426. {replayChildRoutes}
  1427. </Route>
  1428. )}
  1429. <Route
  1430. path="/organizations/:orgId/replays/"
  1431. component={withDomainRedirect(make(() => import('sentry/views/replays/index')))}
  1432. key="org-replays"
  1433. >
  1434. {replayChildRoutes}
  1435. </Route>
  1436. </Fragment>
  1437. );
  1438. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1439. return (
  1440. <Fragment>
  1441. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1442. <Route
  1443. path=":release/"
  1444. component={make(() => import('sentry/views/releases/detail'))}
  1445. >
  1446. <IndexRoute
  1447. component={make(() => import('sentry/views/releases/detail/overview'))}
  1448. />
  1449. <Route
  1450. path="commits/"
  1451. component={make(
  1452. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1453. )}
  1454. />
  1455. <Route
  1456. path="files-changed/"
  1457. component={make(
  1458. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1459. )}
  1460. />
  1461. {forCustomerDomain ? null : (
  1462. <Fragment>
  1463. <Redirect
  1464. from="new-events/"
  1465. to="/organizations/:orgId/releases/:release/"
  1466. />
  1467. <Redirect
  1468. from="all-events/"
  1469. to="/organizations/:orgId/releases/:release/"
  1470. />
  1471. </Fragment>
  1472. )}
  1473. </Route>
  1474. </Fragment>
  1475. );
  1476. };
  1477. const releasesRoutes = (
  1478. <Fragment>
  1479. {USING_CUSTOMER_DOMAIN && (
  1480. <Route
  1481. path="/releases/"
  1482. component={withDomainRequired(NoOp)}
  1483. key="orgless-releases-route"
  1484. >
  1485. {releasesChildRoutes({forCustomerDomain: true})}
  1486. </Route>
  1487. )}
  1488. <Route
  1489. path="/organizations/:orgId/releases/"
  1490. component={withDomainRedirect(NoOp)}
  1491. key="org-releases"
  1492. >
  1493. {releasesChildRoutes({forCustomerDomain: false})}
  1494. </Route>
  1495. </Fragment>
  1496. );
  1497. const releaseThresholdRoutes = (
  1498. <Fragment>
  1499. {USING_CUSTOMER_DOMAIN && (
  1500. <Route
  1501. path="/release-thresholds/"
  1502. component={withDomainRequired(NoOp)}
  1503. key="orgless-release-thresholds-route"
  1504. >
  1505. <IndexRoute
  1506. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1507. />
  1508. </Route>
  1509. )}
  1510. <Route
  1511. path="/organizations/:orgId/release-thresholds/"
  1512. component={withDomainRedirect(NoOp)}
  1513. key="org-release-thresholds"
  1514. >
  1515. <IndexRoute
  1516. component={make(() => import('sentry/views/releases/thresholdsList'))}
  1517. />
  1518. </Route>
  1519. </Fragment>
  1520. );
  1521. const activityRoutes = (
  1522. <Fragment>
  1523. {USING_CUSTOMER_DOMAIN && (
  1524. <Route
  1525. path="/activity/"
  1526. component={withDomainRequired(
  1527. make(() => import('sentry/views/organizationActivity'))
  1528. )}
  1529. key="orgless-activity-route"
  1530. />
  1531. )}
  1532. <Route
  1533. path="/organizations/:orgId/activity/"
  1534. component={withDomainRedirect(
  1535. make(() => import('sentry/views/organizationActivity'))
  1536. )}
  1537. key="org-activity"
  1538. />
  1539. </Fragment>
  1540. );
  1541. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1542. return (
  1543. <Fragment>
  1544. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1545. <Route
  1546. path="issues/"
  1547. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1548. >
  1549. <IndexRoute
  1550. component={make(
  1551. () => import('sentry/views/organizationStats/teamInsights/issues')
  1552. )}
  1553. />
  1554. </Route>
  1555. <Route
  1556. path="health/"
  1557. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1558. >
  1559. <IndexRoute
  1560. component={make(
  1561. () => import('sentry/views/organizationStats/teamInsights/health')
  1562. )}
  1563. />
  1564. </Route>
  1565. {forCustomerDomain ? null : (
  1566. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1567. )}
  1568. </Fragment>
  1569. );
  1570. };
  1571. const statsRoutes = (
  1572. <Fragment>
  1573. {USING_CUSTOMER_DOMAIN && (
  1574. <Route
  1575. path="/stats/"
  1576. component={withDomainRequired(NoOp)}
  1577. key="orgless-stats-route"
  1578. >
  1579. {statsChildRoutes({forCustomerDomain: true})}
  1580. </Route>
  1581. )}
  1582. <Route
  1583. path="/organizations/:orgId/stats/"
  1584. component={withDomainRedirect(NoOp)}
  1585. key="org-stats"
  1586. >
  1587. {statsChildRoutes({forCustomerDomain: false})}
  1588. </Route>
  1589. </Fragment>
  1590. );
  1591. // TODO(mark) Long term this /queries route should go away and /discover
  1592. // should be the canonical route for discover2. We have a redirect right now
  1593. // as /discover was for discover 1 and most of the application is linking to
  1594. // /discover/queries and not /discover
  1595. const discoverChildRoutes = (
  1596. <Fragment>
  1597. <IndexRedirect to="queries/" />
  1598. <Route
  1599. path="homepage/"
  1600. component={make(() => import('sentry/views/discover/homepage'))}
  1601. />
  1602. <Route
  1603. path="queries/"
  1604. component={make(() => import('sentry/views/discover/landing'))}
  1605. />
  1606. <Route
  1607. path="results/"
  1608. component={make(() => import('sentry/views/discover/results'))}
  1609. />
  1610. <Route
  1611. path=":eventSlug/"
  1612. component={make(() => import('sentry/views/discover/eventDetails'))}
  1613. />
  1614. </Fragment>
  1615. );
  1616. const discoverRoutes = (
  1617. <Fragment>
  1618. {USING_CUSTOMER_DOMAIN && (
  1619. <Route
  1620. path="/discover/"
  1621. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1622. key="orgless-discover-route"
  1623. >
  1624. {discoverChildRoutes}
  1625. </Route>
  1626. )}
  1627. <Route
  1628. path="/organizations/:orgId/discover/"
  1629. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1630. key="org-discover-route"
  1631. >
  1632. {discoverChildRoutes}
  1633. </Route>
  1634. </Fragment>
  1635. );
  1636. const performanceChildRoutes = (
  1637. <Fragment>
  1638. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1639. <Route
  1640. path="trends/"
  1641. component={make(() => import('sentry/views/performance/trends'))}
  1642. />
  1643. <Route path="database/">
  1644. <IndexRoute
  1645. component={make(
  1646. () => import('sentry/views/performance/database/databaseLandingPage')
  1647. )}
  1648. />
  1649. <Route
  1650. path="spans/span/:groupId/"
  1651. component={make(
  1652. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1653. )}
  1654. />
  1655. </Route>
  1656. <Route path="http/">
  1657. <IndexRoute
  1658. component={make(() => import('sentry/views/performance/http/httpLandingPage'))}
  1659. />
  1660. <Route
  1661. path="domains/"
  1662. component={make(
  1663. () => import('sentry/views/performance/http/httpDomainSummaryPage')
  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 OrganizationLayout 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(OrganizationLayout)}>
  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({children}: {children: JSX.Element}) {
  2529. return children;
  2530. }