1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Filter loaded property from /nodes endpoint

This commit is contained in:
Nick O'Leary 2015-03-26 11:38:51 +00:00
parent 9daeba02b5
commit dd7f4f6752
2 changed files with 5 additions and 7 deletions

View File

@ -84,13 +84,11 @@ var RED = (function() {
m = msg[i]; m = msg[i];
var id = m.id; var id = m.id;
RED.nodes.addNodeSet(m); RED.nodes.addNodeSet(m);
if (m.loaded) {
addedTypes = addedTypes.concat(m.types); addedTypes = addedTypes.concat(m.types);
$.get('nodes/'+id, function(data) { $.get('nodes/'+id, function(data) {
$("body").append(data); $("body").append(data);
}); });
} }
}
if (addedTypes.length) { if (addedTypes.length) {
typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>";
RED.notify("Node"+(addedTypes.length!=1 ? "s":"")+" added to palette:"+typeList,"success"); RED.notify("Node"+(addedTypes.length!=1 ? "s":"")+" added to palette:"+typeList,"success");

View File

@ -29,7 +29,7 @@ var settings = require("../settings");
module.exports = { module.exports = {
getAll: function(req,res) { getAll: function(req,res) {
if (req.get("accept") == "application/json") { if (req.get("accept") == "application/json") {
res.json(redNodes.getNodeList()); res.json(redNodes.getNodeList().map(function(n) { delete n.loaded; return n }));
} else { } else {
res.send(redNodes.getNodeConfigs()); res.send(redNodes.getNodeConfigs());
} }