From 4fff3ce44826deaacafec53e16e90fab3dbe12d7 Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Wed, 11 Dec 2013 22:22:33 +0000 Subject: [PATCH] Make missing node type error popup non-permanent Fixes Issue #113 --- public/red/main.js | 18 ++++++++++-------- public/red/nodes.js | 9 ++++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/public/red/main.js b/public/red/main.js index a16eb870a..ff069abeb 100644 --- a/public/red/main.js +++ b/public/red/main.js @@ -19,11 +19,15 @@ var RED = function() { function save(force) { if (RED.view.dirty()) { - + if (!force) { var invalid = false; RED.nodes.eachNode(function(node) { invalid = invalid || !node.valid; + if (node.type === "unknown") { + RED.notify('Unknown node type '+node.name+' found',"error"); + invalid = true; + } }); if (invalid) { $( "#node-dialog-confirm-deploy" ).dialog( "open" ); @@ -98,13 +102,13 @@ var RED = function() { } function showHelp() { - + var dialog = $('#node-help'); - + //$("#node-help").draggable({ // handle: ".modal-header" - //}); - + //}); + dialog.on('show',function() { RED.keyboard.disable(); }); @@ -114,8 +118,7 @@ var RED = function() { dialog.modal(); } - - + $(function() { RED.keyboard.add(/* ? */ 191,{shift:true},function(){showHelp();d3.event.preventDefault();}); loadNodes(); @@ -124,4 +127,3 @@ var RED = function() { return { }; }(); - diff --git a/public/red/nodes.js b/public/red/nodes.js index e3b148e0f..28e5f16d7 100644 --- a/public/red/nodes.js +++ b/public/red/nodes.js @@ -114,6 +114,7 @@ RED.nodes = function() { } return {nodes:removedNodes,links:removedLinks}; } + function getAllFlowNodes(node) { var visited = {}; visited[node.id] = true; @@ -148,7 +149,6 @@ RED.nodes = function() { node.x = n.x; node.y = n.y; node.z = n.z; - node.wires = []; for(var i=0;iFailed to import node: unrecognised type '"+n.type+"'
DO NOT DEPLOY while in this state.
Either, add missing types to Node-RED, restart and then reload page,
or delete unknown ( "+n.type+" ), rewire as required, and then deploy.","error","true"); //return null; // n.name = "( "+n.type+" )"; // DCJ - mod to make it load, but will lose all "self knowledge". n.type = "unknown"; // - } + } // + if (n.type == "unknown") { // + RED.notify("Failed to import node: unrecognised type '"+n.name+"'
DO NOT DEPLOY while in this state.
Either, add missing types to Node-RED, restart and then reload page,
or delete unknown "+n.name+", rewire as required, and then deploy.","error"); + } // + } for (var i in newNodes) { var n = newNodes[i];