routes.tsx 80 KB

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