routes.tsx 80 KB

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