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/quality-gates | |
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/quality-gates')
3 files changed, 26 insertions, 16 deletions
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; |