More core node info help tidy up

This commit is contained in:
Nick O'Leary
2017-05-24 16:55:53 +01:00
parent 9c6452544b
commit 479b18354d
5 changed files with 106 additions and 77 deletions

View File

@@ -6,18 +6,18 @@
</div>
<div class="form-row">
<label for="node-input-overwriteFile"><i class="fa fa-random"></i> <span data-i18n="file.label.action"></span></label>
<select type="text" id="node-input-overwriteFile" style="display: inline-block; width: 250px; vertical-align: top;">
<select type="text" id="node-input-overwriteFile" style="width: 250px;">
<option value="false" data-i18n="file.action.append"></option>
<option value="true" data-i18n="file.action.overwrite"></option>
<option value="delete" data-i18n="file.action.delete"></option>
</select>
</div>
<div class="form-row" id="node-appline">
<div class="form-row form-row-file-write-options">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-appendNewline" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-appendNewline" style="width: 70%;"><span data-i18n="file.label.addnewline"></span></label>
</div>
<div class="form-row">
<div class="form-row form-row-file-write-options">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-createDir" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-createDir" style="width: 70%;"><span data-i18n="file.label.createdir"></span></label>
@@ -30,18 +30,20 @@
</script>
<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 a file, either adding to the end or replacing the existing content.
Alternatively, it can delete the file.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<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>
<dd>If not configured in the node, this optional property sets the name of the file to be updated.</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>
<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>
<p>This node can also be configured to delete a file if required.</p>
<p>Each message payload will be added to the end of the file, optionally appending
a newline (\n) character between each one.</p>
<p>It can be configured to overwrite the entire file rather than append. For example,
when writing binary data to a file, such as an image, this option should be used
and the option to append a newline should be disabled.</p>
<p>Alternatively, this node can be configured to delete the file.</p>
</script>
<script type="text/x-red" data-template-name="file in">
@@ -64,23 +66,23 @@
</script>
<script type="text/x-red" data-help-name="file in">
<p>Reads the specified file and sends the content as <code>msg.payload</code>,
and the filename as <code>msg.filename</code>.</p>
<p>Reads the contents of a file as either a string or binary buffer.</p>
<h3>Inputs</h3>
<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>
<dd>if not set in the node configuration, this property sets the filename to read.</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>
<dd>The contents of the file as either a string or binary buffer.</dd>
<dt class="optional">filename <span class="property-type">string</span></dt>
<dd>If not configured in the node, this optional property sets the name of the file to be read.</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>
<p>The filename should be an absolute path, otherwise it will be relative to
the working directory of the Node-RED process.</p>
<p>On Windows, path separators may need to be escaped, for example: <code>\\Users\\myUser</code>.</p>
</script>
<script type="text/javascript">
@@ -110,8 +112,8 @@
},
oneditprepare: function() {
$("#node-input-overwriteFile").on("change",function() {
if (this.value === "delete") { $("#node-appline").hide(); }
else { $("#node-appline").show(); }
if (this.value === "delete") { $(".form-row-file-write-options").hide(); }
else { $(".form-row-file-write-options").show(); }
});
}
});