From: Laurence Maultsby Date: Fri, 28 Apr 2017 19:09:27 +0000 (-0400) Subject: Created an env var for disabling sockets X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0d4ddf409b399a2caa75726be8d04ce6fe89b2c8;p=osm%2FUI.git Created an env var for disabling sockets Signed-off-by: Laurence Maultsby --- diff --git a/skyquake/framework/core/api_utils/sockets.js b/skyquake/framework/core/api_utils/sockets.js index e2e444735..e8ae2ebd8 100644 --- a/skyquake/framework/core/api_utils/sockets.js +++ b/skyquake/framework/core/api_utils/sockets.js @@ -1,5 +1,5 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -295,7 +295,11 @@ function PollingSocket(url, req, interval, config) { console.log('Error polling: ' + url); } else { if (!self.isClosed) { - self.poll = setTimeout(pollServer, 1000 || interval); + if(process.env.DISABLE_POLLING != "TRUE") { + self.poll = setTimeout(pollServer, 1000 || interval); + } else { + console.log('Polling is disabled. Finishing request.') + } var data = response.body; if (self.onmessage) { self.onmessage(data); diff --git a/skyquake/framework/core/modules/api/userManagementAPI.js b/skyquake/framework/core/modules/api/userManagementAPI.js index b2f55c36f..c05c2b343 100644 --- a/skyquake/framework/core/modules/api/userManagementAPI.js +++ b/skyquake/framework/core/modules/api/userManagementAPI.js @@ -141,6 +141,9 @@ UserManagement.getUserInfo = function(req, userId, domain) { u.role && u.role.map(function(r) { userData.project[p.name].role[r.role] = true }); + u["rw-project-mano:mano-role"] && u["rw-project-mano:mano-role"] .map(function(r) { + userData.project[p.name].role[r.role] = true + }); } }) }); diff --git a/skyquake/framework/utils/roleConstants.js b/skyquake/framework/utils/roleConstants.js index e04c43e95..5ac4e641e 100644 --- a/skyquake/framework/utils/roleConstants.js +++ b/skyquake/framework/utils/roleConstants.js @@ -7,6 +7,16 @@ c.PLATFORM = { } c.PROJECT = { + TYPE: { + "rw-project-mano:catalog-oper": "rw-project-mano", + "rw-project-mano:catalog-admin": "rw-project-mano", + "rw-project-mano:lcm-oper": "rw-project-mano", + "rw-project-mano:lcm-admin": "rw-project-mano", + "rw-project-mano:account-oper": "rw-project-mano", + "rw-project-mano:account-admin": "rw-project-mano", + "rw-project:project-oper": "rw-project", + "rw-project:project-admin": "rw-project" + }, CATALOG_OPER: "rw-project-mano:catalog-oper", CATALOG_ADMIN: "rw-project-mano:catalog-admin", LCM_OPER: "rw-project-mano:lcm-oper", @@ -15,6 +25,7 @@ c.PROJECT = { ACCOUNT_ADMIN: "rw-project-mano:account-admin", PROJECT_OPER: "rw-project:project-oper", PROJECT_ADMIN: "rw-project:project-admin" + } module.exports = c; diff --git a/skyquake/plugins/project_management/src/dashboard/dashboard.jsx b/skyquake/plugins/project_management/src/dashboard/dashboard.jsx index 02b9384a3..843301d03 100644 --- a/skyquake/plugins/project_management/src/dashboard/dashboard.jsx +++ b/skyquake/plugins/project_management/src/dashboard/dashboard.jsx @@ -136,17 +136,21 @@ class ProjectManagementDashboard extends React.Component { //Remove null values from role projectUsers.map((u) => { let cleanRoles = []; + let cleanManoRoles = []; 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.role ) { - } else { + if(r.role ) { delete r.keys; - // r.keys = projectName; - cleanRoles.push(r) + // r.keys = projectName; + switch(ROLES.PROJECT.TYPE[r.role]) { + case 'rw-project-mano' : cleanManoRoles.push(r); break; + case 'rw-project' : cleanRoles.push(r); break; + } } }); u.role = cleanRoles; + u["rw-project-mano:mano-role"] = cleanManoRoles cleanUsers.push(u); }); return cleanUsers; @@ -175,13 +179,6 @@ class ProjectManagementDashboard extends React.Component { removeUserFromProject = (userIndex, e) => { this.actions.handleRemoveUserFromProject(userIndex); } - updateUserRoleInProject = (userIndex, roleIndex, e) => { - this.actions.handleUpdateUserRoleInProject({ - userIndex, - roleIndex, - value: JSON.parse(e.target.value) - }) - } toggleUserRoleInProject = (userIndex, roleIndex, e) => { this.actions.handleToggleUserRoleInProject({ userIndex, diff --git a/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js b/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js index b3e55ad6c..70f5f2f61 100644 --- a/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js +++ b/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js @@ -16,7 +16,9 @@ export default class ProjectManagementStore { this.projectUsers = []; this.selectedUser = null; this.selectedRole = null; - this.roles = Object.keys(ROLES.PROJECT).map((p) => { + this.roles = Object.keys(ROLES.PROJECT).filter((p) => { + return p != "TYPE"; + }).map((p) => { return ROLES.PROJECT[p]; }) // this.roles = ['rw-project:project-admin', 'rw-project:project-oper', 'rw-project:project-create']; @@ -172,9 +174,26 @@ export default class ProjectManagementStore { let projectUsers = this.projectUsers; let selectedRole = self.roles[roleIndex]; if(checked) { - if(!projectUsers[userIndex].role) projectUsers[userIndex].role = []; + 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: self.roles[roleIndex] + role: selectedRole }) } else { let role = projectUsers[userIndex].role;