Allow for project description change
[osm/UI.git] / skyquake / framework / core / modules / api / projectManagementAPI.js
index feedfc2..195f457 100644 (file)
@@ -104,14 +104,21 @@ ProjectManagement.create = function(req) {
     });
 };
 ProjectManagement.update = function(req) {
+    //"rw-project:project"
     var self = this;
     var api_server = req.query['api_server'];
     var bodyData = req.body;
-    data = bodyData['project-config']
+    var data = {
+        "rw-project:project" : {
+            "name": bodyData.name,
+            "description": bodyData.description,
+            "project-config": bodyData['project-config']
+        }
+    }
     var updateTasks = [];
 
-    var updateUser = rp({
-                uri: utils.confdPort(api_server) + '/api/config/project/' + bodyData.name + '/project-config',
+    var updateProject= rp({
+                uri: utils.confdPort(api_server) + '/api/config/project/',
                 method: 'PUT',
                 headers: _.extend({}, constants.HTTP_HEADERS.accept.data, {
                     'Authorization': req.session && req.session.authorization
@@ -121,7 +128,7 @@ ProjectManagement.update = function(req) {
                 rejectUnauthorized: false,
                 resolveWithFullResponse: true
             });
-    updateTasks.push(updateUser)
+    updateTasks.push(updateProject)
     return new Promise(function(resolve, reject) {
         Promise.all([
             updateTasks
@@ -229,7 +236,7 @@ ProjectManagement.updatePlatform = function(req) {
     data.user = JSON.parse(data.user)
     var updateTasks = [];
 
-    var updateUser = rp({
+    var updatePlatform = rp({
                 uri: utils.confdPort(api_server) + '/api/config/rbac-platform-config',
                 method: 'PUT',
                 headers: _.extend({}, constants.HTTP_HEADERS.accept.data, {
@@ -240,7 +247,7 @@ ProjectManagement.updatePlatform = function(req) {
                 rejectUnauthorized: false,
                 resolveWithFullResponse: true
             });
-    updateTasks.push(updateUser)
+    updateTasks.push(updatePlatform)
     return new Promise(function(resolve, reject) {
         Promise.all([
             updateTasks