Tidy up parser node edit dialogs and help text

This commit is contained in:
Nick O'Leary
2017-05-23 14:18:09 +01:00
parent 7978f85f7a
commit 749b0d7019
6 changed files with 123 additions and 74 deletions

View File

@@ -24,26 +24,30 @@
</div>
<hr align="middle"/>
<div class="form-row">
<label style="width:100%;"><i class="fa fa-gears"></i> <span data-i18n="csv.label.c2o"></span></label>
<label style="margin-left:16px; margin-right:-16px;"><i class="fa fa-sign-in"></i> <span data-i18n="csv.label.input"></span></label>
<input style="width:30px" type="checkbox" id="node-input-hdrin"><label style="width: auto;" for="node-input-hdrin"><span data-i18n="csv.label.firstrow"></span>
<label style="width:100%; border-bottom: 1px solid #eee;"><span data-i18n="csv.label.c2o"></span></label>
</div>
<div class="form-row">
<label style="margin-left:16px; margin-right:-16px;"><i class="fa fa-sign-out"></i> <span data-i18n="csv.label.output"></span></label>
<div class="form-row" style="padding-left: 20px;">
<label><i class="fa fa-sign-in"></i> <span data-i18n="csv.label.input"></span></label>
<input style="width:20px; vertical-align:top; margin-right: 5px;" type="checkbox" id="node-input-hdrin"><label style="width: auto;" for="node-input-hdrin"><span data-i18n="csv.label.firstrow"></span>
</div>
<div class="form-row" style="padding-left: 20px;">
<label><i class="fa fa-sign-out"></i> <span data-i18n="csv.label.output"></span></label>
<select type="text" id="node-input-multi" style="width: 250px;">
<option value="one" data-i18n="csv.output.row"></option>
<option value="mult" data-i18n="csv.output.array"></option>
</select>
</div>
<hr align="middle"/>
<div class="form-row">
<label style="width:100%;"><i class="fa fa-gears"></i> <span data-i18n="csv.label.o2c"></span></label>
<label style="margin-left:16px; margin-right:-16px;"><i class="fa fa-sign-in"></i> <span data-i18n="csv.label.output"></span></label>
<input style="width:30px" type="checkbox" id="node-input-hdrout"><label style="width:auto;" for="node-input-hdrout"><span data-i18n="csv.label.includerow"></span></span>
<div class="form-row" style="margin-top: 20px">
<label style="width:100%; border-bottom: 1px solid #eee;"><span data-i18n="csv.label.o2c"></span></label>
</div>
<div class="form-row">
<label style="margin-left:16px; margin-right:-16px;"><i class="fa fa-align-left"></i> <span data-i18n="csv.label.newline"></span></label>
<select style="width:150px" id="node-input-ret">
<div class="form-row" style="padding-left: 20px;">
<label><i class="fa fa-sign-in"></i> <span data-i18n="csv.label.output"></span></label>
<input style="width:20px; vertical-align:top; margin-right: 5px;" type="checkbox" id="node-input-hdrout"><label style="width:auto;" for="node-input-hdrout"><span data-i18n="csv.label.includerow"></span></span>
</div>
<div class="form-row" style="padding-left: 20px;">
<label></label>
<label style="width: auto; margin-right: 10px;" for="node-input-ret"><span data-i18n="csv.label.newline"></span></label>
<select style="width:150px;" id="node-input-ret">
<option value='\n' data-i18n="csv.newline.linux"></option>
<option value='\r' data-i18n="csv.newline.mac"></option>
<option value='\r\n' data-i18n="csv.newline.windows"></option>
@@ -52,20 +56,31 @@
</script>
<script type="text/x-red" data-help-name="csv">
<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>
<p>Converts between a CSV formatted string and its JavaScript object representation, in either direction.</p>
<h3>Inputs</h3>
<ul>
<li>If the input is a string it tries to parse it as CSV and creates a javascript object.</li>
<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>
<dl class="message-properties">
<dt>payload<span class="property-type">object | array | string</span></dt>
<dd>A JavaScript object, array or CSV string.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">object | array | string</span></dt>
<dd>
<ul>
<li>If the input is a string it tries to parse it as CSV and creates a JavaScript object of key/value pairs for each line.
The node will then either send a message for each line, or a single message containing an array of objects.</li>
<li>If the input is a JavaScript object it tries to build a CSV string.</li>
<li>If the input is an array of simple values, it builds a single line CSV string.</li>
<li>If the input is an array of arrays, or an array of objects, a multiple-line CSV string is created.</li>
</ul>
</dd>
</dl>
<h3>Details</h3>
<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>
<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><b>Note:</b> the columns should always be specified comma separated - even if another separator is chosen for the data.</p>
<p>The column template can contain an ordered list of column names. When converting CSV to an object, the column names
will be used as the property names. Alternatively, the column names can be taken from the first row of the CSV.</p>
<p>When converting to CSV, the column template is used to identify which properties to extract from the object and in what order.</p>
<p>If the input is an array then the columns template is only used to optionally generate a row of column titles.</p>
<p><b>Note:</b> the column template must be comma separated - even if a different separator is chosen for the data.</p>
</script>
<script type="text/javascript">