diff --git a/server/app/model/blueprint/blueprint.js b/server/app/model/blueprint/blueprint.js index bb068a25f..ee9d2a26e 100755 --- a/server/app/model/blueprint/blueprint.js +++ b/server/app/model/blueprint/blueprint.js @@ -343,6 +343,7 @@ BlueprintSchema.methods.launch = function(opts, callback) { sessionUser: opts.sessionUser, users: self.users, blueprintData: self, + tagServer: opts.tagServer, }, function(err, launchData) { callback(err, launchData); }); @@ -366,6 +367,7 @@ BlueprintSchema.methods.launch = function(opts, callback) { sessionUser: opts.sessionUser, users: self.users, blueprintData: self, + tagServer: opts.tagServer, }, function(err, launchData) { callback(err, launchData); }); @@ -989,7 +991,21 @@ BlueprintSchema.statics.getBlueprintsServiceDeliveryCheck = function(serviceDeli callback(null, blueprints); return; }); +}; +BlueprintSchema.statics.removeServiceDeliveryBlueprints = function(blueprintId, callback) { + this.update({ "_id": new ObjectId(blueprintId)}, {serviceDeliveryCheck: false}, function (err, data) { + if (err) { + logger.error(err); + callback(err, null); + return; + } + if (data.length) { + callback(null, data[0]); + } else { + callback(null, null); + } + }); }; BlueprintSchema.statics.getBlueprintsByOrgBgProjectProvider = function(jsonData, callback) { diff --git a/server/app/model/classes/tasks/tasks.js b/server/app/model/classes/tasks/tasks.js index 85ded6e7b..d723b484f 100755 --- a/server/app/model/classes/tasks/tasks.js +++ b/server/app/model/classes/tasks/tasks.js @@ -580,6 +580,20 @@ taskSchema.statics.getTasksServiceDeliveryCheck = function(serviceDeliveryCheck, }); }; +taskSchema.statics.removeServiceDeliveryTask = function(taskId, callback) { + this.update({ "_id": new ObjectId(taskId)}, {serviceDeliveryCheck:false}, function (err, data) { + if (err) { + logger.error(err); + callback(err, null); + return; + } + if (data.length) { + callback(null, data[0]); + } else { + callback(null, null); + } + }); +}; taskSchema.statics.getTaskById = function(taskId, callback) { this.find({ diff --git a/server/app/routes/v1.0/routes_blueprints.js b/server/app/routes/v1.0/routes_blueprints.js index ef193cb6d..ce00c7a99 100755 --- a/server/app/routes/v1.0/routes_blueprints.js +++ b/server/app/routes/v1.0/routes_blueprints.js @@ -74,6 +74,20 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { }); }); + app.delete('/blueprints/serviceDelivery/:blueprintId', function(req, res) { + Blueprints.removeServiceDeliveryBlueprints(req.params.taskId, function(err, data) { + if (err) { + logger.error("Failed to delete ", err); + res.send(500, errorResponses.db.error); + return; + } + res.send(200, { + message: "deleted" + }); + }); + }); + + // This post() Not in use app.post('/blueprints', function(req, res) { logger.debug("Enter post() for /blueprints"); @@ -427,7 +441,8 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { ver: req.query.version, stackName: stackName, domainName:domainName, - sessionUser: req.session.user.cn + sessionUser: req.session.user.cn, + tagServer: req.query.tagServer }, function(err, launchData) { if (err) { res.status(500).send({ diff --git a/server/app/routes/v1.0/routes_instances.js b/server/app/routes/v1.0/routes_instances.js index 7de7c0b9e..d0f2452cc 100755 --- a/server/app/routes/v1.0/routes_instances.js +++ b/server/app/routes/v1.0/routes_instances.js @@ -220,6 +220,31 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { }); });*/ + // Instance list for tagging server + app.get('/instancesList', function(req, res, next) { + + var reqData = {}; + async.waterfall( + [ + function(next) { + apiUtil.paginationRequest(req.query, 'instances', next); + }, + function(paginationReq, next) { + reqData = paginationReq; + instancesDao.getInstanceList(paginationReq, next); + }, + function(instances, next) { + apiUtil.paginationResponse(instances, reqData, next); + } + ], + function(err, results) { + if (err) + next(err); + else + return res.status(200).send(results); + }); + }); + app.get('/instances', getInstanceList); function getInstanceList(req, res, next) { diff --git a/server/app/routes/v1.0/routes_organizations.js b/server/app/routes/v1.0/routes_organizations.js index 9492bd8a5..ad51b8875 100755 --- a/server/app/routes/v1.0/routes_organizations.js +++ b/server/app/routes/v1.0/routes_organizations.js @@ -1741,7 +1741,7 @@ module.exports.setRoutes = function(app, sessionVerification) { instanceIP: req.body.fqdn, instanceState: nodeAlive, bootStrapStatus: 'waiting', - tagServer: req.body.tagServer, + tagServer: req.params.tagServer, runlist: [], appUrls: appUrls, users: [req.session.user.cn], //need to change this diff --git a/server/app/routes/v1.0/routes_tasks.js b/server/app/routes/v1.0/routes_tasks.js index ed43ab567..007316c17 100755 --- a/server/app/routes/v1.0/routes_tasks.js +++ b/server/app/routes/v1.0/routes_tasks.js @@ -56,6 +56,19 @@ module.exports.setRoutes = function(app, sessionVerification) { }); }); + app.delete('/tasks/serviceDelivery/:taskId', function(req, res) { + Tasks.removeServiceDeliveryTask(req.params.taskId, function(err, data) { + if (err) { + logger.error("Failed to delete service delivery Task", err); + res.send(500, errorResponses.db.error); + return; + } + res.send(200, { + message: "deleted" + }); + }); + }); + app.get('/tasks/history/list/all', function(req, res) { logger.debug("------------------ ",JSON.stringify(TaskHistory)); TaskHistory.listHistory(function(err, tHistories) {