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

more core node info updates to newer style

This commit is contained in:
Dave Conway-Jones 2017-04-25 21:47:58 +01:00
parent 45fbd22e28
commit 7f90d31846
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D
7 changed files with 84 additions and 123 deletions

View File

@ -1,20 +1,4 @@
<!--
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="csv"> <script type="text/x-red" data-template-name="csv">
<div class="form-row"> <div class="form-row">
<label for="node-input-temp"><i class="fa fa-list"></i> <span data-i18n="csv.label.columns"></span></label> <label for="node-input-temp"><i class="fa fa-list"></i> <span data-i18n="csv.label.columns"></span></label>
@ -68,12 +52,16 @@
</script> </script>
<script type="text/x-red" data-help-name="csv"> <script type="text/x-red" data-help-name="csv">
<p>A function that parses the <code>msg.payload</code> to convert CSV to/from a javascript object. <p>A function that parses the <code>msg.payload</code> to convert CSV to or from a javascript object.
Places the result in the payload.</p> Places the result in the payload.</p>
<p>If the input is a string it tries to parse it as CSV and creates a javascript object.</p> <h3>Inputs</h3>
<p>If the input is a javascript object it tries to build a CSV string.</p> <ul>
<p>If the input is a simple array the output is just a CSV generated from that array.</p> <li>If the input is a string it tries to parse it as CSV and creates a javascript object.</li>
<p>If the input is an array of arrays, or an array of objects, a multiple-line CSV is created.</p> <li>If the input is a javascript object it tries to build a CSV string.</li>
<li>If the input is a simple array the output is just a CSV generated from that array.</li>
<li>If the input is an array of arrays, or an array of objects, a multiple-line CSV is created.</li>
</ul>
<h3>Details</h3>
<p>The columns template should contain an ordered list of column headers. For CSV input these become the property names. <p>The columns template should contain an ordered list of column headers. For CSV input these become the property names.
For CSV output these specify the properties to extract from the object and the order for the CSV.</p> For CSV output these specify the properties to extract from the object and the order for the CSV.</p>
<p>If the input is an array then the columns template does not matter, but can be used to generate a row of column titles.</p> <p>If the input is an array then the columns template does not matter, but can be used to generate a row of column titles.</p>

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="html"> <script type="text/x-red" data-template-name="html">
<div class="form-row"> <div class="form-row">
@ -45,11 +30,22 @@
<script type="text/x-red" data-help-name="html"> <script type="text/x-red" data-help-name="html">
<p>Extracts elements from an html document held in <code>msg.payload</code> using a selector.</p> <p>Extracts elements from an html document held in <code>msg.payload</code> using a selector.</p>
<p>If left blank the selector may be set dynamically by passing in <code>msg.select</code> along with the <code>msg.payload</code>. <h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the html string from which to extract elements.</dd>
<dt class="optional">select <span class="property-type">string</span></dt>
<dd>if not configured in the edit panel the selector can be set as a property of msg.</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">array | strings</span></dt>
<dd>the result can be either a single message with a payload containing an array of the matched elements, or multiple
messages that each contain a matched element.</dd>
</dl>
<h3>Details</h3>
<p>The selector uses <a href="https://github.com/cheeriojs/cheerio/blob/master/Readme.md" target="_blank">Cheerio</a> <p>The selector uses <a href="https://github.com/cheeriojs/cheerio/blob/master/Readme.md" target="_blank">Cheerio</a>
which uses the <a href="https://github.com/fb55/CSSselect#user-content-supported-selectors" target="_blank">CSS selector</a> syntax.</p> which uses the <a href="https://github.com/fb55/CSSselect#user-content-supported-selectors" target="_blank">CSS selector</a> syntax.</p>
<p>The result can be either a single message with a payload containing an array of the matched elements, or multiple
messages that each contain a matched element.</p>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">

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="json"> <script type="text/x-red" data-template-name="json">
<div class="form-row"> <div class="form-row">
@ -22,9 +7,13 @@
</script> </script>
<script type="text/x-red" data-help-name="json"> <script type="text/x-red" data-help-name="json">
<p>A function that parses the <code>msg.payload</code> to convert a JSON string to/from a javascript object. Places the result back into the payload.</p> <p>A function that parses the <code>msg.payload</code> to convert a JSON string
<p>If the input is a JSON string it tries to parse it to a javascript object.</p> to or from a javascript object. Places the result back into the payload.</p>
<p>If the input is a javascript object it creates a JSON string.</p> <h3>Inputs</h3>
<ul>
<li>If the input is a JSON string it tries to parse it to a javascript object.</li>
<li>If the input is a javascript object it creates a JSON string.</li>
<ul>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">

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="xml"> <script type="text/x-red" data-template-name="xml">
<div class="form-row"> <div class="form-row">
@ -33,13 +18,21 @@
</script> </script>
<script type="text/x-red" data-help-name="xml"> <script type="text/x-red" data-help-name="xml">
<p>A function that parses the <code>msg.payload</code> to convert xml to/from a javascript object. Places the result in the payload.</p> <p>A function that parses the <code>msg.payload</code> to convert xml to or from a javascript
<p>If the input is a string it tries to parse it as XML and creates a javascript object.</p> object. Places the result in the payload.</p>
<p>If the input is a javascript object it tries to build an XML string.</p> <h3>Inputs</h3>
<p>You can also pass in a <code>msg.options</code> object to override all the multitude of parameters. See <ul>
<a href="https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options" target="_blank">the xml2js docs</a> <li>If the input is a string it tries to parse it as XML and creates a javascript object.</li>
for more information.</p> <li>If the input is a javascript object it tries to build an XML string.</li>
<p>If set, options in the edit dialogue override those passed in on the msg.options object.</p> </ul>
<dl class="message-properties">
<dt class="optional">options <span class="property-type">string</span></dt>
<dd>You can also pass in a <code>msg.options</code> object to override all the multitude of parameters. See
<a href="https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options" target="_blank">the xml2js docs</a>
for more information.</dd>
</dl>
<h3>Details</h3>
<p>If set, options in the edit dialogue override those passed in on the msg.options object.</p>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -7,9 +7,13 @@
</script> </script>
<script type="text/x-red" data-help-name="yaml"> <script type="text/x-red" data-help-name="yaml">
<p>A function that parses the <code>msg.payload</code> to convert a YAML string to/from a javascript object. Places the result back into the payload.</p> <p>A function that parses the <code>msg.payload</code> to convert a YAML string to or
<p>If the input is a YAML string it tries to parse it to a javascript object.</p> from a javascript object. Places the result back into the payload.</p>
<p>If the input is a javascript object it creates a YAML string.</p> <h3>Inputs</h3>
<ul>
<li>If the input is a YAML string it tries to parse it to a javascript object.</li>
<li>If the input is a javascript object it creates a YAML string.</li>
</ul>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">

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="tail"> <script type="text/x-red" data-template-name="tail">
<div class="form-row"> <div class="form-row">
@ -40,7 +25,11 @@
<script type="text/x-red" data-help-name="tail"> <script type="text/x-red" data-help-name="tail">
<p>Tails (watches for things to be added) to the configured file. (Linux/Mac ONLY)</p> <p>Tails (watches for things to be added) to the configured file. (Linux/Mac ONLY)</p>
<p>This will not work on Windows filesystems, as it relies on the <b>tail -F</b> command.</p> <p>This will not work on Windows filesystems, as it relies on the <b>tail -F</b> command.</p>
<p>Text (UTF-8) files will be returned as strings. Binary files will be returned as a Buffer object.</p> <h3>Outputs</h3>
<ul>
<li>Text (UTF-8) files will be returned as strings.</li>
<li>Binary files will be returned as Buffer objects.</li>
</ul>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
@ -57,16 +46,16 @@
outputs:1, outputs:1,
icon: "file.png", icon: "file.png",
label: function() { label: function() {
return this.name||this.filename; return this.name||this.filename||"tail";
}, },
labelStyle: function() { labelStyle: function() {
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";
}, },
oneditprepare: function() { oneditprepare: function() {
$("#node-input-filetype").on("change",function() { $("#node-input-filetype").on("change",function() {
if (this.value === "text") { $("#node-tail-split").show(); } if (this.value === "text") { $("#node-tail-split").show(); }
else { $("#node-tail-split").hide(); } else { $("#node-tail-split").hide(); }
}); });
} }
}); });
</script> </script>

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="file"> <script type="text/x-red" data-template-name="file">
<div class="form-row node-input-filename"> <div class="form-row node-input-filename">
@ -46,9 +31,13 @@
<script type="text/x-red" data-help-name="file"> <script type="text/x-red" data-help-name="file">
<p>Writes <code>msg.payload</code> to the file specified, for example to create a log.</p> <p>Writes <code>msg.payload</code> to the file specified, for example to create a log.</p>
<p>The filename can be configured in the node. If left blank it should be <h3>Inputs</h3>
set by <code>msg.filename</code> on the incoming message.</p> <dl class="message-properties">
<p>A newline is added to every message. But this can be turned off if required, for example, <dt class="optional">filename <span class="property-type">string</span></dt>
<dd>If not configured in the node the filename can be set using the filename property.</dd>
</dl>
<h3>Details</h3>
<p>By default a newline is added to every message. This can be turned off if required, for example,
to allow binary files to be written.</p> to allow binary files to be written.</p>
<p>The default behaviour is to append to the file. This can be changed to overwrite the file <p>The default behaviour is to append to the file. This can be changed to overwrite the file
each time, for example if you want to output a "static" web page or report.</p> each time, for example if you want to output a "static" web page or report.</p>
@ -77,8 +66,21 @@
<script type="text/x-red" data-help-name="file in"> <script type="text/x-red" data-help-name="file in">
<p>Reads the specified file and sends the content as <code>msg.payload</code>, <p>Reads the specified file and sends the content as <code>msg.payload</code>,
and the filename as <code>msg.filename</code>.</p> and the filename as <code>msg.filename</code>.</p>
<p>The filename can be configured in the node. If left blank it should be <h3>Inputs</h3>
set by <code>msg.filename</code> on the incoming message.</p> <dl class="message-properties">
<dt class="optional">filename <span class="property-type">string</span></dt>
<dd>if not set in the node configuration the filename to read can be passed in.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | buffer</span></dt>
<dd>the contents of the file as either a string or binary buffer.</dd>
<dt>filename <span class="property-type">string</span></dt>
<dd>the filename of the read file.</dd>
</dl>
<h3>Details</h3>
<p>It is advisable to fully specify the required file path and name.
On Windows you may need to use \\ to specify the path separator.</p>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">