diff options
author | Grégoire Aubert <gregaubert@users.noreply.github.com> | 2017-03-22 13:40:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 13:40:13 +0100 |
commit | 685a373cc4a9028fbdd09ec2765074e8ef72e408 (patch) | |
tree | 4081f070b8e704f80626740cd1650a5eb97efea0 /server/sonar-web/src/main/js/store | |
parent | 926e6e3a8a76efd342b51c511426af6e4a15b765 (diff) | |
download | sonarqube-685a373cc4a9028fbdd09ec2765074e8ef72e408.tar.gz sonarqube-685a373cc4a9028fbdd09ec2765074e8ef72e408.zip |
SONAR-8844 Add tags editor on the project homepage (#1821)
Diffstat (limited to 'server/sonar-web/src/main/js/store')
-rw-r--r-- | server/sonar-web/src/main/js/store/components/actions.js | 7 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/store/components/reducer.js | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/store/components/actions.js b/server/sonar-web/src/main/js/store/components/actions.js index e59b2a8fa07..873640f7092 100644 --- a/server/sonar-web/src/main/js/store/components/actions.js +++ b/server/sonar-web/src/main/js/store/components/actions.js @@ -18,8 +18,15 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ export const RECEIVE_COMPONENTS = 'RECEIVE_COMPONENTS'; +export const RECEIVE_PROJECT_TAGS = 'RECEIVE_PROJECT_TAGS'; export const receiveComponents = components => ({ type: RECEIVE_COMPONENTS, components }); + +export const receiveProjectTags = (project, tags) => ({ + type: RECEIVE_PROJECT_TAGS, + project, + tags +}); 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 473c288feb2..0f90ce90862 100644 --- a/server/sonar-web/src/main/js/store/components/reducer.js +++ b/server/sonar-web/src/main/js/store/components/reducer.js @@ -20,7 +20,7 @@ import { combineReducers } from 'redux'; import keyBy from 'lodash/keyBy'; import uniq from 'lodash/uniq'; -import { RECEIVE_COMPONENTS } from './actions'; +import { RECEIVE_COMPONENTS, RECEIVE_PROJECT_TAGS } from './actions'; const byKey = (state = {}, action = {}) => { if (action.type === RECEIVE_COMPONENTS) { @@ -28,6 +28,13 @@ const byKey = (state = {}, action = {}) => { return { ...state, ...changes }; } + if (action.type === RECEIVE_PROJECT_TAGS) { + const project = state[action.project]; + if (project) { + return { ...state, [action.project]: { ...project, tags: action.tags } }; + } + } + return state; }; |