routes.tsx 79 KB

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