X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=skyquake%2Fplugins%2Fproject_management%2Fsrc%2Fdashboard%2Fdashboard.jsx;h=f1fca657c4f9ac0bdc58a6ae949577438caf2369;hb=b584e4b139ec4a30a97ea42ff54c76753731d707;hp=cabad1e3d802d3b0e3865e14566f477373b1d72f;hpb=223b8d21b98a9ff27367ab77fe9507e603e744b2;p=osm%2FUI.git
diff --git a/skyquake/plugins/project_management/src/dashboard/dashboard.jsx b/skyquake/plugins/project_management/src/dashboard/dashboard.jsx
index cabad1e3d..f1fca657c 100644
--- a/skyquake/plugins/project_management/src/dashboard/dashboard.jsx
+++ b/skyquake/plugins/project_management/src/dashboard/dashboard.jsx
@@ -7,6 +7,7 @@ import ReactDOM from 'react-dom';
import AppHeader from 'widgets/header/header.jsx';
import ProjectManagementStore from './projectMgmtStore.js';
import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
+import SkyquakeRBAC from 'widgets/skyquake_rbac/skyquakeRBAC.jsx';
import 'style/layout.scss';
import './projectMgmt.scss';
import {Panel, PanelWrapper} from 'widgets/panel/panel';
@@ -20,6 +21,10 @@ 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 ROLES from 'utils/roleConstants.js';
+const PROJECT_ROLES = ROLES.PROJECT;
+const PLATFORM = ROLES.PLATFORM;
+
class ProjectManagementDashboard extends React.Component {
constructor(props) {
super(props);
@@ -94,25 +99,16 @@ class ProjectManagementDashboard extends React.Component {
let self = this;
e.preventDefault();
e.stopPropagation();
+ let projectName = self.state['name'];
let projectUsers = self.state.projectUsers;
- let cleanUsers = [];
- //Remove null values from role
- projectUsers.map((u) => {
- u.role && u.role.map((r,i) => {
- let role = {};
- //you may add a user without a role or a keys, but if one is present then the other must be as well.
- if(!r || ((r.role || r['keys']) && (!r.role || !r['keys']))) {
- // projectUsers.splice(i, 1);
- } else {
- cleanUsers.push(u);
- }
- })
- })
+ let cleanUsers = this.cleanUsers(projectUsers, projectName);
+
+
this.Store.createProject({
- 'name': self.state['name'],
+ 'name': projectName,
'description': self.state.description,
'project-config' : {
- 'user': projectUsers
+ 'user': cleanUsers
}
});
}
@@ -120,29 +116,38 @@ class ProjectManagementDashboard extends React.Component {
let self = this;
e.preventDefault();
e.stopPropagation();
+ let projectName = self.state['name'];
let projectUsers = self.state.projectUsers;
+ let cleanUsers = this.cleanUsers(projectUsers, projectName);
+
+
+ this.Store.updateProject(_.merge({
+ 'name': projectName,
+ 'description': self.state.description,
+ 'project-config' : {
+ 'user': cleanUsers
+ }
+ }));
+ }
+ cleanUsers(projectUsers, projectName) {
let cleanUsers = [];
//Remove null values from role
projectUsers.map((u) => {
+ let cleanRoles = [];
u.role && u.role.map((r,i) => {
let role = {};
//you may add a user without a role or a keys, but if one is present then the other must be as well.
- // if(!r || ((r.role || r['keys']) && (!r.role || !r['keys']))) {
- if(!r || ((r.role || r['keys']) && (!r.role || !r['keys']))) {
- // projectUsers.splice(i, 1);
+ if(!r.role ) {
} else {
- cleanUsers.push(u);
- }
- })
- })
-
- this.Store.updateProject(_.merge({
- 'name': self.state['name'],
- 'description': self.state.description,
- 'project-config' : {
- 'user': cleanUsers
+ delete r.keys;
+ // r.keys = projectName;
+ cleanRoles.push(r)
}
- }));
+ });
+ u.role = cleanRoles;
+ cleanUsers.push(u);
+ });
+ return cleanUsers;
}
evaluateSubmit = (e) => {
if (e.keyCode == 13) {
@@ -212,9 +217,9 @@ class ProjectManagementDashboard extends React.Component {
let state = this.state;
let passwordSectionHTML = null;
let formButtonsHTML = (
-
{ state.roles.map((r,j) => { - return | -1)} /> | + return-1)} /> | }) }