diff options
author | Stas Vilchik <stas-vilchik@users.noreply.github.com> | 2017-04-20 11:10:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-20 11:10:13 +0200 |
commit | f6e90fdc19e222b3b238f0f5995a8039b7db158e (patch) | |
tree | 69c22415cb50a650b046ce4b9a9ac99e57695dfd /server/sonar-web/src/main/js/apps/project-admin/store | |
parent | 36c9fa041018d7eed91f1d22e0c5eda075737ebc (diff) | |
download | sonarqube-f6e90fdc19e222b3b238f0f5995a8039b7db158e.tar.gz sonarqube-f6e90fdc19e222b3b238f0f5995a8039b7db158e.zip |
upgrade prettier (#1954)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/project-admin/store')
-rw-r--r-- | server/sonar-web/src/main/js/apps/project-admin/store/actions.js | 138 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/project-admin/store/rootReducer.js | 3 |
2 files changed, 67 insertions, 74 deletions
diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/actions.js b/server/sonar-web/src/main/js/apps/project-admin/store/actions.js index d3f66e9af6c..8fa84ac1d97 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/actions.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/actions.js @@ -47,19 +47,18 @@ export const receiveProjectProfiles = (projectKey, profiles) => ({ profiles }); -export const fetchProjectProfiles = (projectKey, organization) => - dispatch => { - Promise.all([ - organization ? getQualityProfiles({ organization }) : getQualityProfiles(), - organization - ? getQualityProfiles({ organization, projectKey }) - : getQualityProfiles({ projectKey }) - ]).then(responses => { - const [allProfiles, projectProfiles] = responses; - dispatch(receiveProfiles(allProfiles)); - dispatch(receiveProjectProfiles(projectKey, projectProfiles)); - }); - }; +export const fetchProjectProfiles = (projectKey, organization) => dispatch => { + Promise.all([ + organization ? getQualityProfiles({ organization }) : getQualityProfiles(), + organization + ? getQualityProfiles({ organization, projectKey }) + : getQualityProfiles({ projectKey }) + ]).then(responses => { + const [allProfiles, projectProfiles] = responses; + dispatch(receiveProfiles(allProfiles)); + dispatch(receiveProjectProfiles(projectKey, projectProfiles)); + }); +}; export const SET_PROJECT_PROFILE = 'projectAdmin/SET_PROJECT_PROFILE'; const setProjectProfileAction = (projectKey, oldProfileKey, newProfileKey) => ({ @@ -69,26 +68,25 @@ const setProjectProfileAction = (projectKey, oldProfileKey, newProfileKey) => ({ newProfileKey }); -export const setProjectProfile = (projectKey, oldKey, newKey) => - (dispatch, getState) => { - const state = getState(); - const newProfile = getProjectAdminProfileByKey(state, newKey); - const request = newProfile.isDefault - ? dissociateProject(oldKey, projectKey) - : associateProject(newKey, projectKey); - - request.then(() => { - dispatch(setProjectProfileAction(projectKey, oldKey, newKey)); - dispatch( - addGlobalSuccessMessage( - translateWithParameters( - 'project_quality_profile.successfully_updated', - newProfile.languageName - ) +export const setProjectProfile = (projectKey, oldKey, newKey) => (dispatch, getState) => { + const state = getState(); + const newProfile = getProjectAdminProfileByKey(state, newKey); + const request = newProfile.isDefault + ? dissociateProject(oldKey, projectKey) + : associateProject(newKey, projectKey); + + request.then(() => { + dispatch(setProjectProfileAction(projectKey, oldKey, newKey)); + dispatch( + addGlobalSuccessMessage( + translateWithParameters( + 'project_quality_profile.successfully_updated', + newProfile.languageName ) - ); - }); - }; + ) + ); + }); +}; export const RECEIVE_GATES = 'projectAdmin/RECEIVE_GATES'; export const receiveGates = gates => ({ @@ -103,14 +101,13 @@ export const receiveProjectGate = (projectKey, gate) => ({ gate }); -export const fetchProjectGate = projectKey => - dispatch => { - Promise.all([fetchQualityGates(), getGateForProject(projectKey)]).then(responses => { - const [allGates, projectGate] = responses; - dispatch(receiveGates(allGates)); - dispatch(receiveProjectGate(projectKey, projectGate)); - }); - }; +export const fetchProjectGate = projectKey => dispatch => { + Promise.all([fetchQualityGates(), getGateForProject(projectKey)]).then(responses => { + const [allGates, projectGate] = responses; + dispatch(receiveGates(allGates)); + dispatch(receiveProjectGate(projectKey, projectGate)); + }); +}; export const SET_PROJECT_GATE = 'projectAdmin/SET_PROJECT_GATE'; const setProjectGateAction = (projectKey, gateId) => ({ @@ -119,17 +116,16 @@ const setProjectGateAction = (projectKey, gateId) => ({ gateId }); -export const setProjectGate = (projectKey, oldId, newId) => - dispatch => { - const request = newId != null - ? associateGateWithProject(newId, projectKey) - : dissociateGateWithProject(oldId, projectKey); +export const setProjectGate = (projectKey, oldId, newId) => dispatch => { + const request = newId != null + ? associateGateWithProject(newId, projectKey) + : dissociateGateWithProject(oldId, projectKey); - request.then(() => { - dispatch(setProjectGateAction(projectKey, newId)); - dispatch(addGlobalSuccessMessage(translate('project_quality_gate.successfully_updated'))); - }); - }; + request.then(() => { + dispatch(setProjectGateAction(projectKey, newId)); + dispatch(addGlobalSuccessMessage(translate('project_quality_gate.successfully_updated'))); + }); +}; export const RECEIVE_PROJECT_LINKS = 'projectAdmin/RECEIVE_PROJECT_LINKS'; export const receiveProjectLinks = (projectKey, links) => ({ @@ -138,12 +134,11 @@ export const receiveProjectLinks = (projectKey, links) => ({ links }); -export const fetchProjectLinks = projectKey => - dispatch => { - getProjectLinks(projectKey).then(links => { - dispatch(receiveProjectLinks(projectKey, links)); - }); - }; +export const fetchProjectLinks = projectKey => dispatch => { + getProjectLinks(projectKey).then(links => { + dispatch(receiveProjectLinks(projectKey, links)); + }); +}; export const ADD_PROJECT_LINK = 'projectAdmin/ADD_PROJECT_LINK'; const addProjectLink = (projectKey, link) => ({ @@ -152,12 +147,11 @@ const addProjectLink = (projectKey, link) => ({ link }); -export const createProjectLink = (projectKey, name, url) => - dispatch => { - return createLink(projectKey, name, url).then(link => { - dispatch(addProjectLink(projectKey, link)); - }); - }; +export const createProjectLink = (projectKey, name, url) => dispatch => { + return createLink(projectKey, name, url).then(link => { + dispatch(addProjectLink(projectKey, link)); + }); +}; export const DELETE_PROJECT_LINK = 'projectAdmin/DELETE_PROJECT_LINK'; export const deleteProjectLink = (projectKey, linkId) => ({ @@ -173,13 +167,12 @@ const receiveProjectModules = (projectKey, modules) => ({ modules }); -export const fetchProjectModules = projectKey => - dispatch => { - const options = { qualifiers: 'BRC', s: 'name', ps: 500 }; - getTree(projectKey, options).then(r => { - dispatch(receiveProjectModules(projectKey, r.components)); - }); - }; +export const fetchProjectModules = projectKey => dispatch => { + const options = { qualifiers: 'BRC', s: 'name', ps: 500 }; + getTree(projectKey, options).then(r => { + dispatch(receiveProjectModules(projectKey, r.components)); + }); +}; export const CHANGE_KEY = 'projectAdmin/CHANGE_KEY'; const changeKeyAction = (key, newKey) => ({ @@ -188,7 +181,6 @@ const changeKeyAction = (key, newKey) => ({ newKey }); -export const changeKey = (key, newKey) => - dispatch => { - return changeKeyApi(key, newKey).then(() => dispatch(changeKeyAction(key, newKey))); - }; +export const changeKey = (key, newKey) => dispatch => { + return changeKeyApi(key, newKey).then(() => dispatch(changeKeyAction(key, newKey))); +}; diff --git a/server/sonar-web/src/main/js/apps/project-admin/store/rootReducer.js b/server/sonar-web/src/main/js/apps/project-admin/store/rootReducer.js index fabf41003ec..4eb6dec8e0e 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/store/rootReducer.js +++ b/server/sonar-web/src/main/js/apps/project-admin/store/rootReducer.js @@ -50,7 +50,8 @@ export const getAllProfiles = state => nextGetAllProfiles(state.profiles); export const getProjectProfiles = (state, projectKey) => getProfiles(state.profilesByProject, projectKey).map(profileKey => - getProfileByKey(state, profileKey)); + getProfileByKey(state, profileKey) + ); export const getGateById = (state, gateId) => getGate(state.gates, gateId); |