import 'widgets/form_controls/formControls.scss';
import imgAdd from '../../node_modules/open-iconic/svg/plus.svg'
import imgRemove from '../../node_modules/open-iconic/svg/trash.svg'
-
+import _ from 'lodash';
import ROLES from 'utils/roleConstants.js';
const PROJECT_ROLES = ROLES.PROJECT;
const PLATFORM = ROLES.PLATFORM;
let self = this;
e.preventDefault();
e.stopPropagation();
- let projectName = self.state['name'];
- let projectUsers = self.state.projectUsers;
+ let projectName = self.state['name'];
+ let projectUsers = _.cloneDeep(self.state.projectUsers);
let cleanUsers = this.cleanUsers(projectUsers, projectName);
- this.Store.updateProject(_.merge({
+ this.Store.updateProject({
'name': projectName,
'description': self.state.description,
'project-config' : {
'user': cleanUsers
}
- }));
+ });
}
cleanUsers(projectUsers, projectName) {
let cleanUsers = [];
if (!projectUsers[userIndex].role) {
projectUsers[userIndex].role = [];
}
- if (!projectUsers[userIndex]['rw-project-mano:mano-role']) {
- projectUsers[userIndex]['rw-project-mano:mano-role'] = [];
- }
- switch (ROLES.PROJECT.TYPE[self.roles[roleIndex]]) {
- case 'rw-project' :
- projectUsers[userIndex].role.push({
- role: selectedRole
- });
- break;
- case 'rw-project-mano' :
- projectUsers[userIndex]["rw-project-mano:mano-role"].push({
- role: selectedRole
- });
- break;
- }
projectUsers[userIndex].role.push({
- role: selectedRole
+ role: self.roles[roleIndex]
})
} else {
let role = projectUsers[userIndex].role;