mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
7419f62a20
commit
dfc79e3122
@ -16,13 +16,15 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-template-name="unknown">
|
<script type="text/x-red" data-template-name="unknown">
|
||||||
<div class="form-tips"><p>This node is a type unknown to your installation of Node-RED.</p>
|
<div class="form-tips"><p>This node is a type unknown to your installation of Node-RED.</p>
|
||||||
<p><i>If you deploy with the node in this state, it will lose all of its configuration.</i></p>
|
<p><i>If you deploy with the node in this state, it's configuration will be preserved, but
|
||||||
|
the flow will not start until the missing type is installed.</i></p>
|
||||||
<p>See the Info side bar for more help</p></div>
|
<p>See the Info side bar for more help</p></div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="unknown">
|
<script type="text/x-red" data-help-name="unknown">
|
||||||
<p>This node is a type unknown to your installation of Node-RED.</p>
|
<p>This node is a type unknown to your installation of Node-RED.</p>
|
||||||
<p><i>If you deploy with the node in this state, it will lose all of its configuration.</i></p>
|
<p><i>If you deploy with the node in this state, it's configuration will be preserved, but
|
||||||
|
the flow will not start until the missing type is installed.</i></p>
|
||||||
<p>It is possible this node type is already installed, but is missing a dependency. Check the Node-RED start-up log for
|
<p>It is possible this node type is already installed, but is missing a dependency. Check the Node-RED start-up log for
|
||||||
any error messages associated with the missing node type. Use <b>npm install <module></b> to install any missing modules
|
any error messages associated with the missing node type. Use <b>npm install <module></b> to install any missing modules
|
||||||
and restart Node-RED and reimport the nodes.</p>
|
and restart Node-RED and reimport the nodes.</p>
|
||||||
|
@ -330,6 +330,13 @@ RED.nodes = (function() {
|
|||||||
var node = {};
|
var node = {};
|
||||||
node.id = n.id;
|
node.id = n.id;
|
||||||
node.type = n.type;
|
node.type = n.type;
|
||||||
|
if (node.type == "unknown") {
|
||||||
|
for (var p in n._orig) {
|
||||||
|
if (n._orig.hasOwnProperty(p)) {
|
||||||
|
node[p] = n._orig[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
for (var d in n._def.defaults) {
|
for (var d in n._def.defaults) {
|
||||||
if (n._def.defaults.hasOwnProperty(d)) {
|
if (n._def.defaults.hasOwnProperty(d)) {
|
||||||
node[d] = n[d];
|
node[d] = n[d];
|
||||||
@ -345,6 +352,7 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (n._def.category != "config") {
|
if (n._def.category != "config") {
|
||||||
node.x = n.x;
|
node.x = n.x;
|
||||||
node.y = n.y;
|
node.y = n.y;
|
||||||
@ -503,16 +511,15 @@ RED.nodes = (function() {
|
|||||||
!registry.getNodeType(n.type) &&
|
!registry.getNodeType(n.type) &&
|
||||||
n.type.substring(0,8) != "subflow:") {
|
n.type.substring(0,8) != "subflow:") {
|
||||||
// TODO: get this UI thing out of here! (see below as well)
|
// TODO: get this UI thing out of here! (see below as well)
|
||||||
n.name = n.type;
|
|
||||||
n.type = "unknown";
|
if (unknownTypes.indexOf(n.type)==-1) {
|
||||||
if (unknownTypes.indexOf(n.name)==-1) {
|
unknownTypes.push(n.type);
|
||||||
unknownTypes.push(n.name);
|
|
||||||
}
|
|
||||||
if (n.x == null && n.y == null) {
|
|
||||||
// config node - remove it
|
|
||||||
newNodes.splice(i,1);
|
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
|
//if (n.x == null && n.y == null) {
|
||||||
|
// // config node - remove it
|
||||||
|
// newNodes.splice(i,1);
|
||||||
|
// i--;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unknownTypes.length > 0) {
|
if (unknownTypes.length > 0) {
|
||||||
@ -653,6 +660,7 @@ RED.nodes = (function() {
|
|||||||
node.inputs = subflow.in.length;
|
node.inputs = subflow.in.length;
|
||||||
} else {
|
} else {
|
||||||
if (!node._def) {
|
if (!node._def) {
|
||||||
|
if (node.x && node.y) {
|
||||||
node._def = {
|
node._def = {
|
||||||
color:"#fee",
|
color:"#fee",
|
||||||
defaults: {},
|
defaults: {},
|
||||||
@ -660,23 +668,41 @@ RED.nodes = (function() {
|
|||||||
labelStyle: "node_label_italic",
|
labelStyle: "node_label_italic",
|
||||||
outputs: n.outputs||n.wires.length
|
outputs: n.outputs||n.wires.length
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
node._def = {
|
||||||
|
category:"config"
|
||||||
|
};
|
||||||
|
node.users = [];
|
||||||
}
|
}
|
||||||
|
var orig = {};
|
||||||
|
for (var p in n) {
|
||||||
|
if (n.hasOwnProperty(p) && p!="x" && p!="y" && p!="z" && p!="id" && p!="wires") {
|
||||||
|
orig[p] = n[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node._orig = orig;
|
||||||
|
node.name = n.type;
|
||||||
|
node.type = "unknown";
|
||||||
|
}
|
||||||
|
if (node._def.category != "config") {
|
||||||
node.inputs = n.inputs||node._def.inputs;
|
node.inputs = n.inputs||node._def.inputs;
|
||||||
node.outputs = n.outputs||node._def.outputs;
|
node.outputs = n.outputs||node._def.outputs;
|
||||||
|
|
||||||
for (var d2 in node._def.defaults) {
|
for (var d2 in node._def.defaults) {
|
||||||
if (node._def.defaults.hasOwnProperty(d2)) {
|
if (node._def.defaults.hasOwnProperty(d2)) {
|
||||||
node[d2] = n[d2];
|
node[d2] = n[d2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
addNode(node);
|
addNode(node);
|
||||||
RED.editor.validateNode(node);
|
RED.editor.validateNode(node);
|
||||||
node_map[n.id] = node;
|
node_map[n.id] = node;
|
||||||
|
if (node._def.category != "config") {
|
||||||
new_nodes.push(node);
|
new_nodes.push(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (i=0;i<new_nodes.length;i++) {
|
for (i=0;i<new_nodes.length;i++) {
|
||||||
n = new_nodes[i];
|
n = new_nodes[i];
|
||||||
for (var w1=0;w1<n.wires.length;w1++) {
|
for (var w1=0;w1<n.wires.length;w1++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user