aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/store
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-04-20 11:10:13 +0200
committerGitHub <noreply@github.com>2017-04-20 11:10:13 +0200
commitf6e90fdc19e222b3b238f0f5995a8039b7db158e (patch)
tree69c22415cb50a650b046ce4b9a9ac99e57695dfd /server/sonar-web/src/main/js/store
parent36c9fa041018d7eed91f1d22e0c5eda075737ebc (diff)
downloadsonarqube-f6e90fdc19e222b3b238f0f5995a8039b7db158e.tar.gz
sonarqube-f6e90fdc19e222b3b238f0f5995a8039b7db158e.zip
upgrade prettier (#1954)
Diffstat (limited to 'server/sonar-web/src/main/js/store')
-rw-r--r--server/sonar-web/src/main/js/store/globalMessages/duck.js11
-rw-r--r--server/sonar-web/src/main/js/store/organizationsMembers/reducer.js2
-rw-r--r--server/sonar-web/src/main/js/store/rootActions.js85
-rw-r--r--server/sonar-web/src/main/js/store/users/actions.js4
-rw-r--r--server/sonar-web/src/main/js/store/utils/generalReducers.js41
5 files changed, 69 insertions, 74 deletions
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 ff028db274d..b8a1c1fd3cc 100644
--- a/server/sonar-web/src/main/js/store/globalMessages/duck.js
+++ b/server/sonar-web/src/main/js/store/globalMessages/duck.js
@@ -57,12 +57,11 @@ export const closeAllGlobalMessages = (id: string) => ({
id
});
-const addGlobalMessage = (message: string, level: Level) =>
- (dispatch: Function) => {
- const id = uniqueId('global-message-');
- dispatch(addGlobalMessageActionCreator(id, message, level));
- setTimeout(() => dispatch(closeGlobalMessage(id)), 5000);
- };
+const addGlobalMessage = (message: string, level: Level) => (dispatch: Function) => {
+ const id = uniqueId('global-message-');
+ dispatch(addGlobalMessageActionCreator(id, message, level));
+ setTimeout(() => dispatch(closeGlobalMessage(id)), 5000);
+};
export const addGlobalErrorMessage = (message: string) => addGlobalMessage(message, ERROR);
diff --git a/server/sonar-web/src/main/js/store/organizationsMembers/reducer.js b/server/sonar-web/src/main/js/store/organizationsMembers/reducer.js
index d5906cf3965..d1ceb15087d 100644
--- a/server/sonar-web/src/main/js/store/organizationsMembers/reducer.js
+++ b/server/sonar-web/src/main/js/store/organizationsMembers/reducer.js
@@ -28,7 +28,7 @@ export const getOrganizationMembersLogins = (state, organization) => {
};
export const getOrganizationMembersState = (state, organization) =>
- organization && state[organization] ? state[organization] : {};
+ (organization && state[organization] ? state[organization] : {});
const organizationMembers = (state = {}, action = {}) => {
const members = state.members || [];
diff --git a/server/sonar-web/src/main/js/store/rootActions.js b/server/sonar-web/src/main/js/store/rootActions.js
index 58685e5cb27..ec276c40f29 100644
--- a/server/sonar-web/src/main/js/store/rootActions.js
+++ b/server/sonar-web/src/main/js/store/rootActions.js
@@ -29,59 +29,54 @@ import { parseError } from '../apps/code/utils';
import { setAppState } from './appState/duck';
import { receiveOrganizations } from './organizations/duck';
-export const onFail = dispatch =>
- error => parseError(error).then(message => dispatch(addGlobalErrorMessage(message)));
+export const onFail = dispatch => error =>
+ parseError(error).then(message => dispatch(addGlobalErrorMessage(message)));
-export const fetchAppState = () =>
- dispatch =>
- getGlobalNavigation().then(appState => dispatch(setAppState(appState)), onFail(dispatch));
+export const fetchAppState = () => dispatch =>
+ getGlobalNavigation().then(appState => dispatch(setAppState(appState)), onFail(dispatch));
-export const fetchLanguages = () =>
- dispatch => {
- return getLanguages().then(
- languages => dispatch(receiveLanguages(languages)),
- onFail(dispatch)
- );
- };
+export const fetchLanguages = () => dispatch => {
+ return getLanguages().then(languages => dispatch(receiveLanguages(languages)), onFail(dispatch));
+};
-export const fetchOrganizations = (organizations?: Array<string>) =>
- dispatch =>
- getOrganizations(organizations).then(
- r => dispatch(receiveOrganizations(r.organizations)),
- onFail(dispatch)
- );
+export const fetchOrganizations = (organizations?: Array<string>) => dispatch =>
+ getOrganizations(organizations).then(
+ r => dispatch(receiveOrganizations(r.organizations)),
+ onFail(dispatch)
+ );
const addQualifier = project => ({
...project,
qualifier: project.breadcrumbs[project.breadcrumbs.length - 1].qualifier
});
-export const fetchProject = key =>
- dispatch =>
- Promise.all([getComponentNavigation(key), getComponentTags(key)]).then(([component, tags]) => {
- component.tags = tags;
- dispatch(receiveComponents([addQualifier(component)]));
- if (component.organization != null) {
- dispatch(fetchOrganizations([component.organization]));
- }
- });
+export const fetchProject = key => dispatch =>
+ Promise.all([getComponentNavigation(key), getComponentTags(key)]).then(([component, tags]) => {
+ component.tags = tags;
+ dispatch(receiveComponents([addQualifier(component)]));
+ if (component.organization != null) {
+ dispatch(fetchOrganizations([component.organization]));
+ }
+ });
-export const doLogin = (login, password) => dispatch => auth.login(login, password).then(
- () => {
- /* everything is fine */
- },
- () => {
- dispatch(addGlobalErrorMessage('Authentication failed'));
- return Promise.reject();
- }
- );
+export const doLogin = (login, password) => dispatch =>
+ auth.login(login, password).then(
+ () => {
+ /* everything is fine */
+ },
+ () => {
+ dispatch(addGlobalErrorMessage('Authentication failed'));
+ return Promise.reject();
+ }
+ );
-export const doLogout = () => dispatch => auth.logout().then(
- () => {
- /* everything is fine */
- },
- () => {
- dispatch(addGlobalErrorMessage('Logout failed'));
- return Promise.reject();
- }
- );
+export const doLogout = () => dispatch =>
+ auth.logout().then(
+ () => {
+ /* everything is fine */
+ },
+ () => {
+ dispatch(addGlobalErrorMessage('Logout failed'));
+ return Promise.reject();
+ }
+ );
diff --git a/server/sonar-web/src/main/js/store/users/actions.js b/server/sonar-web/src/main/js/store/users/actions.js
index a0331d053f1..0183deee9b0 100644
--- a/server/sonar-web/src/main/js/store/users/actions.js
+++ b/server/sonar-web/src/main/js/store/users/actions.js
@@ -32,5 +32,5 @@ export const receiveUser = user => ({
user
});
-export const fetchCurrentUser = () =>
- dispatch => getCurrentUser().then(user => dispatch(receiveCurrentUser(user)));
+export const fetchCurrentUser = () => dispatch =>
+ getCurrentUser().then(user => dispatch(receiveCurrentUser(user)));
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 a95b2bfa5bb..ab56c98b9e8 100644
--- a/server/sonar-web/src/main/js/store/utils/generalReducers.js
+++ b/server/sonar-web/src/main/js/store/utils/generalReducers.js
@@ -35,16 +35,15 @@ export const createValue = (
shouldReset = () => false,
getValue = (state, action) => action.payload,
defaultValue = null
-) =>
- (state = defaultValue, action = {}) => {
- if (shouldReset(state, action)) {
- return defaultValue;
- }
- if (shouldUpdate(state, action)) {
- return getValue(state, action);
- }
- return state;
- };
+) => (state = defaultValue, action = {}) => {
+ if (shouldReset(state, action)) {
+ return defaultValue;
+ }
+ if (shouldUpdate(state, action)) {
+ return getValue(state, action);
+ }
+ return state;
+};
/**
* Creates a reducer that manages a map.
@@ -94,13 +93,15 @@ export const createSet = (
* @param {bool} defaultValue
* @returns {function(state, action)}
*/
-export const createFlag = (shouldTurnOn, shouldTurnOff, defaultValue = false) =>
- (state = defaultValue, action = {}) => {
- if (shouldTurnOn(state, action)) {
- return true;
- }
- if (shouldTurnOff(state, action)) {
- return false;
- }
- return state;
- };
+export const createFlag = (shouldTurnOn, shouldTurnOff, defaultValue = false) => (
+ state = defaultValue,
+ action = {}
+) => {
+ if (shouldTurnOn(state, action)) {
+ return true;
+ }
+ if (shouldTurnOff(state, action)) {
+ return false;
+ }
+ return state;
+};