diff --git a/api/controllers/SnapshotController.js b/api/controllers/SnapshotController.js
index 50345e1ad..5b26c6af6 100644
--- a/api/controllers/SnapshotController.js
+++ b/api/controllers/SnapshotController.js
@@ -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']
@@ -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,
@@ -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){
diff --git a/assets/js/app/core/layout/01_layout-controllers.js b/assets/js/app/core/layout/01_layout-controllers.js
index 8bf4fdc2c..2b4a56e06 100644
--- a/assets/js/app/core/layout/01_layout-controllers.js
+++ b/assets/js/app/core/layout/01_layout-controllers.js
@@ -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
diff --git a/views/layout.ejs b/views/layout.ejs
index 62e1b2514..710dc9bfc 100644
--- a/views/layout.ejs
+++ b/views/layout.ejs
@@ -31,14 +31,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -100,148 +100,148 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+