Update some core nodes info

This commit is contained in:
Dave Conway-Jones
2017-04-24 20:36:27 +01:00
parent 4689d56955
commit 45fbd22e28
10 changed files with 114 additions and 209 deletions

View File

@@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="debug">
<div class="form-row">
@@ -36,13 +21,16 @@
<script type="text/x-red" data-help-name="debug">
<p>The Debug node can be connected to the output of any node. It can be used to display the output of any message
property in the debug tab of the sidebar. The default is to display <code>msg.payload</code>.</p>
<p>Each message will also display the timestamp, <code>msg.topic</code> and the type of property chosen to output.</p>
<p>The sidebar can be accessed under the options drop-down in the top right corner.</p>
<p>Each message will also display the date, time, node-id and the type of the chosen property.</p>
<p>The sidebar can be accessed under the options drop-down ( <i class="fa fa-bars"></i> ) in the top right corner.</p>
<p>The button to the right of the node will toggle its output on and off so you can de-clutter the debug window.</p>
<p>If the payload is an object or buffer it will be stringified first for display and indicate that by saying "(Object)" or "(Buffer)".</p>
<p>Selecting any particular message will highlight (in red) the debug node that reported it. This is useful if you wire up multiple debug nodes.</p>
<p>Optionally can show the complete <code>msg</code> object, and send messages to the console log ().</p>
<p>In addition any calls to node.warn or node.error will appear here.</p>
<p>You can explore the received messages further by clicking on them. Numbers will be shown in decimal and hex and
as a timestamp if appropriate. Objects and arrays can be further expanded as required. Buffers may be able to be
shown as strings if possible.</p>
<p>Selecting the node-id of any particular message will highlight (in red) the debug node that reported it.
This is useful if you wire up multiple debug nodes.</p>
<p>The node can also be configured to send all messages to the console log ().</p>
<p><b>Note: </b>In addition, any calls to <b>node.warn</b> or <b>node.error</b> will also appear in the debug tab.</p>
</script>
<script src="debug/view/debug-utils.js"></script>
@@ -105,7 +93,7 @@
error: function(jqXHR,textStatus,errorThrown) {
if (jqXHR.status == 404) {
RED.notify(node._("common.notification.error", {message: node._("common.notification.errors.not-deployed")}),"error");
} else if (jqXHR.status == 0) {
} else if (jqXHR.status === 0) {
RED.notify(node._("common.notification.error", {message: node._("common.notification.errors.no-response")}),"error");
} else {
RED.notify(node._("common.notification.error",{message:node._("common.notification.errors.unexpected",{status:err.status,message:err.response})}),"error");
@@ -147,7 +135,7 @@
});
RED.view.redraw();
}
}
};
var uiComponents = RED.debug.init(options);
@@ -159,7 +147,7 @@
toolbar: uiComponents.footer,
enableOnEdit: true
});
RED.actions.add("core:show-debug-tab",function() { RED.sidebar.show('debug')});
RED.actions.add("core:show-debug-tab",function() { RED.sidebar.show('debug'); });
var that = this;
RED._debug = function(msg) {
@@ -167,18 +155,18 @@
name:"debug",
msg:msg
});
}
};
this.refreshMessageList = function() {
RED.debug.refreshMessageList(RED.workspaces.active());
if (subWindow) {
try {
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*")
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*");
} catch(err) {
console.log(err);
}
}
}
};
this.handleDebugMessage = function(t,o) {
var sourceNode = RED.nodes.node(o.id) || RED.nodes.node(o.z);
@@ -189,7 +177,7 @@
RED.debug.handleDebugMessage(o);
if (subWindow) {
try {
subWindow.postMessage({event:"message",msg:o},"*")
subWindow.postMessage({event:"message",msg:o},"*");
} catch(err) {
console.log(err);
}
@@ -204,13 +192,13 @@
subWindow = window.open(document.location.toString().replace(/[?#].*$/,"")+"debug/view/view.html"+document.location.search,"nodeREDDebugView","menubar=no,location=no,toolbar=no,chrome,height=500,width=600");
subWindow.onload = function() {
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*");
}
};
});
$(window).unload(function() {
if (subWindow) {
try {
subWindow.close()
subWindow.close();
} catch(err) {
console.log(err);
}
@@ -228,7 +216,7 @@
} else if (msg.event === "clear") {
options.clear();
}
}
};
window.addEventListener('message',this.handleWindowMessage);
},
onpaletteremove: function() {
@@ -251,8 +239,7 @@
$("#node-input-typed-complete").typedInput('value',property);
}
$("#node-input-typed-complete").on('change',function() {
if ($("#node-input-typed-complete").typedInput('type') === 'msg'
&&
if ($("#node-input-typed-complete").typedInput('type') === 'msg' &&
$("#node-input-typed-complete").typedInput('value') === ''
) {
$("#node-input-typed-complete").typedInput('value','payload');