From 58b5f0fd1b1c39041990e1c8535aca962fd77523 Mon Sep 17 00:00:00 2001 From: Durgesh1988 Date: Wed, 21 Sep 2016 12:20:21 +0530 Subject: [PATCH 1/9] CAT-2345/CAT-2346 Fixed --- server/app/routes/v1.0/routes_tasks.js | 97 ++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 14 deletions(-) diff --git a/server/app/routes/v1.0/routes_tasks.js b/server/app/routes/v1.0/routes_tasks.js index 37308b87a..b225dc447 100755 --- a/server/app/routes/v1.0/routes_tasks.js +++ b/server/app/routes/v1.0/routes_tasks.js @@ -26,6 +26,7 @@ var logger = require('_pr/logger')(module); var taskService = require('_pr/services/taskService.js') var async = require('async'); var apiUtil = require('_pr/lib/utils/apiUtil.js'); +var Cryptography = require('_pr/lib/utils/cryptography'); @@ -487,20 +488,53 @@ module.exports.setRoutes = function(app, sessionVerification) { app.post('/tasks/:taskId/update', function(req, res) { var taskData = req.body.taskData; - Tasks.updateTaskById(req.params.taskId, taskData, function(err, updateCount) { - if (err) { - logger.error(err); - res.status(500).send(errorResponses.db.error); - return; - } - if (updateCount) { - res.send({ - updateCount: updateCount - }); - } else { - res.send(400); - } - }); + if(taskData.taskType === 'script'){ + Tasks.getTaskById(req.params.taskId, function(err, scriptTask) { + if (err) { + logger.error(err); + res.status(500).send(errorResponses.db.error); + return; + } + encryptedParam(taskData.scriptDetails,scriptTask.taskConfig.scriptDetails, function (err, encryptedParam) { + if (err) { + logger.error(err); + res.status(500).send("Failed to encrypted script parameters: ", err); + return; + } else { + taskData.scriptDetails = encryptedParam; + Tasks.updateTaskById(req.params.taskId, taskData, function (err, updateCount) { + if (err) { + logger.error(err); + res.status(500).send(errorResponses.db.error); + return; + } + if (updateCount) { + res.send({ + updateCount: updateCount + }); + } else { + res.send(400); + } + }); + } + }) + }); + }else { + Tasks.updateTaskById(req.params.taskId, taskData, function (err, updateCount) { + if (err) { + logger.error(err); + res.status(500).send(errorResponses.db.error); + return; + } + if (updateCount) { + res.send({ + updateCount: updateCount + }); + } else { + res.send(400); + } + }); + } }); app.post('/tasks/:taskId/resultUrl/remove', function(req, res) { @@ -541,3 +575,38 @@ module.exports.setRoutes = function(app, sessionVerification) { }); }; + +function encryptedParam(paramDetails,existingParams,callback){ + var cryptoConfig = appConfig.cryptoSettings; + var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password); + var count = 0; + var encryptedList = []; + for(var i = 0; i < paramDetails.length; i++){ + (function(param){ + if(param.scriptParameters.length > 0){ + count++; + for(var j = 0; j < param.scriptParameters.length; j++){ + (function(scriptParameter){ + if(scriptParameter === existingParams[i].scriptParameters[j]){ + encryptedList.push(scriptParameter); + }else { + var encryptedText = cryptography.encryptText(scriptParameter, cryptoConfig.encryptionEncoding, + cryptoConfig.decryptionEncoding); + encryptedList.push(encryptedText); + } + if(encryptedList.length === param.scriptParameters.length){ + param.scriptParameters = encryptedList; + encryptedList = []; + } + })(param.scriptParameters[j]); + } + }else{ + count++; + } + if(count === paramDetails.length){ + callback(null,paramDetails); + return; + } + })(paramDetails[i]); + } +} From 8dbce2a8dad7f909d0eb6dd8f5e23ab9e50a6f2e Mon Sep 17 00:00:00 2001 From: Durgesh1988 Date: Wed, 21 Sep 2016 12:20:48 +0530 Subject: [PATCH 2/9] CAT-2345/CAT-2346 Fixed --- client/htmls/private/js/scriptList.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/client/htmls/private/js/scriptList.js b/client/htmls/private/js/scriptList.js index 1d189e8e2..93cdfc55a 100644 --- a/client/htmls/private/js/scriptList.js +++ b/client/htmls/private/js/scriptList.js @@ -244,23 +244,6 @@ $('#scriptForm').submit(function(e) { var formData = new FormData(); formData.append('file', $('input[type=file]')[0].files[0]); var methodName =''; - if(scriptEditNew === "edit") { - if(hiddenFileName === availableFileName) { - url = '../scripts/update/scriptData'; - methodName = 'PUT'; - reqBody = { - "scriptId": scriptId, - "name": name, - "type": type, - "description": description, - "orgDetails": orgDetails, - "fileId": fileId - }; - formSave(methodName,url,reqBody); - return false; - } - } - var isValidator = $('#scriptForm').valid(); if(isValidator){ e.preventDefault(); From c268ff19dc94f9123e3e35ed54e759c8565eaded Mon Sep 17 00:00:00 2001 From: Durgesh1988 Date: Thu, 22 Sep 2016 11:40:12 +0530 Subject: [PATCH 3/9] CAT-2347 Fixed and docker uat flow parameters in blueprint implementation --- .../orchestration/popups/newTask.html | 4 +- server/app/lib/route53.js | 77 +++++++++++++ server/app/model/classes/tasks/tasks.js | 66 +++++++++++- server/app/services/resourceService.js | 102 +++++++++++++++++- 4 files changed, 243 insertions(+), 6 deletions(-) create mode 100644 server/app/lib/route53.js diff --git a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html index 89499be44..855fd7d89 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTask.html @@ -453,7 +453,8 @@
Script Details
- {{param}} + {{param}} + ..... @@ -470,7 +471,6 @@
Script Details
- +
+ +
+
+ +
+
+ +
+
+
diff --git a/client/htmls/private/ajax/DesignBlueprint.html b/client/htmls/private/ajax/DesignBlueprint.html index 4dadd7215..289bcc4ed 100644 --- a/client/htmls/private/ajax/DesignBlueprint.html +++ b/client/htmls/private/ajax/DesignBlueprint.html @@ -140,6 +140,17 @@

+
+ +
+
+ +
+
+ +
+
+
diff --git a/client/htmls/private/ajax/DesignBlueprintAzure.html b/client/htmls/private/ajax/DesignBlueprintAzure.html index 5359540a0..ff8681de2 100644 --- a/client/htmls/private/ajax/DesignBlueprintAzure.html +++ b/client/htmls/private/ajax/DesignBlueprintAzure.html @@ -187,6 +187,17 @@

+
+ +
+
+ +
+
+ +
+
+
diff --git a/client/htmls/private/ajax/DesignBlueprintVmware.html b/client/htmls/private/ajax/DesignBlueprintVmware.html index 52ffee3d2..9a152573e 100644 --- a/client/htmls/private/ajax/DesignBlueprintVmware.html +++ b/client/htmls/private/ajax/DesignBlueprintVmware.html @@ -116,6 +116,17 @@

+
+ +
+
+ +
+
+ +
+
+