routes.tsx 80 KB

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