diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
51 files changed, 170 insertions, 280 deletions
diff --git a/server/sonar-web/src/main/js/apps/about/routes.ts b/server/sonar-web/src/main/js/apps/about/routes.ts index 1f191646d3f..597a857f944 100644 --- a/server/sonar-web/src/main/js/apps/about/routes.ts +++ b/server/sonar-web/src/main/js/apps/about/routes.ts @@ -17,8 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; -const routes = [{ indexRoute: { component: lazyLoad(() => import('./components/AboutApp')) } }]; +const routes = [ + { indexRoute: { component: lazyLoadComponent(() => import('./components/AboutApp')) } } +]; export default routes; diff --git a/server/sonar-web/src/main/js/apps/account/routes.ts b/server/sonar-web/src/main/js/apps/account/routes.ts index 69866937fdf..8fc8ed5cefd 100644 --- a/server/sonar-web/src/main/js/apps/account/routes.ts +++ b/server/sonar-web/src/main/js/apps/account/routes.ts @@ -17,30 +17,30 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - component: lazyLoad(() => import('./components/Account')), + component: lazyLoadComponent(() => import('./components/Account')), childRoutes: [ { - indexRoute: { component: lazyLoad(() => import('./profile/Profile')) } + indexRoute: { component: lazyLoadComponent(() => import('./profile/Profile')) } }, { path: 'security', - component: lazyLoad(() => import('./components/Security')) + component: lazyLoadComponent(() => import('./components/Security')) }, { path: 'projects', - component: lazyLoad(() => import('./projects/ProjectsContainer')) + component: lazyLoadComponent(() => import('./projects/ProjectsContainer')) }, { path: 'notifications', - component: lazyLoad(() => import('./notifications/Notifications')) + component: lazyLoadComponent(() => import('./notifications/Notifications')) }, { path: 'organizations', - component: lazyLoad(() => import('./organizations/UserOrganizations')) + component: lazyLoadComponent(() => import('./organizations/UserOrganizations')) } ] } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx index 99e159dc4cb..f9352185a85 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx @@ -22,13 +22,13 @@ import ActionsDropdown, { ActionsDropdownItem } from 'sonar-ui-common/components/controls/ActionsDropdown'; import ConfirmModal from 'sonar-ui-common/components/controls/ConfirmModal'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import { STATUSES } from '../constants'; import ScannerContext from './ScannerContext'; import Stacktrace from './Stacktrace'; -const AnalysisWarningsModal = lazyLoad( +const AnalysisWarningsModal = lazyLoadComponent( () => import('../../../components/common/AnalysisWarningsModal'), 'AnalysisWarningsModal' ); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/routes.ts b/server/sonar-web/src/main/js/apps/background-tasks/routes.ts index 32ba890ac8f..7f600552b51 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/routes.ts +++ b/server/sonar-web/src/main/js/apps/background-tasks/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/BackgroundTasksApp')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/BackgroundTasksApp')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/code/routes.ts b/server/sonar-web/src/main/js/apps/code/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/code/routes.ts +++ b/server/sonar-web/src/main/js/apps/code/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/routes.ts b/server/sonar-web/src/main/js/apps/coding-rules/routes.ts index c52c905b0f3..c40a5571355 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/routes.ts +++ b/server/sonar-web/src/main/js/apps/coding-rules/routes.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { RedirectFunction, RouterState } from 'react-router'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import { parseQuery, serializeQuery } from './query'; function parseHash(hash: string): T.RawQuery { @@ -47,7 +47,7 @@ const routes = [ replace({ pathname: nextState.location.pathname, query: normalizedQuery }); } }, - component: lazyLoad(() => import('./components/App')) + component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/component-measures/routes.ts b/server/sonar-web/src/main/js/apps/component-measures/routes.ts index 2499b15eb9b..07d80dda92c 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/routes.ts +++ b/server/sonar-web/src/main/js/apps/component-measures/routes.ts @@ -18,11 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { RedirectFunction, RouterState } from 'react-router'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } }, { path: 'domain/:domainName', diff --git a/server/sonar-web/src/main/js/apps/custom-measures/routes.ts b/server/sonar-web/src/main/js/apps/custom-measures/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/routes.ts +++ b/server/sonar-web/src/main/js/apps/custom-measures/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/custom-metrics/routes.ts b/server/sonar-web/src/main/js/apps/custom-metrics/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/custom-metrics/routes.ts +++ b/server/sonar-web/src/main/js/apps/custom-metrics/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/documentation/routes.ts b/server/sonar-web/src/main/js/apps/documentation/routes.ts index 1e488c6b290..061f011e981 100644 --- a/server/sonar-web/src/main/js/apps/documentation/routes.ts +++ b/server/sonar-web/src/main/js/apps/documentation/routes.ts @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; -const App = lazyLoad(() => import(/* webpackChunkName: "docs" */ './components/App')); +const App = lazyLoadComponent(() => import(/* webpackChunkName: "docs" */ './components/App')); const routes = [{ indexRoute: { component: App } }, { path: '**', indexRoute: { component: App } }]; diff --git a/server/sonar-web/src/main/js/apps/groups/routes.ts b/server/sonar-web/src/main/js/apps/groups/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/groups/routes.ts +++ b/server/sonar-web/src/main/js/apps/groups/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx b/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx deleted file mode 100644 index 286f065e4fc..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/IssuesPageSelector.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2020 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import { withCurrentUser } from '../../components/hoc/withCurrentUser'; -import { Location } from '../../components/hoc/withRouter'; -import { isSonarCloud } from '../../helpers/system'; -import { isLoggedIn } from '../../helpers/users'; -import AppContainer from './components/AppContainer'; - -export interface Props { - currentUser: T.CurrentUser; - location: Location; -} - -export function IssuesPage({ currentUser, location }: Props) { - const myIssues = (isLoggedIn(currentUser) && isSonarCloud()) || undefined; - return <AppContainer location={location} myIssues={myIssues} />; -} - -export default withCurrentUser(IssuesPage); diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesPageSelector-test.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesPageSelector-test.tsx deleted file mode 100644 index e8bcac889f0..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesPageSelector-test.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2020 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { isSonarCloud } from '../../../helpers/system'; -import { mockCurrentUser, mockLocation, mockLoggedInUser } from '../../../helpers/testMocks'; -import { IssuesPage, Props } from '../IssuesPageSelector'; - -jest.mock('../../../helpers/system', () => ({ isSonarCloud: jest.fn().mockReturnValue(false) })); - -it('should render normal issues page', () => { - expect(shallowRender()).toMatchSnapshot(); - expect( - shallowRender({ currentUser: mockLoggedInUser() }) - .find('Connect(IssuesAppContainer)') - .prop('myIssues') - ).toBeFalsy(); - (isSonarCloud as jest.Mock).mockReturnValueOnce(true); - expect( - shallowRender() - .find('Connect(IssuesAppContainer)') - .prop('myIssues') - ).toBeFalsy(); -}); - -it('should render my issues page', () => { - (isSonarCloud as jest.Mock).mockReturnValueOnce(true); - expect( - shallowRender({ currentUser: mockLoggedInUser() }) - .find('Connect(IssuesAppContainer)') - .prop('myIssues') - ).toBeTruthy(); -}); - -function shallowRender(props: Partial<Props> = {}) { - return shallow( - <IssuesPage currentUser={mockCurrentUser()} location={mockLocation()} {...props} /> - ); -} diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/__snapshots__/IssuesPageSelector-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/__tests__/__snapshots__/IssuesPageSelector-test.tsx.snap deleted file mode 100644 index cc2de94d3fb..00000000000 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/__snapshots__/IssuesPageSelector-test.tsx.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render normal issues page 1`] = ` -<Connect(IssuesAppContainer) - location={ - Object { - "action": "PUSH", - "hash": "", - "key": "key", - "pathname": "/path", - "query": Object {}, - "search": "", - "state": Object {}, - } - } -/> -`; diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.tsx b/server/sonar-web/src/main/js/apps/issues/components/App.tsx index cb4c4eac287..cf838a1407a 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/App.tsx @@ -22,7 +22,6 @@ import { debounce, keyBy, omit, without } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; -import { connect } from 'react-redux'; import { Button } from 'sonar-ui-common/components/controls/buttons'; import Checkbox from 'sonar-ui-common/components/controls/Checkbox'; import ListFooter from 'sonar-ui-common/components/controls/ListFooter'; @@ -41,7 +40,7 @@ import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import EmptySearch from '../../../components/common/EmptySearch'; import FiltersHeader from '../../../components/common/FiltersHeader'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; -import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; +import { Location, Router } from '../../../components/hoc/withRouter'; import '../../../components/search-navigator.css'; import { fillBranchLike, @@ -50,7 +49,6 @@ import { isSameBranchLike } from '../../../helpers/branch-like'; import { isSonarCloud } from '../../../helpers/system'; -import { fetchBranchStatus } from '../../../store/rootActions'; import { BranchLike } from '../../../types/branch-like'; import * as actions from '../actions'; import ConciseIssuesList from '../conciseIssuesList/ConciseIssuesList'; @@ -104,10 +102,10 @@ interface Props { fetchBranchStatus: (branchLike: BranchLike, projectKey: string) => Promise<void>; fetchIssues: (query: T.RawQuery, requestOrganizations?: boolean) => Promise<FetchIssuesPromise>; hideAuthorFacet?: boolean; - location: Pick<Location, 'pathname' | 'query'>; + location: Location; multiOrganizations?: boolean; myIssues?: boolean; - onBranchesChange: () => void; + onBranchesChange?: () => void; organization?: { key: string }; router: Pick<Router, 'push' | 'replace'>; userOrganizations: T.Organization[]; @@ -144,7 +142,7 @@ export interface State { const DEFAULT_QUERY = { resolved: 'false' }; const MAX_INITAL_FETCH = 1000; -export class App extends React.PureComponent<Props, State> { +export default class App extends React.PureComponent<Props, State> { mounted = false; constructor(props: Props) { @@ -539,13 +537,13 @@ export class App extends React.PureComponent<Props, State> { const { paging } = this.state; if (!paging) { - return; + return Promise.reject(); } const p = paging.pageIndex + 1; this.setState({ checkAll: false, loadingMore: true }); - this.fetchIssuesPage(p).then( + return this.fetchIssuesPage(p).then( response => { if (this.mounted) { this.setState(state => ({ @@ -825,8 +823,9 @@ export class App extends React.PureComponent<Props, State> { handleReload = () => { this.fetchFirstIssues(); this.refreshBranchStatus(); - if (isPullRequest(this.props.branchLike)) { - this.props.onBranchesChange(); + const { branchLike, onBranchesChange } = this.props; + if (onBranchesChange && isPullRequest(branchLike)) { + onBranchesChange(); } }; @@ -1180,7 +1179,3 @@ export class App extends React.PureComponent<Props, State> { ); } } - -const mapDispatchToProps = { fetchBranchStatus: fetchBranchStatus as any }; - -export default withRouter(connect(null, mapDispatchToProps)(App)); diff --git a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx index a896d854d77..c964c626911 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx @@ -20,12 +20,14 @@ import { uniq } from 'lodash'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import { searchIssues } from '../../../api/issues'; import { getOrganizations } from '../../../api/organizations'; import throwGlobalError from '../../../app/utils/throwGlobalError'; +import { withRouter } from '../../../components/hoc/withRouter'; import { parseIssueFromResponse } from '../../../helpers/issues'; import { receiveOrganizations } from '../../../store/organizations'; +import { fetchBranchStatus } from '../../../store/rootActions'; import { areThereCustomOrganizations, getCurrentUser, @@ -33,6 +35,8 @@ import { Store } from '../../../store/rootReducer'; +const IssuesAppContainer = lazyLoadComponent(() => import('./App'), 'IssuesAppContainer'); + interface StateProps { currentUser: T.CurrentUser; userOrganizations: T.Organization[]; @@ -79,14 +83,10 @@ const fetchIssues = (query: T.RawQuery, requestOrganizations = true) => ( .catch(throwGlobalError); }; -interface DispatchProps { - fetchIssues: (query: T.RawQuery, requestOrganizations?: boolean) => Promise<void>; -} - // have to type cast this, because of async action -const mapDispatchToProps = { fetchIssues: fetchIssues as any } as DispatchProps; +const mapDispatchToProps = { + fetchBranchStatus: fetchBranchStatus as any, + fetchIssues: fetchIssues as any +}; -export default connect( - mapStateToProps, - mapDispatchToProps -)(lazyLoad(() => import('./App'), 'IssuesAppContainer')); +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(IssuesAppContainer)); diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx index 1036a7d0f08..3edd0115439 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { uniq } from 'lodash'; import * as React from 'react'; import { scrollToElement } from 'sonar-ui-common/helpers/scrolling'; import SourceViewer from '../../../components/SourceViewer/SourceViewer'; @@ -91,12 +90,10 @@ export default class IssuesSourceViewer extends React.PureComponent<Props> { : undefined; if (locations.length > 0) { - const components = uniq(locations.map(l => l.component)); return ( <div ref={node => (this.node = node)}> <CrossComponentSourceViewer branchLike={this.props.branchLike} - components={components} highlightedLocationMessage={highlightedLocationMessage} issue={openIssue} issues={this.props.issues} diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx index ea42ad2518e..e7fdb635567 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx @@ -38,7 +38,7 @@ import { selectPreviousFlow, selectPreviousLocation } from '../../actions'; -import { App } from '../App'; +import App from '../App'; jest.mock('sonar-ui-common/helpers/handleRequiredAuthentication', () => ({ default: jest.fn() @@ -90,7 +90,7 @@ it('should not render for anonymous user', () => { it('should open standard facets for vulnerabilities and hotspots', () => { const wrapper = shallowRender({ - location: { pathname: '/issues', query: { types: 'VULNERABILITY' } } + location: mockLocation({ pathname: '/issues', query: { types: 'VULNERABILITY' } }) }); const instance = wrapper.instance(); const fetchFacet = jest.spyOn(instance, 'fetchFacet'); @@ -420,7 +420,7 @@ function shallowRender(props: Partial<App['props']> = {}) { rules: [], users: [] })} - location={{ pathname: '/issues', query: {} }} + location={mockLocation({ pathname: '/issues', query: {} })} onBranchesChange={() => {}} organization={{ key: 'foo' }} router={mockRouter()} diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap index 090eac8205a..a0bd5ab199c 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesSourceViewer-test.tsx.snap @@ -11,11 +11,6 @@ exports[`should render CrossComponentSourceViewer correctly 1`] = ` "name": "master", } } - components={ - Array [ - "main.js", - ] - } issue={ Object { "actions": Array [], diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx index 420d0cf659c..84a4e68c4d6 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; -const CrossComponentSourceViewer = lazyLoad( +const CrossComponentSourceViewer = lazyLoadComponent( () => import(/* webpackPrefetch: true */ './CrossComponentSourceViewerWrapper'), 'CrossComponentSourceViewer' ); diff --git a/server/sonar-web/src/main/js/apps/maintenance/routes.tsx b/server/sonar-web/src/main/js/apps/maintenance/routes.tsx index 06690209734..705dfafcd47 100644 --- a/server/sonar-web/src/main/js/apps/maintenance/routes.tsx +++ b/server/sonar-web/src/main/js/apps/maintenance/routes.tsx @@ -19,12 +19,12 @@ */ import * as React from 'react'; import { IndexRoute } from 'react-router'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; export const maintenanceRoutes = ( - <IndexRoute component={lazyLoad(() => import('./components/MaintenanceAppContainer'))} /> + <IndexRoute component={lazyLoadComponent(() => import('./components/MaintenanceAppContainer'))} /> ); export const setupRoutes = ( - <IndexRoute component={lazyLoad(() => import('./components/SetupAppContainer'))} /> + <IndexRoute component={lazyLoadComponent(() => import('./components/SetupAppContainer'))} /> ); diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx index 1ee19543cd6..dc80a1870f4 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx @@ -21,12 +21,15 @@ import tooltipDCE from 'Docs/tooltips/editions/datacenter.md'; import tooltipDE from 'Docs/tooltips/editions/developer.md'; import tooltipEE from 'Docs/tooltips/editions/enterprise.md'; import * as React from 'react'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import { translate } from 'sonar-ui-common/helpers/l10n'; import { getEditionUrl } from '../../../helpers/editions'; import { Edition, EditionKey } from '../../../types/editions'; -const DocMarkdownBlock = lazyLoad(() => import('../../../components/docs/DocMarkdownBlock')); +const DocMarkdownBlock = lazyLoadComponent( + () => import('../../../components/docs/DocMarkdownBlock'), + 'DocMarkdownBlock' +); interface Props { currentEdition?: EditionKey; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap index cfd28f4bc35..538a9f2b9ef 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionBox-test.tsx.snap @@ -4,7 +4,7 @@ exports[`should display the edition 1`] = ` <div className="boxed-group boxed-group-inner marketplace-edition" > - <LazyLoader /> + <DocMarkdownBlock /> <div className="marketplace-edition-action spacer-top" > diff --git a/server/sonar-web/src/main/js/apps/marketplace/routes.ts b/server/sonar-web/src/main/js/apps/marketplace/routes.ts index 68418a8f274..729a854fd60 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/routes.ts +++ b/server/sonar-web/src/main/js/apps/marketplace/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./AppContainer')) } + indexRoute: { component: lazyLoadComponent(() => import('./AppContainer')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx index 83ba57896b9..c53f19f768d 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationProjects.tsx @@ -29,11 +29,7 @@ interface Props { export default function OrganizationProjects(props: Props) { return ( <> - <AllProjectsContainer - isFavorite={false} - location={props.location} - organization={props.organization} - /> + <AllProjectsContainer isFavorite={false} organization={props.organization} /> <Suggestions suggestions="organization_projects" /> </> ); diff --git a/server/sonar-web/src/main/js/apps/organizations/routes.ts b/server/sonar-web/src/main/js/apps/organizations/routes.ts index 975ddd60eee..1efff137c9f 100644 --- a/server/sonar-web/src/main/js/apps/organizations/routes.ts +++ b/server/sonar-web/src/main/js/apps/organizations/routes.ts @@ -18,18 +18,18 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { RedirectFunction, RouterState } from 'react-router'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import codingRulesRoutes from '../coding-rules/routes'; import qualityGatesRoutes from '../quality-gates/routes'; import qualityProfilesRoutes from '../quality-profiles/routes'; import webhooksRoutes from '../webhooks/routes'; -const OrganizationContainer = lazyLoad(() => import('./components/OrganizationContainer')); +const OrganizationContainer = lazyLoadComponent(() => import('./components/OrganizationContainer')); const routes = [ { path: ':organizationKey', - component: lazyLoad(() => import('./components/OrganizationPage')), + component: lazyLoadComponent(() => import('./components/OrganizationPage')), childRoutes: [ { indexRoute: { @@ -43,14 +43,22 @@ const routes = [ path: 'projects', component: OrganizationContainer, childRoutes: [ - { indexRoute: { component: lazyLoad(() => import('./components/OrganizationProjects')) } } + { + indexRoute: { + component: lazyLoadComponent(() => import('./components/OrganizationProjects')) + } + } ] }, { path: 'issues', component: OrganizationContainer, childRoutes: [ - { indexRoute: { component: lazyLoad(() => import('../issues/components/AppContainer')) } } + { + indexRoute: { + component: lazyLoadComponent(() => import('../issues/components/AppContainer')) + } + } ] }, { @@ -60,7 +68,9 @@ const routes = [ }, { path: 'members', - component: lazyLoad(() => import('../organizationMembers/OrganizationMembersContainer')) + component: lazyLoadComponent(() => + import('../organizationMembers/OrganizationMembersContainer') + ) }, { path: 'quality_profiles', @@ -72,26 +82,32 @@ const routes = [ childRoutes: qualityGatesRoutes }, { - component: lazyLoad(() => import('./components/OrganizationAccessContainer')), + component: lazyLoadComponent(() => import('./components/OrganizationAccessContainer')), childRoutes: [ - { path: 'edit', component: lazyLoad(() => import('./components/OrganizationEdit')) }, - { path: 'groups', component: lazyLoad(() => import('../groups/components/App')) }, + { + path: 'edit', + component: lazyLoadComponent(() => import('./components/OrganizationEdit')) + }, + { + path: 'groups', + component: lazyLoadComponent(() => import('../groups/components/App')) + }, { path: 'permissions', - component: lazyLoad(() => import('../permissions/global/components/App')) + component: lazyLoadComponent(() => import('../permissions/global/components/App')) }, { path: 'permission_templates', - component: lazyLoad(() => import('../permission-templates/components/App')) + component: lazyLoadComponent(() => import('../permission-templates/components/App')) }, { path: 'projects_management', - component: lazyLoad(() => import('../projectsManagement/AppContainer')) + component: lazyLoadComponent(() => import('../projectsManagement/AppContainer')) }, { path: 'webhooks', childRoutes: webhooksRoutes }, { path: 'extension/:pluginKey/:extensionKey', - component: lazyLoad(() => + component: lazyLoadComponent(() => import('../../app/components/extensions/OrganizationPageExtension') ) } diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.tsx b/server/sonar-web/src/main/js/apps/overview/components/App.tsx index e10115c9780..fbd6ea0c950 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/App.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import { Router, withRouter } from '../../../components/hoc/withRouter'; import { isPullRequest } from '../../../helpers/branch-like'; @@ -26,8 +26,8 @@ import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import BranchOverview from '../branches/BranchOverview'; -const EmptyOverview = lazyLoad(() => import('./EmptyOverview')); -const PullRequestOverview = lazyLoad(() => import('../pullRequests/PullRequestOverview')); +const EmptyOverview = lazyLoadComponent(() => import('./EmptyOverview')); +const PullRequestOverview = lazyLoadComponent(() => import('../pullRequests/PullRequestOverview')); interface Props { branchLike?: BranchLike; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx index eeec9f5ea7d..18862261bce 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx @@ -41,15 +41,23 @@ import { IssueType, MeasurementType, PR_METRICS } from '../utils'; import AfterMergeEstimate from './AfterMergeEstimate'; import LargeQualityGateBadge from './LargeQualityGateBadge'; -interface Props { - branchLike: PullRequest; - component: T.Component; +interface StateProps { conditions?: QualityGateStatusCondition[]; - fetchBranchStatus: (branchLike: BranchLike, projectKey: string) => Promise<void>; ignoredConditions?: boolean; status?: T.Status; } +interface DispatchProps { + fetchBranchStatus: (branchLike: BranchLike, projectKey: string) => Promise<void>; +} + +interface OwnProps { + branchLike: PullRequest; + component: T.Component; +} + +type Props = StateProps & DispatchProps & OwnProps; + interface State { loading: boolean; measures: T.MeasureEnhanced[]; @@ -244,4 +252,7 @@ const mapStateToProps = (state: Store, { branchLike, component }: Props) => { const mapDispatchToProps = { fetchBranchStatus: fetchBranchStatus as any }; -export default connect(mapStateToProps, mapDispatchToProps)(PullRequestOverview); +export default connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(PullRequestOverview); diff --git a/server/sonar-web/src/main/js/apps/overview/routes.ts b/server/sonar-web/src/main/js/apps/overview/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/overview/routes.ts +++ b/server/sonar-web/src/main/js/apps/overview/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/routes.ts b/server/sonar-web/src/main/js/apps/permission-templates/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/routes.ts +++ b/server/sonar-web/src/main/js/apps/permission-templates/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/permissions/routes.ts b/server/sonar-web/src/main/js/apps/permissions/routes.ts index cf478a468be..da2a3b06f11 100644 --- a/server/sonar-web/src/main/js/apps/permissions/routes.ts +++ b/server/sonar-web/src/main/js/apps/permissions/routes.ts @@ -17,16 +17,16 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; export const globalPermissionsRoutes = [ { - indexRoute: { component: lazyLoad(() => import('./global/components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./global/components/App')) } } ]; export const projectPermissionsRoutes = [ { - indexRoute: { component: lazyLoad(() => import('./project/components/AppContainer')) } + indexRoute: { component: lazyLoadComponent(() => import('./project/components/AppContainer')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/portfolio/routes.ts b/server/sonar-web/src/main/js/apps/portfolio/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/routes.ts +++ b/server/sonar-web/src/main/js/apps/portfolio/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/routes.ts b/server/sonar-web/src/main/js/apps/projectActivity/routes.ts index 575ab1d0e7b..96df47d62da 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/routes.ts +++ b/server/sonar-web/src/main/js/apps/projectActivity/routes.ts @@ -17,12 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { indexRoute: { - component: lazyLoad(() => import('./components/ProjectActivityAppContainer')) + component: lazyLoadComponent(() => import('./components/ProjectActivityAppContainer')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/routes.ts b/server/sonar-web/src/main/js/apps/projectBaseline/routes.ts index 2b83ad2df23..2b08f969444 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/routes.ts +++ b/server/sonar-web/src/main/js/apps/projectBaseline/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/AppContainer')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/AppContainer')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/routes.ts b/server/sonar-web/src/main/js/apps/projectBranches/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/routes.ts +++ b/server/sonar-web/src/main/js/apps/projectBranches/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/routes.ts b/server/sonar-web/src/main/js/apps/projectQualityGate/routes.ts index 8f91ec48084..d82abd3b146 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/routes.ts +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./App')) } + indexRoute: { component: lazyLoadComponent(() => import('./App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/routes.ts b/server/sonar-web/src/main/js/apps/projectQualityProfiles/routes.ts index 8f91ec48084..d82abd3b146 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/routes.ts +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./App')) } + indexRoute: { component: lazyLoadComponent(() => import('./App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjectsContainer.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjectsContainer.tsx index 7877a05ad3c..09c3f522345 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjectsContainer.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjectsContainer.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { connect } from 'react-redux'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import { areThereCustomOrganizations, getCurrentUser, Store } from '../../../store/rootReducer'; const stateToProps = (state: Store) => ({ @@ -26,4 +26,4 @@ const stateToProps = (state: Store) => ({ organizationsEnabled: areThereCustomOrganizations(state) }); -export default connect(stateToProps)(lazyLoad(() => import('./AllProjects'))); +export default connect(stateToProps)(lazyLoadComponent(() => import('./AllProjects'))); diff --git a/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx b/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx index 476aa33acda..fc3f6fb794f 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/DefaultPageSelector.tsx @@ -108,13 +108,7 @@ export class DefaultPageSelector extends React.PureComponent<Props, State> { render() { if (isSonarCloud() && isLoggedIn(this.props.currentUser)) { - return ( - <AllProjectsContainer - isFavorite={true} - location={this.props.location} - organization={undefined} - /> - ); + return <AllProjectsContainer isFavorite={true} organization={undefined} />; } const { shouldBeRedirected, shouldForceSorting } = this.state; @@ -124,13 +118,7 @@ export class DefaultPageSelector extends React.PureComponent<Props, State> { shouldBeRedirected !== true && shouldForceSorting === undefined ) { - return ( - <AllProjectsContainer - isFavorite={false} - location={this.props.location} - organization={undefined} - /> - ); + return <AllProjectsContainer isFavorite={false} organization={undefined} />; } return null; diff --git a/server/sonar-web/src/main/js/apps/projects/routes.ts b/server/sonar-web/src/main/js/apps/projects/routes.ts index b0920a4b169..7cd069419a1 100644 --- a/server/sonar-web/src/main/js/apps/projects/routes.ts +++ b/server/sonar-web/src/main/js/apps/projects/routes.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { RedirectFunction, RouterState } from 'react-router'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import { save } from 'sonar-ui-common/helpers/storage'; import { isDefined } from 'sonar-ui-common/helpers/types'; import DefaultPageSelectorContainer from './components/DefaultPageSelectorContainer'; @@ -37,7 +37,7 @@ const routes = [ { path: 'favorite', component: FavoriteProjectsContainer }, { path: 'create', - component: lazyLoad(() => import('../create/project/CreateProjectPage')) + component: lazyLoadComponent(() => import('../create/project/CreateProjectPage')) } ].filter(isDefined); diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/routes.ts b/server/sonar-web/src/main/js/apps/projectsManagement/routes.ts index 68418a8f274..729a854fd60 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/routes.ts +++ b/server/sonar-web/src/main/js/apps/projectsManagement/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./AppContainer')) } + indexRoute: { component: lazyLoadComponent(() => import('./AppContainer')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/routes.ts b/server/sonar-web/src/main/js/apps/quality-gates/routes.ts index f2b31650fbd..0b0da83d63d 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/routes.ts +++ b/server/sonar-web/src/main/js/apps/quality-gates/routes.ts @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; -const App = lazyLoad(() => import('./components/App')); +const App = lazyLoadComponent(() => import('./components/App')); const routes = [{ indexRoute: { component: App } }, { path: 'show/:id', component: App }]; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResultActivation.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResultActivation.tsx index 471a0a1160a..00eba49aa2c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResultActivation.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResultActivation.tsx @@ -19,13 +19,13 @@ */ import * as React from 'react'; import { Button } from 'sonar-ui-common/components/controls/buttons'; -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner'; import { translate } from 'sonar-ui-common/helpers/l10n'; import { Profile } from '../../../api/quality-profiles'; import { getRuleDetails } from '../../../api/rules'; -const ActivationFormModal = lazyLoad( +const ActivationFormModal = lazyLoadComponent( () => import('../../coding-rules/components/ActivationFormModal'), 'ActivationFormModal' ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts b/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts index 85588a40ce6..7d1b18bb50b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts +++ b/server/sonar-web/src/main/js/apps/quality-profiles/routes.ts @@ -17,27 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - component: lazyLoad(() => import('./components/AppContainer')), - indexRoute: { component: lazyLoad(() => import('./home/HomeContainer')) }, + component: lazyLoadComponent(() => import('./components/AppContainer')), + indexRoute: { component: lazyLoadComponent(() => import('./home/HomeContainer')) }, childRoutes: [ { - component: lazyLoad(() => import('./components/ProfileContainer')), + component: lazyLoadComponent(() => import('./components/ProfileContainer')), childRoutes: [ { path: 'show', - component: lazyLoad(() => import('./details/ProfileDetails')) + component: lazyLoadComponent(() => import('./details/ProfileDetails')) }, { path: 'changelog', - component: lazyLoad(() => import('./changelog/ChangelogContainer')) + component: lazyLoadComponent(() => import('./changelog/ChangelogContainer')) }, { path: 'compare', - component: lazyLoad(() => import('./compare/ComparisonContainer')) + component: lazyLoadComponent(() => import('./compare/ComparisonContainer')) } ] } diff --git a/server/sonar-web/src/main/js/apps/sessions/routes.ts b/server/sonar-web/src/main/js/apps/sessions/routes.ts index c1293bf3ee1..6b7c1d13145 100644 --- a/server/sonar-web/src/main/js/apps/sessions/routes.ts +++ b/server/sonar-web/src/main/js/apps/sessions/routes.ts @@ -17,24 +17,24 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { path: 'new', - component: lazyLoad(() => import('./components/LoginContainer')) + component: lazyLoadComponent(() => import('./components/LoginContainer')) }, { path: 'logout', - component: lazyLoad(() => import('./components/Logout')) + component: lazyLoadComponent(() => import('./components/Logout')) }, { path: 'unauthorized', - component: lazyLoad(() => import('./components/Unauthorized')) + component: lazyLoadComponent(() => import('./components/Unauthorized')) }, { path: 'email_already_exists', - component: lazyLoad(() => import('./components/EmailAlreadyExists')) + component: lazyLoadComponent(() => import('./components/EmailAlreadyExists')) } ]; diff --git a/server/sonar-web/src/main/js/apps/settings/routes.ts b/server/sonar-web/src/main/js/apps/settings/routes.ts index d36ab7cc4ad..a7ac736f78f 100644 --- a/server/sonar-web/src/main/js/apps/settings/routes.ts +++ b/server/sonar-web/src/main/js/apps/settings/routes.ts @@ -17,15 +17,15 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/AppContainer')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/AppContainer')) } }, { path: 'encryption', - component: lazyLoad(() => import('./encryption/EncryptionApp')) + component: lazyLoadComponent(() => import('./encryption/EncryptionApp')) } ]; diff --git a/server/sonar-web/src/main/js/apps/system/routes.ts b/server/sonar-web/src/main/js/apps/system/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/system/routes.ts +++ b/server/sonar-web/src/main/js/apps/system/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/tutorials/routes.ts b/server/sonar-web/src/main/js/apps/tutorials/routes.ts index adb92439919..4436986b49d 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/routes.ts +++ b/server/sonar-web/src/main/js/apps/tutorials/routes.ts @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; -import { isSonarCloud } from '../../helpers/system'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { indexRoute: { - component: lazyLoad(() => - isSonarCloud() ? import('./onboarding/OnboardingPage') : import('./ProjectOnboardingPage') - ) + component: lazyLoadComponent(() => import('./ProjectOnboardingPage')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/users/routes.ts b/server/sonar-web/src/main/js/apps/users/routes.ts index 3e75189e325..4df2cd1dab3 100644 --- a/server/sonar-web/src/main/js/apps/users/routes.ts +++ b/server/sonar-web/src/main/js/apps/users/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./UsersAppContainer')) } + indexRoute: { component: lazyLoadComponent(() => import('./UsersAppContainer')) } } ]; diff --git a/server/sonar-web/src/main/js/apps/web-api/routes.ts b/server/sonar-web/src/main/js/apps/web-api/routes.ts index fcebe06dc0f..56f159d6cc6 100644 --- a/server/sonar-web/src/main/js/apps/web-api/routes.ts +++ b/server/sonar-web/src/main/js/apps/web-api/routes.ts @@ -17,15 +17,15 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/WebApiApp')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/WebApiApp')) } }, { path: '**', - component: lazyLoad(() => import('./components/WebApiApp')) + component: lazyLoadComponent(() => import('./components/WebApiApp')) } ]; diff --git a/server/sonar-web/src/main/js/apps/webhooks/routes.ts b/server/sonar-web/src/main/js/apps/webhooks/routes.ts index 168c5c58de6..92b03bc5607 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/routes.ts +++ b/server/sonar-web/src/main/js/apps/webhooks/routes.ts @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; +import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent'; const routes = [ { - indexRoute: { component: lazyLoad(() => import('./components/App')) } + indexRoute: { component: lazyLoadComponent(() => import('./components/App')) } } ]; |