routes.tsx 79 KB

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