routes.tsx 80 KB

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