routes.tsx 74 KB

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