diff options
author | Stas Vilchik <stas-vilchik@users.noreply.github.com> | 2017-03-27 12:04:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 12:04:48 +0200 |
commit | 7d963d84f40ee3db3b51c557fb596aa9febf82bb (patch) | |
tree | 7f761f198fae4ad898f4dd98703923921520098b /server/sonar-web/src/main/js/apps | |
parent | 48699b502c866ea5a309c57f8ad5e737d1933280 (diff) | |
download | sonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.tar.gz sonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.zip |
optimize js bundles (#1855)
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
118 files changed, 681 insertions, 404 deletions
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js index 6efe4c891d0..a0f80af5dca 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js @@ -20,7 +20,7 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import keyBy from 'lodash/keyBy'; +import { keyBy } from 'lodash'; import { Link } from 'react-router'; import AboutProjects from './AboutProjects'; import EntryIssueTypes from './EntryIssueTypes'; @@ -43,7 +43,7 @@ type State = { loading: boolean, projectsCount?: number, issueTypes?: { - [key: string]: { + [key: string]: ?{ count: number } } @@ -140,8 +140,7 @@ class AboutApp extends React.Component { <a className="button" href="https://redirect.sonarsource.com/doc/home.html" - target="_blank" - > + target="_blank"> {translate('about_page.read_documentation')} </a> </div> diff --git a/server/sonar-web/src/main/js/apps/about/routes.js b/server/sonar-web/src/main/js/apps/about/routes.js index a8d72cc6e72..13940436e30 100644 --- a/server/sonar-web/src/main/js/apps/about/routes.js +++ b/server/sonar-web/src/main/js/apps/about/routes.js @@ -17,8 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import AboutApp from './components/AboutApp'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/AboutApp').default })); + } + } +]; -export default <IndexRoute component={AboutApp} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Projects.js b/server/sonar-web/src/main/js/apps/account/notifications/Projects.js index ccc704ab397..41de2832fdb 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/Projects.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/Projects.js @@ -20,7 +20,7 @@ import React from 'react'; import Select from 'react-select'; import { connect } from 'react-redux'; -import differenceBy from 'lodash/differenceBy'; +import { differenceBy } from 'lodash'; import ProjectNotifications from './ProjectNotifications'; import Organization from '../../../components/shared/Organization'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js b/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js index 34baf4aa21f..26d0f515e48 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js +++ b/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js @@ -20,7 +20,7 @@ // @flow import React from 'react'; import Modal from 'react-modal'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import { connect } from 'react-redux'; import { withRouter } from 'react-router'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.js b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.js index 6464f3edeeb..b6130a538c7 100644 --- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.js +++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.js @@ -19,7 +19,7 @@ */ import React from 'react'; import moment from 'moment'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { Link } from 'react-router'; import Level from '../../../components/ui/Level'; import { projectType } from './propTypes'; diff --git a/server/sonar-web/src/main/js/apps/account/routes.js b/server/sonar-web/src/main/js/apps/account/routes.js index daeea0fbb33..0fc03242eaa 100644 --- a/server/sonar-web/src/main/js/apps/account/routes.js +++ b/server/sonar-web/src/main/js/apps/account/routes.js @@ -17,34 +17,56 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { Route, IndexRoute } from 'react-router'; -import Account from './components/Account'; -import ProjectsContainer from './projects/ProjectsContainer'; -import Security from './components/Security'; -import Profile from './profile/Profile'; -import Notifications from './notifications/Notifications'; -import UserOrganizations from './organizations/UserOrganizations'; -import CreateOrganizationForm from './organizations/CreateOrganizationForm'; +const routes = [ + { + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./components/Account').default)); + }, + childRoutes: [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./profile/Profile').default })); + } + }, + { + path: 'security', + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./components/Security').default)); + } + }, + { + path: 'projects', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./projects/ProjectsContainer').default)); + } + }, + { + path: 'notifications', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./notifications/Notifications').default)); + } + }, + { + path: 'organizations', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./organizations/UserOrganizations').default)); + }, + childRoutes: [ + { + path: 'create', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./organizations/CreateOrganizationForm').default)); + } + } + ] + } + ] + } +]; -export default ( - <Route component={Account}> - <IndexRoute component={Profile} /> - <Route path="security" component={Security} /> - <Route path="projects" component={ProjectsContainer} /> - <Route path="notifications" component={Notifications} /> - <Route path="organizations" component={UserOrganizations}> - <Route path="create" component={CreateOrganizationForm} /> - </Route> - - <Route - path="issues" - onEnter={() => { - window.location = window.baseUrl + - '/issues' + - window.location.hash + - '|assigned_to_me=true'; - }} - /> - </Route> -); +export default routes; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js index ed7d23a657d..a0994d4bef8 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js @@ -20,8 +20,7 @@ // @flow import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; -import debounce from 'lodash/debounce'; -import uniq from 'lodash/uniq'; +import { debounce, uniq } from 'lodash'; import { connect } from 'react-redux'; import { DEFAULT_FILTERS, DEBOUNCE_DELAY, STATUSES, CURRENTS } from './../constants'; import Header from './Header'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/routes.js b/server/sonar-web/src/main/js/apps/background-tasks/routes.js index 895734d05ef..b67c86a2771 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/routes.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/routes.js @@ -17,8 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import BackgroundTasksApp from './components/BackgroundTasksApp'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/BackgroundTasksApp').default })); + } + } +]; -export default <IndexRoute component={BackgroundTasksApp} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.js b/server/sonar-web/src/main/js/apps/code/components/Search.js index 93315434b45..0c2d95a7209 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.js +++ b/server/sonar-web/src/main/js/apps/code/components/Search.js @@ -20,7 +20,7 @@ import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; import classNames from 'classnames'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import Components from './Components'; import { getTree } from '../../../api/components'; import { translate, translateWithParameters } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/code/routes.js b/server/sonar-web/src/main/js/apps/code/routes.js index 07bb9e8a918..c2e9fd242f4 100644 --- a/server/sonar-web/src/main/js/apps/code/routes.js +++ b/server/sonar-web/src/main/js/apps/code/routes.js @@ -17,8 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import App from './components/App'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/App').default })); + } + } +]; -export default <IndexRoute component={App} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/code/utils.js b/server/sonar-web/src/main/js/apps/code/utils.js index c5451d4a89e..44d539a2122 100644 --- a/server/sonar-web/src/main/js/apps/code/utils.js +++ b/server/sonar-web/src/main/js/apps/code/utils.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import without from 'lodash/without'; +import { without } from 'lodash'; import { addComponent, getComponent as getComponentFromBucket, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js index 0bda9b9fada..11eaa506d3a 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-severity-facet.hbs'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js index f2568f2109c..1fd1c67ead6 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-quality-profile-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js index 379c9b8fbdc..2e6a00b28d2 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js @@ -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 'lodash/object'; import CustomValuesFacet from './custom-values-facet'; export default CustomValuesFacet.extend({ diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js index cc0afc62ce3..f3b21711f7f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-severity-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js index 49645fe82bb..9468aff68e7 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/type-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/type-facet.js index 7e940f0ff7b..8dfbaf61eaf 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/type-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/type-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/coding-rules-type-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/init.js b/server/sonar-web/src/main/js/apps/coding-rules/init.js index bd3eeebda96..f25d2ad0c10 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/init.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/init.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import State from './models/state'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/routes.js b/server/sonar-web/src/main/js/apps/coding-rules/routes.js index 651cc6aeaec..a1bba34c6b6 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/routes.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/routes.js @@ -17,8 +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 React from 'react'; -import { IndexRoute } from 'react-router'; -import CodingRulesAppContainer from './components/CodingRulesAppContainer'; +const routes = [ + { + indexRoute: { + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./components/CodingRulesAppContainer').default); + }); + } + } + } +]; -export default <IndexRoute component={CodingRulesAppContainer} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js index c83af70b66b..2fa5eb3f2f4 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import union from 'lodash/union'; +import { union } from 'lodash'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import Rules from './models/rules'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js index 98e7529af5c..e3cb43a256f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import union from 'lodash/union'; +import { union } from 'lodash'; import ActionOptionsView from '../../components/common/action-options-view'; import Template from './templates/coding-rules-rule-filter-form.hbs'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js index b7fdf7d3c33..ba8ed5311ba 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js @@ -18,8 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import difference from 'lodash/difference'; -import union from 'lodash/union'; +import { difference, union } from 'lodash'; import Marionette from 'backbone.marionette'; import RuleFilterMixin from './rule-filter-mixin'; import Template from '../templates/rule/coding-rules-rule-meta.hbs'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js index 7265d718b25..eab8d1be804 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import ProfileActivationView from './profile-activation-view'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js index 80568ff7d9e..77c0b59d6a5 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import union from 'lodash/union'; +import { union } from 'lodash'; import Backbone from 'backbone'; import WorkspaceListItemView from '../../components/navigator/workspace-list-item-view'; import ProfileActivationView from './rule/profile-activation-view'; diff --git a/server/sonar-web/src/main/js/apps/component-issues/init.js b/server/sonar-web/src/main/js/apps/component-issues/init.js index 65721263cc7..038c2cdd78d 100644 --- a/server/sonar-web/src/main/js/apps/component-issues/init.js +++ b/server/sonar-web/src/main/js/apps/component-issues/init.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import difference from 'lodash/difference'; +import { difference } from 'lodash'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import State from '../issues/models/state'; diff --git a/server/sonar-web/src/main/js/apps/component-issues/routes.js b/server/sonar-web/src/main/js/apps/component-issues/routes.js index 0b64f94952f..954ba1487bb 100644 --- a/server/sonar-web/src/main/js/apps/component-issues/routes.js +++ b/server/sonar-web/src/main/js/apps/component-issues/routes.js @@ -17,8 +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 React from 'react'; -import { IndexRoute } from 'react-router'; -import ComponentIssuesAppContainer from './components/ComponentIssuesAppContainer'; +const routes = [ + { + indexRoute: { + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/ComponentIssuesAppContainer').default)); + } + } + } +]; -export default <IndexRoute component={ComponentIssuesAppContainer} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/component-measures/app/App.js b/server/sonar-web/src/main/js/apps/component-measures/app/App.js index 29aa89ae573..b8e50e87846 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/app/App.js +++ b/server/sonar-web/src/main/js/apps/component-measures/app/App.js @@ -19,6 +19,7 @@ */ import React from 'react'; import Spinner from './../components/Spinner'; +import '../styles.css'; export default class App extends React.Component { state = { componentSet: false }; diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js b/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js index 833043b8c9e..75f439d3ecc 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/history/MeasureHistory.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import moment from 'moment'; import React from 'react'; import Spinner from './../../components/Spinner'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js b/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js index 74f0cc9975d..5287d9f05a6 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; +import { scaleLinear, scaleOrdinal } from 'd3-scale'; import Spinner from './../../components/Spinner'; import { getLeakValue } from '../../utils'; import { Treemap } from '../../../../components/charts/treemap'; @@ -100,7 +101,7 @@ export default class MeasureTreemap extends React.Component { return `<div class="text-left">${inner}</div>`; } getPercentColorScale(metric) { - const color = d3.scale.linear().domain([0, 25, 50, 75, 100]); + const color = scaleLinear().domain([0, 25, 50, 75, 100]); color.range( metric.direction === 1 ? ['#d4333f', '#ed7d20', '#eabe06', '#b0d513', '#00aa00'] @@ -109,14 +110,12 @@ export default class MeasureTreemap extends React.Component { return color; } getRatingColorScale() { - return d3.scale - .linear() + return scaleLinear() .domain([1, 2, 3, 4, 5]) .range(['#00aa00', '#b0d513', '#eabe06', '#ed7d20', '#d4333f']); } getLevelColorScale() { - return d3.scale - .ordinal() + return scaleOrdinal() .domain(['ERROR', 'WARN', 'OK', 'NONE']) .range(['#d4333f', '#ed7d20', '#00aa00', '#b4b4b4']); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js index 187f34739be..d7dbd648955 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js @@ -18,8 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import partition from 'lodash/partition'; -import sortBy from 'lodash/sortBy'; +import { partition, sortBy } from 'lodash'; import MeasuresList from './MeasuresList'; import { domains } from '../config/domains'; import { getLocalizedMetricName } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js b/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js index f404b7addd1..f529a7ac851 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/reducer.js @@ -17,10 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import groupBy from 'lodash/groupBy'; -import partition from 'lodash/partition'; -import sortBy from 'lodash/sortBy'; -import toPairs from 'lodash/toPairs'; +import { groupBy, partition, sortBy, toPairs } from 'lodash'; import { RECEIVE_MEASURES } from './actions'; import { getLocalizedMetricName } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/routes.js b/server/sonar-web/src/main/js/apps/component-measures/routes.js index 1fe9d219852..bbf67ad283b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/routes.js +++ b/server/sonar-web/src/main/js/apps/component-measures/routes.js @@ -17,33 +17,82 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { Route, IndexRoute, IndexRedirect } from 'react-router'; -import AppContainer from './app/AppContainer'; -import HomeContainer from './home/HomeContainer'; -import AllMeasuresContainer from './home/AllMeasuresContainer'; -import DomainMeasuresContainer from './home/DomainMeasuresContainer'; -import MeasureDetailsContainer from './details/MeasureDetailsContainer'; -import ListViewContainer from './details/drilldown/ListViewContainer'; -import TreeViewContainer from './details/drilldown/TreeViewContainer'; -import MeasureHistoryContainer from './details/history/MeasureHistoryContainer'; -import MeasureTreemapContainer from './details/treemap/MeasureTreemapContainer'; -import { checkHistoryExistence } from './hooks'; -import './styles.css'; +const routes = [ + { + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./app/AppContainer').default)); + }, + childRoutes: [ + { + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./home/HomeContainer').default)); + }, + childRoutes: [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./home/AllMeasuresContainer').default })); + } + }, + { + path: 'domain/:domainName', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./home/DomainMeasuresContainer').default)); + } + } + ] + }, + { + path: 'metric/:metricKey', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./details/MeasureDetailsContainer').default)); + }, + childRoutes: [ + { + indexRoute: { + onEnter(nextState, replace) { + const { params, location } = nextState; + replace({ + pathname: `/component_measures/metric/${params.metricKey}/list`, + query: location.query + }); + } + } + }, + { + path: 'list', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./details/drilldown/ListViewContainer').default)); + } + }, + { + path: 'tree', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./details/drilldown/TreeViewContainer').default)); + } + }, + { + path: 'history', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./details/history/MeasureHistoryContainer').default)); + } + }, + { + path: 'treemap', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./details/treemap/MeasureTreemapContainer').default)); + } + } + ] + } + ] + } +]; -export default ( - <Route component={AppContainer}> - <Route component={HomeContainer}> - <IndexRoute component={AllMeasuresContainer} /> - <Route path="domain/:domainName" component={DomainMeasuresContainer} /> - </Route> - - <Route path="metric/:metricKey" component={MeasureDetailsContainer}> - <IndexRedirect to="list" /> - <Route path="list" component={ListViewContainer} /> - <Route path="tree" component={TreeViewContainer} /> - <Route path="history" component={MeasureHistoryContainer} onEnter={checkHistoryExistence} /> - <Route path="treemap" component={MeasureTreemapContainer} /> - </Route> - </Route> -); +export default routes; diff --git a/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js b/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js index 2d58b671872..34fffe1b8cd 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js +++ b/server/sonar-web/src/main/js/apps/component-measures/store/treeViewActions.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import initial from 'lodash/initial'; +import { initial } from 'lodash'; import { getComponentTree } from '../../../api/components'; import { enhanceWithMeasure } from '../utils'; import { startFetching, stopFetching } from './statusActions'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/store/treeViewReducer.js b/server/sonar-web/src/main/js/apps/component-measures/store/treeViewReducer.js index 05c6edb9b7f..71050fdad57 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/store/treeViewReducer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/store/treeViewReducer.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import pick from 'lodash/pick'; +import { pick } from 'lodash'; import { DISPLAY_HOME } from './../app/actions'; import { UPDATE_STORE, INIT } from './treeViewActions'; diff --git a/server/sonar-web/src/main/js/apps/component/routes.js b/server/sonar-web/src/main/js/apps/component/routes.js index b8938d81faf..edb7d77a7f2 100644 --- a/server/sonar-web/src/main/js/apps/component/routes.js +++ b/server/sonar-web/src/main/js/apps/component/routes.js @@ -17,12 +17,14 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// @flow -import React from 'react'; -import { IndexRoute, Redirect } from 'react-router'; -import App from './components/App'; - -export default [ - <Redirect key="1" from="/component/index" to="/component" />, - <IndexRoute key="2" component={App} /> +const routes = [ + { + indexRoute: { + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./components/App').default)); + } + } + } ]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js b/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js index 1338212736a..b2db378831b 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js +++ b/server/sonar-web/src/main/js/apps/custom-measures/custom-measure.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import defaults from 'lodash/defaults'; -import pick from 'lodash/pick'; +import { defaults, pick } from 'lodash'; import Backbone from 'backbone'; export default Backbone.Model.extend({ diff --git a/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js b/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js index 512b11d279a..e35c981c784 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js +++ b/server/sonar-web/src/main/js/apps/custom-measures/custom-measures.js @@ -17,7 +17,7 @@ * 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/uniq'; +import { uniq } from 'lodash'; import Backbone from 'backbone'; import CustomMeasure from './custom-measure'; diff --git a/server/sonar-web/src/main/js/apps/custom-measures/routes.js b/server/sonar-web/src/main/js/apps/custom-measures/routes.js index cef57a1375d..bae2abe703a 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/routes.js +++ b/server/sonar-web/src/main/js/apps/custom-measures/routes.js @@ -17,8 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import CustomMeasuresAppContainer from './components/CustomMeasuresAppContainer'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/CustomMeasuresAppContainer').default })); + } + } +]; -export default <IndexRoute component={CustomMeasuresAppContainer} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/groups/group.js b/server/sonar-web/src/main/js/apps/groups/group.js index a6a0d587a19..4ca0a08d98e 100644 --- a/server/sonar-web/src/main/js/apps/groups/group.js +++ b/server/sonar-web/src/main/js/apps/groups/group.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import defaults from 'lodash/defaults'; -import pick from 'lodash/pick'; +import { defaults, pick } from 'lodash'; import Backbone from 'backbone'; export default Backbone.Model.extend({ diff --git a/server/sonar-web/src/main/js/apps/groups/routes.js b/server/sonar-web/src/main/js/apps/groups/routes.js index 682cb275dab..d161da9d9fe 100644 --- a/server/sonar-web/src/main/js/apps/groups/routes.js +++ b/server/sonar-web/src/main/js/apps/groups/routes.js @@ -17,9 +17,17 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import GroupsAppContainer from './components/GroupsAppContainer'; -import forSingleOrganization from '../organizations/forSingleOrganization'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => { + const GroupsAppContainer = require('./components/GroupsAppContainer').default; + const forSingleOrganization = require('../organizations/forSingleOrganization').default; + const component = forSingleOrganization(GroupsAppContainer); + callback(null, { component }); + }); + } + } +]; -export default <IndexRoute component={forSingleOrganization(GroupsAppContainer)} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/groups/search-view.js b/server/sonar-web/src/main/js/apps/groups/search-view.js index 6c25de952a0..9acd7109e57 100644 --- a/server/sonar-web/src/main/js/apps/groups/search-view.js +++ b/server/sonar-web/src/main/js/apps/groups/search-view.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import Marionette from 'backbone.marionette'; import Template from './templates/groups-search.hbs'; diff --git a/server/sonar-web/src/main/js/apps/issues/BulkChangeForm.js b/server/sonar-web/src/main/js/apps/issues/BulkChangeForm.js index 40e9eae8ac5..92e51cb2d7c 100644 --- a/server/sonar-web/src/main/js/apps/issues/BulkChangeForm.js +++ b/server/sonar-web/src/main/js/apps/issues/BulkChangeForm.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // @flow -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import ModalForm from '../../components/common/modal-form'; import Template from './templates/BulkChangeForm.hbs'; import getCurrentUserFromStore from '../../app/utils/getCurrentUserFromStore'; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js index 471d7c75192..0df30cbced8 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import CustomValuesFacet from './custom-values-facet'; import Template from '../templates/facets/issues-assignee-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js index 41110a8a6cd..81c31973b79 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js @@ -19,7 +19,7 @@ */ import $ from 'jquery'; import moment from 'moment'; -import times from 'lodash/times'; +import { times } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/issues-creation-date-facet.hbs'; import '../../../components/widgets/barchart'; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js index c0289fe5956..d4e01b1c0f4 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/issues-resolution-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js index 6e2a83deb6b..db5cd337838 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/severity-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/issues-severity-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js index 4259ecb1930..cb4e88a5f49 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/status-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/issues-status-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js index 6cc723ade7b..efac17ea9f4 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import BaseFacet from './base-facet'; import Template from '../templates/facets/issues-type-facet.hbs'; diff --git a/server/sonar-web/src/main/js/apps/issues/routes.js b/server/sonar-web/src/main/js/apps/issues/routes.js index 94f564e8728..5f3a27c905c 100644 --- a/server/sonar-web/src/main/js/apps/issues/routes.js +++ b/server/sonar-web/src/main/js/apps/issues/routes.js @@ -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 React from 'react'; -import { IndexRoute, Route } from 'react-router'; -import IssuesAppContainer from './components/IssuesAppContainer'; - -const onSearchEnter = (nextState, replace) => { - replace('/issues' + window.location.hash); -}; - -export default [ - <IndexRoute key="index" component={IssuesAppContainer} />, - <Route key="search" path="search" onEnter={onSearchEnter} /> +const routes = [ + { + indexRoute: { + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/IssuesAppContainer').default)); + } + } + } ]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/metrics/metric.js b/server/sonar-web/src/main/js/apps/metrics/metric.js index 12e186ce6f1..f407122a3ac 100644 --- a/server/sonar-web/src/main/js/apps/metrics/metric.js +++ b/server/sonar-web/src/main/js/apps/metrics/metric.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import defaults from 'lodash/defaults'; -import pick from 'lodash/pick'; +import { defaults, pick } from 'lodash'; import Backbone from 'backbone'; export default Backbone.Model.extend({ diff --git a/server/sonar-web/src/main/js/apps/metrics/routes.js b/server/sonar-web/src/main/js/apps/metrics/routes.js index fe9790a43b1..a7b1354ecf4 100644 --- a/server/sonar-web/src/main/js/apps/metrics/routes.js +++ b/server/sonar-web/src/main/js/apps/metrics/routes.js @@ -17,8 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import MetricsAppContainer from './components/MetricsAppContainer'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/MetricsAppContainer').default })); + } + } +]; -export default <IndexRoute component={MetricsAppContainer} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js index 63edc23329d..a7052a459ed 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.js @@ -20,7 +20,7 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import { translate } from '../../../helpers/l10n'; import type { Organization } from '../../../store/organizations/duck'; import { getOrganizationByKey } from '../../../store/rootReducer'; diff --git a/server/sonar-web/src/main/js/apps/organizations/routes.js b/server/sonar-web/src/main/js/apps/organizations/routes.js index 6621e19c153..0fdd1061526 100644 --- a/server/sonar-web/src/main/js/apps/organizations/routes.js +++ b/server/sonar-web/src/main/js/apps/organizations/routes.js @@ -17,8 +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 React from 'react'; -import { Route, IndexRedirect } from 'react-router'; import OrganizationPage from './components/OrganizationPage'; import OrganizationProjects from './components/OrganizationProjects'; import OrganizationFavoriteProjects from './components/OrganizationFavoriteProjects'; @@ -30,18 +28,40 @@ import OrganizationPermissionTemplates from './components/OrganizationPermission import OrganizationProjectsManagement from './components/OrganizationProjectsManagement'; import OrganizationDelete from './components/OrganizationDelete'; -export default ( - <Route path=":organizationKey" component={OrganizationPage}> - <IndexRedirect to="projects" /> - <Route path="projects" component={OrganizationProjects} /> - <Route path="projects/favorite" component={OrganizationFavoriteProjects} /> - <Route component={OrganizationAdmin}> - <Route path="delete" component={OrganizationDelete} /> - <Route path="edit" component={OrganizationEdit} /> - <Route path="groups" component={OrganizationGroups} /> - <Route path="permissions" component={OrganizationPermissions} /> - <Route path="permission_templates" component={OrganizationPermissionTemplates} /> - <Route path="projects_management" component={OrganizationProjectsManagement} /> - </Route> - </Route> -); +const routes = [ + { + path: ':organizationKey', + component: OrganizationPage, + childRoutes: [ + { + indexRoute: { + onEnter(nextState, replace) { + const { params } = nextState; + replace(`/organizations/${params.organizationKey}/projects`); + } + } + }, + { + path: 'projects', + component: OrganizationProjects + }, + { + path: 'projects/favorite', + component: OrganizationFavoriteProjects + }, + { + component: OrganizationAdmin, + childRoutes: [ + { path: 'delete', component: OrganizationDelete }, + { path: 'edit', component: OrganizationEdit }, + { path: 'groups', component: OrganizationGroups }, + { path: 'permissions', component: OrganizationPermissions }, + { path: 'permission_templates', component: OrganizationPermissionTemplates }, + { path: 'projects_management', component: OrganizationProjectsManagement } + ] + } + ] + } +]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/overview/components/Timeline.js b/server/sonar-web/src/main/js/apps/overview/components/Timeline.js index 0c42ba8daff..f2fd61c218a 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/Timeline.js +++ b/server/sonar-web/src/main/js/apps/overview/components/Timeline.js @@ -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 d3 from 'd3'; import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; +import { max } from 'd3-array'; import { LineChart } from '../../../components/charts/line-chart'; const HEIGHT = 80; @@ -56,7 +56,7 @@ export default class Timeline extends React.Component { return { x: index, y: snapshot.value }; }); - const domain = [0, d3.max(this.props.history, d => d.value)]; + const domain = [0, max(this.props.history, d => d.value)]; return ( <LineChart diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js index 6c036de57de..5e7b533671f 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateConditions.js @@ -19,7 +19,7 @@ */ import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import QualityGateCondition from './QualityGateCondition'; import { ComponentType, ConditionsListType } from '../propTypes'; import { getMeasuresAndMeta } from '../../../api/measures'; diff --git a/server/sonar-web/src/main/js/apps/overview/routes.js b/server/sonar-web/src/main/js/apps/overview/routes.js index a8f9dc5e335..755ec975fd6 100644 --- a/server/sonar-web/src/main/js/apps/overview/routes.js +++ b/server/sonar-web/src/main/js/apps/overview/routes.js @@ -17,11 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute, Redirect } from 'react-router'; -import AppContainer from './components/AppContainer'; - -export default [ - <Redirect key="redirect" from="/dashboard/index" to="/dashboard" />, - <IndexRoute key="index" component={AppContainer} /> +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/AppContainer').default })); + } + } ]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js index 1741a96ca90..f43f135ab7f 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.js @@ -19,7 +19,7 @@ */ import React from 'react'; import { Link } from 'react-router'; -import difference from 'lodash/difference'; +import { difference } from 'lodash'; import Backbone from 'backbone'; import { PermissionTemplateType, CallbackType } from '../propTypes'; import QualifierIcon from '../../../components/shared/qualifier-icon'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.js b/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.js index 2d13657c8a4..a3b3b0675bf 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { translate } from '../../../helpers/l10n'; import { PermissionTemplateType } from '../propTypes'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Template.js b/server/sonar-web/src/main/js/apps/permission-templates/components/Template.js index 974ef4834f4..c4a0a7d5fdc 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Template.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Template.js @@ -19,7 +19,7 @@ */ import React from 'react'; import Helmet from 'react-helmet'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import TemplateHeader from './TemplateHeader'; import TemplateDetails from './TemplateDetails'; import HoldersList from '../../permissions/shared/components/HoldersList'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/routes.js b/server/sonar-web/src/main/js/apps/permission-templates/routes.js index 497a7817a42..d44e8735ad3 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/routes.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/routes.js @@ -17,9 +17,17 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import AppContainer from './components/AppContainer'; -import forSingleOrganization from '../organizations/forSingleOrganization'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => { + const AppContainer = require('./components/AppContainer').default; + const forSingleOrganization = require('../organizations/forSingleOrganization').default; + const component = forSingleOrganization(AppContainer); + callback(null, { component }); + }); + } + } +]; -export default <IndexRoute component={forSingleOrganization(AppContainer)} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/utils.js b/server/sonar-web/src/main/js/apps/permission-templates/utils.js index 3b634820b5b..ec3be9d776c 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/utils.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/utils.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; export const PERMISSIONS_ORDER = ['user', 'codeviewer', 'issueadmin', 'admin', 'scan']; diff --git a/server/sonar-web/src/main/js/apps/permissions/routes.js b/server/sonar-web/src/main/js/apps/permissions/routes.js index 388fffb75b6..00de5223f65 100644 --- a/server/sonar-web/src/main/js/apps/permissions/routes.js +++ b/server/sonar-web/src/main/js/apps/permissions/routes.js @@ -17,14 +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 React from 'react'; -import { IndexRoute } from 'react-router'; -import GlobalPermissionsApp from './global/components/App'; -import ProjectPermissionsApp from './project/components/App'; -import forSingleOrganization from '../organizations/forSingleOrganization'; +export const globalPermissionsRoutes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => { + const GlobalPermissionsApp = require('./global/components/App').default; + const forSingleOrganization = require('../organizations/forSingleOrganization').default; + const component = forSingleOrganization(GlobalPermissionsApp); + callback(null, { component }); + }); + } + } +]; -export const globalPermissionsRoutes = ( - <IndexRoute component={forSingleOrganization(GlobalPermissionsApp)} /> -); - -export const projectPermissionsRoutes = <IndexRoute component={ProjectPermissionsApp} />; +export const projectPermissionsRoutes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./project/components/App').default })); + } + } +]; diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/store/groups/byName.js b/server/sonar-web/src/main/js/apps/permissions/shared/store/groups/byName.js index 9708a736397..4b7f9faedb5 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/store/groups/byName.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/store/groups/byName.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; +import { keyBy } from 'lodash'; import { RECEIVE_HOLDERS_SUCCESS, GRANT_PERMISSION_TO_GROUP, diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/store/users/byLogin.js b/server/sonar-web/src/main/js/apps/permissions/shared/store/users/byLogin.js index 006a5b932c1..aaebcdcad61 100644 --- a/server/sonar-web/src/main/js/apps/permissions/shared/store/users/byLogin.js +++ b/server/sonar-web/src/main/js/apps/permissions/shared/store/users/byLogin.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; +import { keyBy } from 'lodash'; import { RECEIVE_HOLDERS_SUCCESS, GRANT_PERMISSION_TO_USER, diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js index 7b6bbb3550e..a23d6307d7d 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdateResults.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import some from 'lodash/some'; +import { some } from 'lodash'; import { translateWithParameters, translate } from '../../../helpers/l10n'; export default class BulkUpdateResults extends React.Component { diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/utils.js b/server/sonar-web/src/main/js/apps/project-admin/links/utils.js index 7b6486df900..2b6373a63b4 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/utils.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/utils.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import partition from 'lodash/partition'; -import sortBy from 'lodash/sortBy'; +import { partition, sortBy } from 'lodash'; const PROVIDED_TYPES = ['homepage', 'ci', 'issue', 'scm', 'scm_dev']; diff --git a/server/sonar-web/src/main/js/apps/project-admin/quality-gate/Form.js b/server/sonar-web/src/main/js/apps/project-admin/quality-gate/Form.js index a02fead0ffd..154115c58e0 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/quality-gate/Form.js +++ b/server/sonar-web/src/main/js/apps/project-admin/quality-gate/Form.js @@ -20,7 +20,7 @@ import React from 'react'; import Select from 'react-select'; import shallowCompare from 'react-addons-shallow-compare'; -import some from 'lodash/some'; +import { some } from 'lodash'; import { translate } from '../../../helpers/l10n'; export default class Form extends React.Component { diff --git a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js index 4b3d6bdc3aa..10251c140c2 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js +++ b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js @@ -19,8 +19,7 @@ */ import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; -import groupBy from 'lodash/groupBy'; -import orderBy from 'lodash/orderBy'; +import { groupBy, orderBy } from 'lodash'; import ProfileRow from './ProfileRow'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/components.js b/server/sonar-web/src/main/js/apps/project-admin/store/components.js index 59f53b674b0..9745dd347e4 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/components.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/components.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; -import omit from 'lodash/omit'; +import { keyBy, omit } from 'lodash'; import { RECEIVE_PROJECT_MODULES, CHANGE_KEY } from './actions'; const components = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/gates.js b/server/sonar-web/src/main/js/apps/project-admin/store/gates.js index 319b8ac3f36..d68aae11508 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/gates.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/gates.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; -import values from 'lodash/values'; +import { keyBy, values } from 'lodash'; import { RECEIVE_GATES } from './actions'; const gates = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/links.js b/server/sonar-web/src/main/js/apps/project-admin/store/links.js index 1f5bc45b153..214c3d94f09 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/links.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/links.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; -import omit from 'lodash/omit'; +import { keyBy, omit } from 'lodash'; import { RECEIVE_PROJECT_LINKS, DELETE_PROJECT_LINK, ADD_PROJECT_LINK } from './actions'; const links = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/linksByProject.js b/server/sonar-web/src/main/js/apps/project-admin/store/linksByProject.js index 54413eeb56e..8ed793ca1f1 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/linksByProject.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/linksByProject.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import without from 'lodash/without'; +import { without } from 'lodash'; import { RECEIVE_PROJECT_LINKS, DELETE_PROJECT_LINK, ADD_PROJECT_LINK } from './actions'; const linksByProject = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/profiles.js b/server/sonar-web/src/main/js/apps/project-admin/store/profiles.js index 01302f946c7..ed6a8345d0e 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/profiles.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/profiles.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; -import values from 'lodash/values'; +import { keyBy, values } from 'lodash'; import { RECEIVE_PROFILES } from './actions'; const profiles = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/profilesByProject.js b/server/sonar-web/src/main/js/apps/project-admin/store/profilesByProject.js index 3eed6b11561..afc7ea0143b 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/profilesByProject.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/profilesByProject.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import without from 'lodash/without'; +import { without } from 'lodash'; import { RECEIVE_PROJECT_PROFILES, SET_PROJECT_PROFILE } from './actions'; const profilesByProject = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js index 18a48fbfc23..87afe5b5e5a 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.js @@ -19,7 +19,7 @@ */ // @flow import React from 'react'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import Event from './Event'; import type { Event as EventType } from '../../../store/projectActivity/duck'; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js index 60989c83a47..7acb76cd43b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js @@ -20,21 +20,19 @@ // @flow import React from 'react'; import { connect } from 'react-redux'; -import groupBy from 'lodash/groupBy'; +import { groupBy } from 'lodash'; import moment from 'moment'; import ProjectActivityAnalysis from './ProjectActivityAnalysis'; import FormattedDate from '../../../components/ui/FormattedDate'; import { getProjectActivity } from '../../../store/rootReducer'; import { getAnalyses } from '../../../store/projectActivity/duck'; import { translate } from '../../../helpers/l10n'; +import type { Analysis } from '../../../store/projectActivity/duck'; class ProjectActivityAnalysesList extends React.Component { props: { project: string, - analyses?: Array<{ - key: string, - date: string - }>, + analyses?: Array<Analysis>, canAdmin: boolean }; @@ -59,22 +57,22 @@ class ProjectActivityAnalysesList extends React.Component { <li key={day} className="project-activity-day" - data-day={moment(Number(day)).format('YYYY-MM-DD')} - > + data-day={moment(Number(day)).format('YYYY-MM-DD')}> <div className="project-activity-date"> <FormattedDate date={Number(day)} format="LL" /> </div> <ul className="project-activity-analyses-list"> - {byDay[day].map(analysis => ( - <ProjectActivityAnalysis - key={analysis.key} - analysis={analysis} - isFirst={analysis === firstAnalysis} - project={this.props.project} - canAdmin={this.props.canAdmin} - /> - ))} + {byDay[day] != null && + byDay[day].map(analysis => ( + <ProjectActivityAnalysis + key={analysis.key} + analysis={analysis} + isFirst={analysis === firstAnalysis} + project={this.props.project} + canAdmin={this.props.canAdmin} + /> + ))} </ul> </li> ))} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/routes.js b/server/sonar-web/src/main/js/apps/projectActivity/routes.js index 5c2042e8395..3b2ed907d49 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/routes.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/routes.js @@ -17,9 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// @flow -import React from 'react'; -import { IndexRoute } from 'react-router'; -import ProjectActivityApp from './components/ProjectActivityApp'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/ProjectActivityApp').default })); + } + } +]; -export default <IndexRoute component={ProjectActivityApp} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/projects-admin/main.js b/server/sonar-web/src/main/js/apps/projects-admin/main.js index ad8a243ba60..29278721294 100644 --- a/server/sonar-web/src/main/js/apps/projects-admin/main.js +++ b/server/sonar-web/src/main/js/apps/projects-admin/main.js @@ -18,9 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import debounce from 'lodash/debounce'; -import uniq from 'lodash/uniq'; -import without from 'lodash/without'; +import { debounce, uniq, without } from 'lodash'; import Header from './header'; import Search from './search'; import Projects from './projects'; diff --git a/server/sonar-web/src/main/js/apps/projects-admin/routes.js b/server/sonar-web/src/main/js/apps/projects-admin/routes.js index 476312d444e..6ca2206f863 100644 --- a/server/sonar-web/src/main/js/apps/projects-admin/routes.js +++ b/server/sonar-web/src/main/js/apps/projects-admin/routes.js @@ -17,9 +17,17 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import AppContainer from './AppContainer'; -import forSingleOrganization from '../organizations/forSingleOrganization'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => { + const AppContainer = require('./AppContainer').default; + const forSingleOrganization = require('../organizations/forSingleOrganization').default; + const component = forSingleOrganization(AppContainer); + callback(null, { component }); + }); + } + } +]; -export default <IndexRoute component={forSingleOrganization(AppContainer)} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/projects-admin/search.js b/server/sonar-web/src/main/js/apps/projects-admin/search.js index efd640663db..b4c658ce0d8 100644 --- a/server/sonar-web/src/main/js/apps/projects-admin/search.js +++ b/server/sonar-web/src/main/js/apps/projects-admin/search.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { TYPE, QUALIFIERS_ORDER } from './constants'; import DeleteView from './delete-view'; import RadioToggle from '../../components/controls/RadioToggle'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js index 96b4b5a4943..8c0a54dca6c 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.js @@ -25,6 +25,7 @@ import PageSidebar from './PageSidebar'; import VisualizationsContainer from '../visualizations/VisualizationsContainer'; import { parseUrlQuery } from '../store/utils'; import { getProjectUrl } from '../../../helpers/urls'; +import '../styles.css'; export default class AllProjects extends React.Component { static propTypes = { diff --git a/server/sonar-web/src/main/js/apps/projects/components/App.js b/server/sonar-web/src/main/js/apps/projects/components/App.js index bd9e6468d10..c5c3b94bda1 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/App.js +++ b/server/sonar-web/src/main/js/apps/projects/components/App.js @@ -20,7 +20,6 @@ import React from 'react'; import Helmet from 'react-helmet'; import { translate } from '../../../helpers/l10n'; -import '../styles.css'; export default class App extends React.Component { componentDidMount() { diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js index 3b789e8bd24..172d228f0d8 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { connect } from 'react-redux'; import Tooltip from '../../../components/controls/Tooltip'; import { getLanguages } from '../../../store/rootReducer'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectTagsSelectorContainer.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectTagsSelectorContainer.js index 537bc3d4a8e..19f2fa34533 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectTagsSelectorContainer.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectTagsSelectorContainer.js @@ -20,8 +20,7 @@ //@flow import React from 'react'; import { connect } from 'react-redux'; -import debounce from 'lodash/debounce'; -import without from 'lodash/without'; +import { debounce, without } from 'lodash'; import TagsSelector from '../../../components/tags/TagsSelector'; import { searchProjectTags } from '../../../api/components'; import { setProjectTags } from '../store/actions'; diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js index 9a7b75988da..9787900bf19 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js @@ -19,8 +19,7 @@ */ //@flow import React from 'react'; -import difference from 'lodash/difference'; -import sortBy from 'lodash/sortBy'; +import { difference, sortBy } from 'lodash'; import Filter from './Filter'; import FilterHeader from './FilterHeader'; import SearchableFilterFooter from './SearchableFilterFooter'; diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js index 72b89f46ca8..b70d403a499 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/SearchFilterContainer.js @@ -20,7 +20,7 @@ //@flow import React from 'react'; import { withRouter } from 'react-router'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import { getFilterUrl } from './utils'; import SearchFilter from './SearchFilter'; diff --git a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js index 7344d20ee2d..59d464d6e4d 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js @@ -19,9 +19,7 @@ */ //@flow import React from 'react'; -import debounce from 'lodash/debounce'; -import difference from 'lodash/difference'; -import sortBy from 'lodash/sortBy'; +import { debounce, difference, sortBy } from 'lodash'; import Filter from './Filter'; import FilterHeader from './FilterHeader'; import SearchableFilterFooter from './SearchableFilterFooter'; diff --git a/server/sonar-web/src/main/js/apps/projects/filters/utils.js b/server/sonar-web/src/main/js/apps/projects/filters/utils.js index 4cbd4ed410c..5be12186542 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/utils.js +++ b/server/sonar-web/src/main/js/apps/projects/filters/utils.js @@ -17,9 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import each from 'lodash/each'; -import omitBy from 'lodash/omitBy'; -import isNil from 'lodash/isNil'; +import { each, isNil, omitBy } from 'lodash'; export const getFilterUrl = (ownProps, part) => { const basePathName = ownProps.organization diff --git a/server/sonar-web/src/main/js/apps/projects/routes.js b/server/sonar-web/src/main/js/apps/projects/routes.js index 371a29f49a9..8eccdcd0ccc 100644 --- a/server/sonar-web/src/main/js/apps/projects/routes.js +++ b/server/sonar-web/src/main/js/apps/projects/routes.js @@ -17,23 +17,36 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { Route, IndexRoute } from 'react-router'; -import App from './components/App'; -import DefaultPageSelector from './components/DefaultPageSelector'; -import FavoriteProjectsContainer from './components/FavoriteProjectsContainer'; import { saveAll } from './utils'; -export default ( - <Route component={App}> - <IndexRoute component={DefaultPageSelector} /> - <Route - path="all" - onEnter={(_, replace) => { - saveAll(); - replace('/projects'); - }} - /> - <Route path="favorite" component={FavoriteProjectsContainer} /> - </Route> -); +const routes = [ + { + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./components/App').default)); + }, + childRoutes: [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/DefaultPageSelector').default })); + } + }, + { + path: 'all', + onEnter(_, replace) { + saveAll(); + replace('/projects'); + } + }, + { + path: 'favorite', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/FavoriteProjectsContainer').default)); + } + } + ] + } +]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/projects/store/actions.js b/server/sonar-web/src/main/js/apps/projects/store/actions.js index ec113c07fab..b57ce5dda28 100644 --- a/server/sonar-web/src/main/js/apps/projects/store/actions.js +++ b/server/sonar-web/src/main/js/apps/projects/store/actions.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import groupBy from 'lodash/groupBy'; -import uniq from 'lodash/uniq'; +import { groupBy, uniq } from 'lodash'; import { searchProjects, setProjectTags as apiSetProjectTags } from '../../../api/components'; import { addGlobalErrorMessage } from '../../../store/globalMessages/duck'; import { parseError } from '../../code/utils'; @@ -206,11 +205,8 @@ export const setProjectTags = (project, tags) => (dispatch, getState) => { const previousTags = getComponent(getState(), project).tags; dispatch(receiveProjectTags(project, tags)); - return apiSetProjectTags({ project, tags: tags.join(',') }).then( - null, - error => { - dispatch(receiveProjectTags(project, previousTags)); - onFail(dispatch)(error); - } - ); + return apiSetProjectTags({ project, tags: tags.join(',') }).then(null, error => { + dispatch(receiveProjectTags(project, previousTags)); + onFail(dispatch)(error); + }); }; diff --git a/server/sonar-web/src/main/js/apps/projects/store/facetsDuck.js b/server/sonar-web/src/main/js/apps/projects/store/facetsDuck.js index cd15ca36fdb..953fcaf4101 100644 --- a/server/sonar-web/src/main/js/apps/projects/store/facetsDuck.js +++ b/server/sonar-web/src/main/js/apps/projects/store/facetsDuck.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import flatMap from 'lodash/flatMap'; -import sumBy from 'lodash/sumBy'; +import { flatMap, sumBy } from 'lodash'; import { createMap } from '../../../store/utils/generalReducers'; import { actions } from './projectsDuck'; import { mapMetricToProperty } from './utils'; diff --git a/server/sonar-web/src/main/js/apps/projects/styles.css b/server/sonar-web/src/main/js/apps/projects/styles.css index 81b7af2c1cd..87101df7544 100644 --- a/server/sonar-web/src/main/js/apps/projects/styles.css +++ b/server/sonar-web/src/main/js/apps/projects/styles.css @@ -202,4 +202,32 @@ color: #777; font-size: 12px; text-align: center; +} + +.measure-details-bubble-chart-axis { + position: absolute; + color: #777; + font-size: 12px; +} + +.measure-details-bubble-chart-axis.x { + left: 50%; + bottom: 10px; + width: 500px; + margin-left: -250px; + text-align: center; +} + +.measure-details-bubble-chart-axis.y { + top: 50%; + left: -20px; + transform: rotate(-90deg); +} + +.measure-details-bubble-chart-axis.size { + left: 50%; + top: 10px; + width: 500px; + margin-left: -250px; + text-align: center; }
\ No newline at end of file diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js index d21b39d2fc3..eaf8d1ac436 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionForm.js @@ -19,7 +19,7 @@ */ import React from 'react'; import Select from 'react-select'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { translate, getLocalizedMetricName, getLocalizedMetricDomain } from '../../../helpers/l10n'; export default function AddConditionForm({ metrics, onSelect }) { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js index 48cf7b78752..54830da056a 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js @@ -18,8 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import sortBy from 'lodash/sortBy'; -import uniqBy from 'lodash/uniqBy'; +import { sortBy, uniqBy } from 'lodash'; import ConditionsAlert from './ConditionsAlert'; import AddConditionForm from './AddConditionForm'; import Condition from './Condition'; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/routes.js b/server/sonar-web/src/main/js/apps/quality-gates/routes.js index 7c6b54381b2..7db41853db8 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/routes.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/routes.js @@ -17,17 +17,28 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { Route, IndexRoute, Redirect } from 'react-router'; -import QualityGatesAppContainer from './containers/QualityGatesAppContainer'; -import Intro from './components/Intro'; -import DetailsContainer from './containers/DetailsContainer'; +const routes = [ + { + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./containers/QualityGatesAppContainer').default)); + }, + childRoutes: [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/Intro').default })); + } + }, + { + path: 'show/:id', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./containers/DetailsContainer').default)); + } + } + ] + } +]; -export default ( - <Route component={QualityGatesAppContainer}> - <Redirect from="/quality_gates/index" to="/quality_gates/" /> - - <IndexRoute component={Intro} /> - <Route path="show/:id" component={DetailsContainer} /> - </Route> -); +export default routes; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js index 79bad9a8e38..cf530249158 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.js @@ -19,7 +19,7 @@ */ import React from 'react'; import { Link } from 'react-router'; -import keyBy from 'lodash/keyBy'; +import { keyBy } from 'lodash'; import ProfileRulesRow from './ProfileRulesRow'; import { ProfileType } from '../propTypes'; import { searchRules, takeFacet } from '../../../api/rules'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.js index a198b3197ad..d5f04ac306a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.js @@ -19,7 +19,7 @@ */ import React from 'react'; import { Link } from 'react-router'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import ProfileLink from '../components/ProfileLink'; import { getDeprecatedActiveRulesUrl } from '../../../helpers/urls'; import { ProfilesListType } from '../propTypes'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.js index fee0049a0a2..224be2a3b28 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.js @@ -20,7 +20,7 @@ import React from 'react'; import { Link } from 'react-router'; import moment from 'moment'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { searchRules } from '../../../api/rules'; import { translateWithParameters, translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js index 47a80df6252..34d0317107f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js @@ -18,9 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import groupBy from 'lodash/groupBy'; -import pick from 'lodash/pick'; -import sortBy from 'lodash/sortBy'; +import { groupBy, pick, sortBy } from 'lodash'; import ProfilesListRow from './ProfilesListRow'; import ProfilesListHeader from './ProfilesListHeader'; import { ProfilesListType, LanguagesListType } from '../propTypes'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/routes.js b/server/sonar-web/src/main/js/apps/quality-profiles/routes.js index 85c42a87438..ac8f4c22894 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/routes.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/routes.js @@ -17,25 +17,54 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { Route, IndexRoute, Redirect } from 'react-router'; -import AppContainer from './components/AppContainer'; -import ProfileContainer from './components/ProfileContainer'; -import HomeContainer from './home/HomeContainer'; -import ProfileDetails from './details/ProfileDetails'; -import ChangelogContainer from './changelog/ChangelogContainer'; -import ComparisonContainer from './compare/ComparisonContainer'; +const routes = [ + { + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./components/AppContainer').default); + }); + }, + getIndexRoute(_, callback) { + require.ensure([], require => { + callback(null, { component: require('./home/HomeContainer').default }); + }); + }, + childRoutes: [ + { + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./components/ProfileContainer').default); + }); + }, + childRoutes: [ + { + path: 'show', + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./details/ProfileDetails').default); + }); + } + }, + { + path: 'changelog', + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./changelog/ChangelogContainer').default); + }); + } + }, + { + path: 'compare', + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./compare/ComparisonContainer').default); + }); + } + } + ] + } + ] + } +]; -export default ( - <Route component={AppContainer}> - <Redirect from="/profiles/index" to="/profiles" /> - - <IndexRoute component={HomeContainer} /> - - <Route component={ProfileContainer}> - <Route path="show" component={ProfileDetails} /> - <Route path="changelog" component={ChangelogContainer} /> - <Route path="compare" component={ComparisonContainer} /> - </Route> - </Route> -); +export default routes; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/utils.js b/server/sonar-web/src/main/js/apps/quality-profiles/utils.js index 0ebe30db86f..d5ea476bab8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/utils.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/utils.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // @flow -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import moment from 'moment'; type Profiles = Array<{ diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js index d6c89287b91..873dc94d63d 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js @@ -20,7 +20,7 @@ // @flow import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { IndexLink } from 'react-router'; import { getCategoryName } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js index f6db05ef5fe..eb7b7fb045d 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js @@ -20,8 +20,7 @@ // @flow import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; -import groupBy from 'lodash/groupBy'; -import sortBy from 'lodash/sortBy'; +import { groupBy, sortBy } from 'lodash'; import DefinitionsList from './DefinitionsList'; import EmailForm from './EmailForm'; import { getSubCategoryName, getSubCategoryDescription } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/settings/routes.js b/server/sonar-web/src/main/js/apps/settings/routes.js index d7c693a3365..68300e6d2c8 100644 --- a/server/sonar-web/src/main/js/apps/settings/routes.js +++ b/server/sonar-web/src/main/js/apps/settings/routes.js @@ -17,17 +17,38 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute, Route, Redirect } from 'react-router'; -import AppContainer from './components/AppContainer'; -import LicensesApp from './licenses/LicensesApp'; -import EncryptionAppContainer from './encryption/EncryptionAppContainer'; -import ServerIdAppContainer from './serverId/ServerIdAppContainer'; - -export default [ - <Redirect key="1" from="/settings/index" to="/settings" />, - <IndexRoute key="2" component={AppContainer} />, - <Route key="3" path="licenses" component={LicensesApp} />, - <Route key="4" path="encryption" component={EncryptionAppContainer} />, - <Route key="5" path="server_id" component={ServerIdAppContainer} /> +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => { + callback(null, { component: require('./components/AppContainer').default }); + }); + } + }, + { + path: 'licenses', + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./licenses/LicensesApp').default); + }); + } + }, + { + path: 'encryption', + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./encryption/EncryptionAppContainer').default); + }); + } + }, + { + path: 'server_id', + getComponent(_, callback) { + require.ensure([], require => { + callback(null, require('./serverId/ServerIdAppContainer').default); + }); + } + } ]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/settings/store/definitions/reducer.js b/server/sonar-web/src/main/js/apps/settings/store/definitions/reducer.js index 4e96d1018de..6d473517a27 100644 --- a/server/sonar-web/src/main/js/apps/settings/store/definitions/reducer.js +++ b/server/sonar-web/src/main/js/apps/settings/store/definitions/reducer.js @@ -18,9 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // @flow -import keyBy from 'lodash/keyBy'; -import sortBy from 'lodash/sortBy'; -import uniqBy from 'lodash/uniqBy'; +import { keyBy, sortBy, uniqBy } from 'lodash'; import { RECEIVE_DEFINITIONS } from './actions'; import { DEFAULT_CATEGORY, getCategoryName } from '../../utils'; import type { Definition } from '../../types'; diff --git a/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js b/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js index a8732d8f697..35f68211c16 100644 --- a/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js +++ b/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import keyBy from 'lodash/keyBy'; +import { keyBy } from 'lodash'; import { RECEIVE_LICENSES } from './actions'; const reducer = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/settings/store/settingsPage/changedValues/reducer.js b/server/sonar-web/src/main/js/apps/settings/store/settingsPage/changedValues/reducer.js index dcafa07b34f..a1899f4bd22 100644 --- a/server/sonar-web/src/main/js/apps/settings/store/settingsPage/changedValues/reducer.js +++ b/server/sonar-web/src/main/js/apps/settings/store/settingsPage/changedValues/reducer.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import omit from 'lodash/omit'; +import { omit } from 'lodash'; import { CHANGE_VALUE, CANCEL_CHANGE } from './actions'; const reducer = (state = {}, action = {}) => { diff --git a/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js b/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js index 1e75fe48727..c78b114484c 100644 --- a/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js +++ b/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // @flow -import keyBy from 'lodash/keyBy'; +import { keyBy } from 'lodash'; import { RECEIVE_VALUES } from './actions'; type State = { [key: string]: {} }; diff --git a/server/sonar-web/src/main/js/apps/system/main.js b/server/sonar-web/src/main/js/apps/system/main.js index 26d5bf24e0e..faafb6057d2 100644 --- a/server/sonar-web/src/main/js/apps/system/main.js +++ b/server/sonar-web/src/main/js/apps/system/main.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import sortBy from 'lodash/sortBy'; +import { sortBy } from 'lodash'; import { getSystemInfo } from '../../api/system'; import Section from './section'; import { translate } from '../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/system/routes.js b/server/sonar-web/src/main/js/apps/system/routes.js index d75c6810ef7..454ff5127fa 100644 --- a/server/sonar-web/src/main/js/apps/system/routes.js +++ b/server/sonar-web/src/main/js/apps/system/routes.js @@ -17,11 +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 React from 'react'; -import { IndexRoute, Redirect } from 'react-router'; -import Main from './main'; - -export default [ - <Redirect key="redirect" from="/system/index" to="/system" />, - <IndexRoute key="index" component={Main} /> +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => callback(null, { component: require('./main').default })); + } + } ]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/update-center/plugins.js b/server/sonar-web/src/main/js/apps/update-center/plugins.js index 2a23578bb81..9062db7da2f 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugins.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugins.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; -import findLastIndex from 'lodash/findLastIndex'; +import { findLastIndex } from 'lodash'; import Backbone from 'backbone'; import Plugin from './plugin'; diff --git a/server/sonar-web/src/main/js/apps/update-center/routes.js b/server/sonar-web/src/main/js/apps/update-center/routes.js index 12e493960a1..46327c282d3 100644 --- a/server/sonar-web/src/main/js/apps/update-center/routes.js +++ b/server/sonar-web/src/main/js/apps/update-center/routes.js @@ -17,14 +17,41 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute, Route } from 'react-router'; -import UpdateCenterAppContainer from './components/UpdateCenterAppContainer'; - -export default [ - <IndexRoute key="index" component={UpdateCenterAppContainer} />, - <Route key="installed" path="installed" component={UpdateCenterAppContainer} />, - <Route key="updates" path="updates" component={UpdateCenterAppContainer} />, - <Route key="available" path="available" component={UpdateCenterAppContainer} />, - <Route key="system" path="system" component={UpdateCenterAppContainer} /> +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/UpdateCenterAppContainer').default })); + } + }, + { + path: 'installed', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/UpdateCenterAppContainer').default)); + } + }, + { + path: 'updates', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/UpdateCenterAppContainer').default)); + } + }, + { + path: 'available', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/UpdateCenterAppContainer').default)); + } + }, + { + path: 'system', + getComponent(_, callback) { + require.ensure([], require => + callback(null, require('./components/UpdateCenterAppContainer').default)); + } + } ]; + +export default routes; diff --git a/server/sonar-web/src/main/js/apps/update-center/search-view.js b/server/sonar-web/src/main/js/apps/update-center/search-view.js index b8bff2a3573..eb899c7f58c 100644 --- a/server/sonar-web/src/main/js/apps/update-center/search-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/search-view.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import Marionette from 'backbone.marionette'; import Template from './templates/update-center-search.hbs'; diff --git a/server/sonar-web/src/main/js/apps/users/routes.js b/server/sonar-web/src/main/js/apps/users/routes.js index 8efebd13ba7..0a52028e543 100644 --- a/server/sonar-web/src/main/js/apps/users/routes.js +++ b/server/sonar-web/src/main/js/apps/users/routes.js @@ -17,8 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute } from 'react-router'; -import UsersAppContainer from './components/UsersAppContainer'; +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/UsersAppContainer').default })); + } + } +]; -export default <IndexRoute component={UsersAppContainer} />; +export default routes; diff --git a/server/sonar-web/src/main/js/apps/users/search-view.js b/server/sonar-web/src/main/js/apps/users/search-view.js index 7f7424381eb..a0f52d20cac 100644 --- a/server/sonar-web/src/main/js/apps/users/search-view.js +++ b/server/sonar-web/src/main/js/apps/users/search-view.js @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import Marionette from 'backbone.marionette'; import Template from './templates/users-search.hbs'; diff --git a/server/sonar-web/src/main/js/apps/users/user.js b/server/sonar-web/src/main/js/apps/users/user.js index f37524edb6a..a819925daa8 100644 --- a/server/sonar-web/src/main/js/apps/users/user.js +++ b/server/sonar-web/src/main/js/apps/users/user.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import defaults from 'lodash/defaults'; -import pick from 'lodash/pick'; +import { defaults, pick } from 'lodash'; import Backbone from 'backbone'; export default Backbone.Model.extend({ diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Search.js b/server/sonar-web/src/main/js/apps/web-api/components/Search.js index 6e90c0a6920..342a8dfbd6b 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Search.js +++ b/server/sonar-web/src/main/js/apps/web-api/components/Search.js @@ -19,7 +19,7 @@ */ // @flow import React from 'react'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import Checkbox from '../../../components/controls/Checkbox'; import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/web-api/routes.js b/server/sonar-web/src/main/js/apps/web-api/routes.js index fd647f2e21a..040d8dad6ab 100644 --- a/server/sonar-web/src/main/js/apps/web-api/routes.js +++ b/server/sonar-web/src/main/js/apps/web-api/routes.js @@ -17,11 +17,19 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import React from 'react'; -import { IndexRoute, Route } from 'react-router'; -import WebApiApp from './components/WebApiApp'; - -export default [ - <IndexRoute key="index" component={WebApiApp} />, - <Route key="splat" path="**" component={WebApiApp} /> +const routes = [ + { + getIndexRoute(_, callback) { + require.ensure([], require => + callback(null, { component: require('./components/WebApiApp').default })); + } + }, + { + path: '**', + getComponent(_, callback) { + require.ensure([], require => callback(null, require('./components/WebApiApp').default)); + } + } ]; + +export default routes; |