diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/project-admin/store/actions.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/project-admin/store/actions.js | 108 |
1 files changed, 0 insertions, 108 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 6701e8f07db..28f7473e260 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 @@ -17,116 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { - searchQualityProfiles, - associateProject, - dissociateProject -} from '../../../api/quality-profiles'; -import { - fetchQualityGates, - getGateForProject, - associateGateWithProject, - dissociateGateWithProject -} from '../../../api/quality-gates'; import { getProjectLinks, createLink } from '../../../api/projectLinks'; import { getTree, changeKey as changeKeyApi } from '../../../api/components'; -import { addGlobalSuccessMessage } from '../../../store/globalMessages/duck'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { getProjectAdminProfileByKey } from '../../../store/rootReducer'; - -export const RECEIVE_PROFILES = 'projectAdmin/RECEIVE_PROFILES'; -export const receiveProfiles = profiles => ({ - type: RECEIVE_PROFILES, - profiles -}); - -export const RECEIVE_PROJECT_PROFILES = 'projectAdmin/RECEIVE_PROJECT_PROFILES'; -export const receiveProjectProfiles = (projectKey, profiles) => ({ - type: RECEIVE_PROJECT_PROFILES, - projectKey, - profiles -}); - -export const fetchProjectProfiles = (projectKey, organization) => dispatch => { - Promise.all([ - organization ? searchQualityProfiles({ organization }) : searchQualityProfiles(), - organization - ? searchQualityProfiles({ organization, projectKey }) - : searchQualityProfiles({ 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) => ({ - type: SET_PROJECT_PROFILE, - projectKey, - oldProfileKey, - 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 RECEIVE_GATES = 'projectAdmin/RECEIVE_GATES'; -export const receiveGates = gates => ({ - type: RECEIVE_GATES, - gates -}); - -export const RECEIVE_PROJECT_GATE = 'projectAdmin/RECEIVE_PROJECT_GATE'; -export const receiveProjectGate = (projectKey, gate) => ({ - type: RECEIVE_PROJECT_GATE, - projectKey, - 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 SET_PROJECT_GATE = 'projectAdmin/SET_PROJECT_GATE'; -const setProjectGateAction = (projectKey, gateId) => ({ - type: SET_PROJECT_GATE, - projectKey, - gateId -}); - -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'))); - }); -}; export const RECEIVE_PROJECT_LINKS = 'projectAdmin/RECEIVE_PROJECT_LINKS'; export const receiveProjectLinks = (projectKey, links) => ({ |