aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/store
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-03-27 12:04:48 +0200
committerGitHub <noreply@github.com>2017-03-27 12:04:48 +0200
commit7d963d84f40ee3db3b51c557fb596aa9febf82bb (patch)
tree7f761f198fae4ad898f4dd98703923921520098b /server/sonar-web/src/main/js/store
parent48699b502c866ea5a309c57f8ad5e737d1933280 (diff)
downloadsonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.tar.gz
sonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.zip
optimize js bundles (#1855)
Diffstat (limited to 'server/sonar-web/src/main/js/store')
-rw-r--r--server/sonar-web/src/main/js/store/components/reducer.js3
-rw-r--r--server/sonar-web/src/main/js/store/favorites/duck.js3
-rw-r--r--server/sonar-web/src/main/js/store/globalMessages/duck.js2
-rw-r--r--server/sonar-web/src/main/js/store/issues/duck.js2
-rw-r--r--server/sonar-web/src/main/js/store/languages/reducer.js2
-rw-r--r--server/sonar-web/src/main/js/store/notifications/duck.js22
-rw-r--r--server/sonar-web/src/main/js/store/organizations/duck.js4
-rw-r--r--server/sonar-web/src/main/js/store/projectActivity/analyses.js2
-rw-r--r--server/sonar-web/src/main/js/store/projectActivity/events.js2
-rw-r--r--server/sonar-web/src/main/js/store/users/reducer.js2
-rw-r--r--server/sonar-web/src/main/js/store/utils/generalReducers.js2
11 files changed, 21 insertions, 25 deletions
diff --git a/server/sonar-web/src/main/js/store/components/reducer.js b/server/sonar-web/src/main/js/store/components/reducer.js
index 0f90ce90862..e8a96a36685 100644
--- a/server/sonar-web/src/main/js/store/components/reducer.js
+++ b/server/sonar-web/src/main/js/store/components/reducer.js
@@ -18,8 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { combineReducers } from 'redux';
-import keyBy from 'lodash/keyBy';
-import uniq from 'lodash/uniq';
+import { keyBy, uniq } from 'lodash';
import { RECEIVE_COMPONENTS, RECEIVE_PROJECT_TAGS } from './actions';
const byKey = (state = {}, action = {}) => {
diff --git a/server/sonar-web/src/main/js/store/favorites/duck.js b/server/sonar-web/src/main/js/store/favorites/duck.js
index 27d3864c86f..73abccaeef1 100644
--- a/server/sonar-web/src/main/js/store/favorites/duck.js
+++ b/server/sonar-web/src/main/js/store/favorites/duck.js
@@ -18,8 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// @flow
-import uniq from 'lodash/uniq';
-import without from 'lodash/without';
+import { uniq, without } from 'lodash';
type Favorite = { key: string };
diff --git a/server/sonar-web/src/main/js/store/globalMessages/duck.js b/server/sonar-web/src/main/js/store/globalMessages/duck.js
index f0cc29ba053..367c8a61e36 100644
--- a/server/sonar-web/src/main/js/store/globalMessages/duck.js
+++ b/server/sonar-web/src/main/js/store/globalMessages/duck.js
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// @flow
-import uniqueId from 'lodash/uniqueId';
+import { uniqueId } from 'lodash';
type Level = 'ERROR' | 'SUCCESS';
diff --git a/server/sonar-web/src/main/js/store/issues/duck.js b/server/sonar-web/src/main/js/store/issues/duck.js
index 7b5cb240404..b559d8103c7 100644
--- a/server/sonar-web/src/main/js/store/issues/duck.js
+++ b/server/sonar-web/src/main/js/store/issues/duck.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';
type Issue = { key: string };
diff --git a/server/sonar-web/src/main/js/store/languages/reducer.js b/server/sonar-web/src/main/js/store/languages/reducer.js
index 4e4dbfef3b8..52177241e61 100644
--- a/server/sonar-web/src/main/js/store/languages/reducer.js
+++ b/server/sonar-web/src/main/js/store/languages/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_LANGUAGES } from './actions';
const reducer = (state = {}, action = {}) => {
diff --git a/server/sonar-web/src/main/js/store/notifications/duck.js b/server/sonar-web/src/main/js/store/notifications/duck.js
index cd4f7a7ab05..1a3f554fbd5 100644
--- a/server/sonar-web/src/main/js/store/notifications/duck.js
+++ b/server/sonar-web/src/main/js/store/notifications/duck.js
@@ -19,8 +19,7 @@
*/
// @flow
import { combineReducers } from 'redux';
-import uniqBy from 'lodash/uniqBy';
-import uniqWith from 'lodash/uniqWith';
+import { uniqBy, uniqWith } from 'lodash';
export type Notification = {
channel: string,
@@ -145,15 +144,16 @@ export default combineReducers({ notifications, channels, globalTypes, perProjec
export const getGlobal = (state: State): NotificationsState =>
state.notifications.filter(n => !n.project);
-export const getProjects = (state: State): Array<string> =>
- uniqBy(
- state.notifications.filter(n => n.project).map(n => ({
- key: n.project,
- name: n.projectName,
- organization: n.organization
- })),
- project => project.key
- );
+export const getProjects = (state: State): Array<{ key: string, name: string }> => {
+ // $FlowFixMe
+ const allProjects = state.notifications.filter(n => n.project != null).map(n => ({
+ key: n.project,
+ name: n.projectName,
+ organization: n.organization
+ }));
+
+ return uniqBy(allProjects, project => project.key);
+};
export const getForProject = (state: State, project: string): NotificationsState =>
state.notifications.filter(n => n.project === project);
diff --git a/server/sonar-web/src/main/js/store/organizations/duck.js b/server/sonar-web/src/main/js/store/organizations/duck.js
index f04782a8541..40d815ce856 100644
--- a/server/sonar-web/src/main/js/store/organizations/duck.js
+++ b/server/sonar-web/src/main/js/store/organizations/duck.js
@@ -19,9 +19,7 @@
*/
// @flow
import { combineReducers } from 'redux';
-import omit from 'lodash/omit';
-import uniq from 'lodash/uniq';
-import without from 'lodash/without';
+import { omit, uniq, without } from 'lodash';
export type Organization = {
avatar?: string,
diff --git a/server/sonar-web/src/main/js/store/projectActivity/analyses.js b/server/sonar-web/src/main/js/store/projectActivity/analyses.js
index 90e02537484..1bed62ad651 100644
--- a/server/sonar-web/src/main/js/store/projectActivity/analyses.js
+++ b/server/sonar-web/src/main/js/store/projectActivity/analyses.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 type {
Action,
ReceiveProjectActivityAction,
diff --git a/server/sonar-web/src/main/js/store/projectActivity/events.js b/server/sonar-web/src/main/js/store/projectActivity/events.js
index 41446540e8d..d4024b2e068 100644
--- a/server/sonar-web/src/main/js/store/projectActivity/events.js
+++ b/server/sonar-web/src/main/js/store/projectActivity/events.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 type {
Action,
ReceiveProjectActivityAction,
diff --git a/server/sonar-web/src/main/js/store/users/reducer.js b/server/sonar-web/src/main/js/store/users/reducer.js
index 71b313077ed..f0ec0163898 100644
--- a/server/sonar-web/src/main/js/store/users/reducer.js
+++ b/server/sonar-web/src/main/js/store/users/reducer.js
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { combineReducers } from 'redux';
-import uniq from 'lodash/uniq';
+import { uniq } from 'lodash';
import { RECEIVE_CURRENT_USER } from './actions';
const usersByLogin = (state = {}, action = {}) => {
diff --git a/server/sonar-web/src/main/js/store/utils/generalReducers.js b/server/sonar-web/src/main/js/store/utils/generalReducers.js
index 21342cb4bde..a95b2bfa5bb 100644
--- a/server/sonar-web/src/main/js/store/utils/generalReducers.js
+++ b/server/sonar-web/src/main/js/store/utils/generalReducers.js
@@ -19,7 +19,7 @@
*/
// Author: Christoffer Niska <christofferniska@gmail.com>
// https://gist.github.com/crisu83/42ecffccad9d04c74605fbc75c9dc9d1
-import uniq from 'lodash/uniq';
+import { uniq } from 'lodash';
/**
* Creates a reducer that manages a single value.