routes.tsx 80 KB

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