Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Panagis Tselentis committed Apr 13, 2017
1 parent c05d766 commit 8b3674b
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 153 deletions.
10 changes: 8 additions & 2 deletions api/controllers/SnapshotController.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ module.exports = _.merge(_.cloneDeep(require('../base/Controller')), {

takeSnapShot : function(req,res) {


// Get node
sails.models.kongnode.findOne({
id : req.param("node_id")
}).exec(function(err,node){
if(err) res.negotiate(err)
if(!node) res.badRequest({
if(err) return res.negotiate(err)
if(!node) return res.badRequest({
message : "Invalid Kong Node"
})



var result = {}

var endpoints = ['/apis','/plugins']
Expand Down Expand Up @@ -66,9 +68,12 @@ module.exports = _.merge(_.cloneDeep(require('../base/Controller')), {
})
})



async.series(fns,function(err,data){
if(err) return res.negotiate(err)


sails.models.snapshot.create({
name : req.param("name"),
kong_node_name : node.name,
Expand All @@ -83,6 +88,7 @@ module.exports = _.merge(_.cloneDeep(require('../base/Controller')), {
}else{
sails.models.snapshot.create({
name : req.param("name"),
kong_node_name : node.name,
kong_version : node.kong_version,
data : result
}).exec(function(err,created){
Expand Down
2 changes: 1 addition & 1 deletion assets/js/app/core/layout/01_layout-controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

$scope.alerts = [];

if(($rootScope.user.node.id == node.id ) || node.checkingConnection) return false;
if((UserService.user().node.id == node.id ) || node.checkingConnection) return false;


// Check if the connection is valid
Expand Down
Loading

0 comments on commit 8b3674b

Please sign in to comment.