routes.tsx 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535
  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="initialization/">
  1823. <IndexRoute
  1824. component={make(
  1825. () => import('sentry/views/starfish/modules/mobile/initialization')
  1826. )}
  1827. />
  1828. </Route>
  1829. <Route path="responsiveness/">
  1830. <IndexRoute
  1831. component={make(
  1832. () => import('sentry/views/starfish/modules/mobile/responsiveness')
  1833. )}
  1834. />
  1835. </Route>
  1836. <Route path="spans/">
  1837. <IndexRoute component={make(() => import('sentry/views/starfish/views/spans'))} />
  1838. <Route
  1839. path="span/:groupId/"
  1840. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1841. />
  1842. </Route>
  1843. </Fragment>
  1844. );
  1845. const starfishRoutes = (
  1846. <Fragment>
  1847. {usingCustomerDomain && (
  1848. <Route
  1849. path="/starfish/"
  1850. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1851. key="orgless-starfish-route"
  1852. >
  1853. {starfishChildRoutes}
  1854. </Route>
  1855. )}
  1856. <Route
  1857. path="/organizations/:orgId/starfish/"
  1858. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1859. key="org-starfish"
  1860. >
  1861. {starfishChildRoutes}
  1862. </Route>
  1863. </Fragment>
  1864. );
  1865. const userFeedbackRoutes = (
  1866. <Fragment>
  1867. {usingCustomerDomain && (
  1868. <Route
  1869. path="/user-feedback/"
  1870. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1871. key="orgless-user-feedback-route"
  1872. />
  1873. )}
  1874. <Route
  1875. path="/organizations/:orgId/user-feedback/"
  1876. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1877. key="org-user-feedback"
  1878. />
  1879. </Fragment>
  1880. );
  1881. const feedbackChildRoutes = (
  1882. <Fragment>
  1883. <IndexRoute
  1884. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1885. />
  1886. </Fragment>
  1887. );
  1888. const feedbackv2Routes = (
  1889. <Fragment>
  1890. {usingCustomerDomain && (
  1891. <Route
  1892. path="/feedback/"
  1893. component={withDomainRequired(
  1894. make(() => import('sentry/views/feedback/index'))
  1895. )}
  1896. key="orgless-feedback-list-route"
  1897. >
  1898. {feedbackChildRoutes}
  1899. </Route>
  1900. )}
  1901. <Route
  1902. path="/organizations/:orgId/feedback/"
  1903. component={withDomainRedirect(make(() => import('sentry/views/feedback/index')))}
  1904. key="org-feedback-list-route"
  1905. >
  1906. {feedbackChildRoutes}
  1907. </Route>
  1908. </Fragment>
  1909. );
  1910. const issueListRoutes = (
  1911. <Fragment>
  1912. {usingCustomerDomain && (
  1913. <Route
  1914. path="/issues/(searches/:searchId/)"
  1915. component={withDomainRequired(errorHandler(IssueListContainer))}
  1916. key="orgless-issues-route"
  1917. >
  1918. <IndexRoute component={errorHandler(IssueListOverview)} />
  1919. </Route>
  1920. )}
  1921. <Route
  1922. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1923. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1924. key="org-issues"
  1925. >
  1926. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1927. <IndexRoute component={errorHandler(IssueListOverview)} />
  1928. </Route>
  1929. </Fragment>
  1930. );
  1931. // Once org issues is complete, these routes can be nested under
  1932. // /organizations/:orgId/issues
  1933. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1934. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1935. return (
  1936. <Fragment>
  1937. <IndexRoute
  1938. component={hoc(
  1939. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1940. )}
  1941. />
  1942. <Route
  1943. path={TabPaths[Tab.REPLAYS]}
  1944. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1945. />
  1946. <Route
  1947. path={TabPaths[Tab.ACTIVITY]}
  1948. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1949. />
  1950. <Route
  1951. path={TabPaths[Tab.EVENTS]}
  1952. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1953. />
  1954. <Route
  1955. path={TabPaths[Tab.TAGS]}
  1956. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1957. />
  1958. <Route
  1959. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1960. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1961. />
  1962. <Route
  1963. path={TabPaths[Tab.USER_FEEDBACK]}
  1964. component={hoc(
  1965. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1966. )}
  1967. />
  1968. <Route
  1969. path={TabPaths[Tab.ATTACHMENTS]}
  1970. component={hoc(
  1971. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1972. )}
  1973. />
  1974. <Route
  1975. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1976. component={hoc(
  1977. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1978. )}
  1979. />
  1980. <Route
  1981. path={TabPaths[Tab.MERGED]}
  1982. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1983. />
  1984. </Fragment>
  1985. );
  1986. };
  1987. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1988. <Fragment>
  1989. {issueTabs({forCustomerDomain})}
  1990. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1991. {issueTabs({forCustomerDomain})}
  1992. </Route>
  1993. </Fragment>
  1994. );
  1995. const issueDetailsRoutes = (
  1996. <Fragment>
  1997. <Route
  1998. path="/organizations/:orgId/issues/:groupId/"
  1999. component={withDomainRedirect(
  2000. make(() => import('sentry/views/issueDetails/groupDetails'))
  2001. )}
  2002. key="org-issues-group-id"
  2003. >
  2004. {issueDetailsChildRoutes({forCustomerDomain: false})}
  2005. </Route>
  2006. {usingCustomerDomain && (
  2007. <Route
  2008. path="/issues/:groupId/"
  2009. component={withDomainRequired(
  2010. make(() => import('sentry/views/issueDetails/groupDetails'))
  2011. )}
  2012. key="orgless-issues-group-id-route"
  2013. >
  2014. {issueDetailsChildRoutes({forCustomerDomain: true})}
  2015. </Route>
  2016. )}
  2017. </Fragment>
  2018. );
  2019. // These are the "manage" pages. For sentry.io, these are _different_ from
  2020. // the SaaS admin routes in getsentry.
  2021. const adminManageRoutes = (
  2022. <Route
  2023. path="/manage/"
  2024. component={make(() => import('sentry/views/admin/adminLayout'))}
  2025. >
  2026. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  2027. <Route
  2028. path="buffer/"
  2029. component={make(() => import('sentry/views/admin/adminBuffer'))}
  2030. />
  2031. <Route
  2032. path="relays/"
  2033. component={make(() => import('sentry/views/admin/adminRelays'))}
  2034. />
  2035. <Route
  2036. path="organizations/"
  2037. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  2038. />
  2039. <Route
  2040. path="projects/"
  2041. component={make(() => import('sentry/views/admin/adminProjects'))}
  2042. />
  2043. <Route
  2044. path="queue/"
  2045. component={make(() => import('sentry/views/admin/adminQueue'))}
  2046. />
  2047. <Route
  2048. path="quotas/"
  2049. component={make(() => import('sentry/views/admin/adminQuotas'))}
  2050. />
  2051. <Route
  2052. path="settings/"
  2053. component={make(() => import('sentry/views/admin/adminSettings'))}
  2054. />
  2055. <Route path="users/">
  2056. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  2057. <Route
  2058. path=":id"
  2059. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  2060. />
  2061. </Route>
  2062. <Route
  2063. path="status/mail/"
  2064. component={make(() => import('sentry/views/admin/adminMail'))}
  2065. />
  2066. <Route
  2067. path="status/environment/"
  2068. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  2069. />
  2070. <Route
  2071. path="status/packages/"
  2072. component={make(() => import('sentry/views/admin/adminPackages'))}
  2073. />
  2074. <Route
  2075. path="status/warnings/"
  2076. component={make(() => import('sentry/views/admin/adminWarnings'))}
  2077. />
  2078. </Route>
  2079. );
  2080. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  2081. // me why we need the OrganizationRoot root container.
  2082. const legacyOrganizationRootRoutes = (
  2083. <Route component={errorHandler(OrganizationRoot)}>
  2084. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  2085. <Route path="/organizations/:orgId/">
  2086. {hook('routes:organization')}
  2087. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  2088. <Redirect
  2089. from="/organizations/:orgId/teams/your-teams/"
  2090. to="/settings/:orgId/teams/"
  2091. />
  2092. <Redirect
  2093. from="/organizations/:orgId/teams/all-teams/"
  2094. to="/settings/:orgId/teams/"
  2095. />
  2096. <Redirect
  2097. from="/organizations/:orgId/teams/:teamId/"
  2098. to="/settings/:orgId/teams/:teamId/"
  2099. />
  2100. <Redirect
  2101. from="/organizations/:orgId/teams/:teamId/members/"
  2102. to="/settings/:orgId/teams/:teamId/members/"
  2103. />
  2104. <Redirect
  2105. from="/organizations/:orgId/teams/:teamId/projects/"
  2106. to="/settings/:orgId/teams/:teamId/projects/"
  2107. />
  2108. <Redirect
  2109. from="/organizations/:orgId/teams/:teamId/settings/"
  2110. to="/settings/:orgId/teams/:teamId/settings/"
  2111. />
  2112. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  2113. <Redirect
  2114. from="/organizations/:orgId/api-keys/"
  2115. to="/settings/:orgId/api-keys/"
  2116. />
  2117. <Redirect
  2118. from="/organizations/:orgId/api-keys/:apiKey/"
  2119. to="/settings/:orgId/api-keys/:apiKey/"
  2120. />
  2121. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  2122. <Redirect
  2123. from="/organizations/:orgId/members/:memberId/"
  2124. to="/settings/:orgId/members/:memberId/"
  2125. />
  2126. <Redirect
  2127. from="/organizations/:orgId/rate-limits/"
  2128. to="/settings/:orgId/rate-limits/"
  2129. />
  2130. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  2131. </Route>
  2132. </Route>
  2133. );
  2134. const gettingStartedRoutes = (
  2135. <Fragment>
  2136. {usingCustomerDomain && (
  2137. <Fragment>
  2138. <Redirect
  2139. from="/getting-started/:projectId/"
  2140. to="/projects/:projectId/getting-started/"
  2141. />
  2142. <Redirect
  2143. from="/getting-started/:projectId/:platform/"
  2144. to="/projects/:projectId/getting-started/"
  2145. />
  2146. </Fragment>
  2147. )}
  2148. <Redirect
  2149. from="/:orgId/:projectId/getting-started/"
  2150. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2151. />
  2152. <Redirect
  2153. from="/:orgId/:projectId/getting-started/:platform/"
  2154. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2155. />
  2156. </Fragment>
  2157. );
  2158. const profilingChildRoutes = (
  2159. <Fragment>
  2160. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2161. <Route
  2162. path="summary/:projectId/"
  2163. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2164. />
  2165. <Route
  2166. path="profile/:projectId/:eventId/"
  2167. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2168. >
  2169. {/* @TODO Remove flamechart route name */}
  2170. <Route
  2171. path="flamechart/"
  2172. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2173. />
  2174. <Route
  2175. path="flamegraph/"
  2176. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2177. />
  2178. </Route>
  2179. </Fragment>
  2180. );
  2181. const profilingRoutes = (
  2182. <Fragment>
  2183. {usingCustomerDomain && (
  2184. <Route
  2185. path="/profiling/"
  2186. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2187. key="orgless-profiling-route"
  2188. >
  2189. {profilingChildRoutes}
  2190. </Route>
  2191. )}
  2192. <Route
  2193. path="/organizations/:orgId/profiling/"
  2194. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2195. key="org-profiling"
  2196. >
  2197. {profilingChildRoutes}
  2198. </Route>
  2199. </Fragment>
  2200. );
  2201. const ddmChildRoutes = (
  2202. <Fragment>
  2203. <IndexRoute component={make(() => import('sentry/views/ddm/ddm'))} />
  2204. </Fragment>
  2205. );
  2206. const ddmRoutes = (
  2207. <Fragment>
  2208. {usingCustomerDomain && (
  2209. <Route
  2210. path="/ddm/"
  2211. component={withDomainRequired(make(() => import('sentry/views/ddm')))}
  2212. key="orgless-ddm-route"
  2213. >
  2214. {ddmChildRoutes}
  2215. </Route>
  2216. )}
  2217. <Route
  2218. path="/organizations/:orgId/ddm/"
  2219. component={withDomainRedirect(make(() => import('sentry/views/ddm')))}
  2220. key="org-ddm"
  2221. >
  2222. {ddmChildRoutes}
  2223. </Route>
  2224. </Fragment>
  2225. );
  2226. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2227. // canonical URLs.
  2228. //
  2229. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2230. // or do these need to be nested into the OrganizationDetails tree?
  2231. const legacyOrgRedirects = (
  2232. <Route path="/:orgId/:projectId/">
  2233. <IndexRoute
  2234. component={errorHandler(
  2235. redirectDeprecatedProjectRoute(
  2236. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2237. )
  2238. )}
  2239. />
  2240. <Route
  2241. path="issues/"
  2242. component={errorHandler(
  2243. redirectDeprecatedProjectRoute(
  2244. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2245. )
  2246. )}
  2247. />
  2248. <Route
  2249. path="dashboard/"
  2250. component={errorHandler(
  2251. redirectDeprecatedProjectRoute(
  2252. ({orgId, projectId}) =>
  2253. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2254. )
  2255. )}
  2256. />
  2257. <Route
  2258. path="user-feedback/"
  2259. component={errorHandler(
  2260. redirectDeprecatedProjectRoute(
  2261. ({orgId, projectId}) =>
  2262. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2263. )
  2264. )}
  2265. />
  2266. <Route
  2267. path="releases/"
  2268. component={errorHandler(
  2269. redirectDeprecatedProjectRoute(
  2270. ({orgId, projectId}) =>
  2271. `/organizations/${orgId}/releases/?project=${projectId}`
  2272. )
  2273. )}
  2274. />
  2275. <Route
  2276. path="releases/:version/"
  2277. component={errorHandler(
  2278. redirectDeprecatedProjectRoute(
  2279. ({orgId, projectId, router}) =>
  2280. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2281. )
  2282. )}
  2283. />
  2284. <Route
  2285. path="releases/:version/new-events/"
  2286. component={errorHandler(
  2287. redirectDeprecatedProjectRoute(
  2288. ({orgId, projectId, router}) =>
  2289. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2290. )
  2291. )}
  2292. />
  2293. <Route
  2294. path="releases/:version/all-events/"
  2295. component={errorHandler(
  2296. redirectDeprecatedProjectRoute(
  2297. ({orgId, projectId, router}) =>
  2298. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2299. )
  2300. )}
  2301. />
  2302. <Route
  2303. path="releases/:version/commits/"
  2304. component={errorHandler(
  2305. redirectDeprecatedProjectRoute(
  2306. ({orgId, projectId, router}) =>
  2307. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2308. )
  2309. )}
  2310. />
  2311. </Route>
  2312. );
  2313. const organizationRoutes = (
  2314. <Route component={errorHandler(OrganizationDetails)}>
  2315. {settingsRoutes}
  2316. {projectsRoutes}
  2317. {dashboardRoutes}
  2318. {userFeedbackRoutes}
  2319. {feedbackv2Routes}
  2320. {issueListRoutes}
  2321. {issueDetailsRoutes}
  2322. {alertRoutes}
  2323. {cronsRoutes}
  2324. {replayRoutes}
  2325. {releasesRoutes}
  2326. {releaseThresholdRoutes}
  2327. {activityRoutes}
  2328. {statsRoutes}
  2329. {discoverRoutes}
  2330. {performanceRoutes}
  2331. {starfishRoutes}
  2332. {profilingRoutes}
  2333. {ddmRoutes}
  2334. {gettingStartedRoutes}
  2335. {adminManageRoutes}
  2336. {legacyOrganizationRootRoutes}
  2337. {legacyOrgRedirects}
  2338. </Route>
  2339. );
  2340. const legacyRedirectRoutes = (
  2341. <Route path="/:orgId/">
  2342. <IndexRedirect to="/organizations/:orgId/" />
  2343. <Route path=":projectId/settings/">
  2344. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2345. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2346. <Redirect
  2347. from="alerts/rules/"
  2348. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2349. />
  2350. <Redirect
  2351. from="alerts/rules/new/"
  2352. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2353. />
  2354. <Redirect
  2355. from="alerts/rules/:ruleId/"
  2356. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2357. />
  2358. <Redirect
  2359. from="environments/"
  2360. to="/settings/:orgId/projects/:projectId/environments/"
  2361. />
  2362. <Redirect
  2363. from="environments/hidden/"
  2364. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2365. />
  2366. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2367. <Redirect
  2368. from="issue-tracking/"
  2369. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2370. />
  2371. <Redirect
  2372. from="release-tracking/"
  2373. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2374. />
  2375. <Redirect
  2376. from="ownership/"
  2377. to="/settings/:orgId/projects/:projectId/ownership/"
  2378. />
  2379. <Redirect
  2380. from="data-forwarding/"
  2381. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2382. />
  2383. <Redirect
  2384. from="debug-symbols/"
  2385. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2386. />
  2387. <Redirect
  2388. from="processing-issues/"
  2389. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2390. />
  2391. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2392. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2393. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2394. <Redirect
  2395. from="keys/:keyId/"
  2396. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2397. />
  2398. <Redirect
  2399. from="user-feedback/"
  2400. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2401. />
  2402. <Redirect
  2403. from="security-headers/"
  2404. to="/settings/:orgId/projects/:projectId/security-headers/"
  2405. />
  2406. <Redirect
  2407. from="security-headers/csp/"
  2408. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2409. />
  2410. <Redirect
  2411. from="security-headers/expect-ct/"
  2412. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2413. />
  2414. <Redirect
  2415. from="security-headers/hpkp/"
  2416. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2417. />
  2418. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2419. <Redirect
  2420. from="plugins/:pluginId/"
  2421. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2422. />
  2423. <Redirect
  2424. from="integrations/:providerKey/"
  2425. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2426. />
  2427. </Route>
  2428. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2429. <Redirect
  2430. from=":projectId/issues/:groupId/"
  2431. to="/organizations/:orgId/issues/:groupId/"
  2432. />
  2433. <Redirect
  2434. from=":projectId/issues/:groupId/events/"
  2435. to="/organizations/:orgId/issues/:groupId/events/"
  2436. />
  2437. <Redirect
  2438. from=":projectId/issues/:groupId/events/:eventId/"
  2439. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2440. />
  2441. <Redirect
  2442. from=":projectId/issues/:groupId/tags/"
  2443. to="/organizations/:orgId/issues/:groupId/tags/"
  2444. />
  2445. <Redirect
  2446. from=":projectId/issues/:groupId/tags/:tagKey/"
  2447. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2448. />
  2449. <Redirect
  2450. from=":projectId/issues/:groupId/feedback/"
  2451. to="/organizations/:orgId/issues/:groupId/feedback/"
  2452. />
  2453. <Redirect
  2454. from=":projectId/issues/:groupId/similar/"
  2455. to="/organizations/:orgId/issues/:groupId/similar/"
  2456. />
  2457. <Redirect
  2458. from=":projectId/issues/:groupId/merged/"
  2459. to="/organizations/:orgId/issues/:groupId/merged/"
  2460. />
  2461. <Route
  2462. path=":projectId/events/:eventId/"
  2463. component={errorHandler(ProjectEventRedirect)}
  2464. />
  2465. </Route>
  2466. );
  2467. const appRoutes = (
  2468. <Route>
  2469. {experimentalSpaRoutes}
  2470. <Route path="/" component={errorHandler(App)}>
  2471. {rootRoutes}
  2472. {organizationRoutes}
  2473. {legacyRedirectRoutes}
  2474. <Route path="*" component={errorHandler(RouteNotFound)} />
  2475. </Route>
  2476. </Route>
  2477. );
  2478. return appRoutes;
  2479. }
  2480. // We load routes both when initializing the SDK (for routing integrations) and
  2481. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2482. export const routes = memoize(buildRoutes);
  2483. // Exported for use in tests.
  2484. export {buildRoutes};
  2485. function NoOp(props: {children: React.ReactNode}) {
  2486. return <Fragment>{props.children}</Fragment>;
  2487. }