mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix serial config node edit layout
This commit is contained in:
parent
3cb423a0b4
commit
a477c0b827
@ -153,34 +153,61 @@
|
||||
</tr></table><br/>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-out"><i class="fa fa-cut"></i> Split input</label>
|
||||
<select type="text" id="node-config-input-out" style="width:52%;">
|
||||
<option value="char">when character received is</option>
|
||||
<option value="time">after a fixed timeout of</option>
|
||||
<option value="count">a fixed number of characters</option>
|
||||
<label><i class="fa fa-sign-in"></i> Input</label>
|
||||
</div>
|
||||
<div class="form-row" style="padding-left: 10px;">
|
||||
Split input
|
||||
<select type="text" id="node-config-input-out" style="margin-left: 5px; width:200px;">
|
||||
<option value="char">on the character</option>
|
||||
<option value="time">after a timeout of</option>
|
||||
<option value="count">into fixed lengths of</option>
|
||||
</select>
|
||||
<input type="text" id="node-config-input-newline" style="width:50px;">
|
||||
<span id="node-units"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-bin"><i class="fa fa-sign-in"></i> and deliver</label>
|
||||
<select type="text" id="node-config-input-bin" style="width: 77%;">
|
||||
<div class="form-row" style="padding-left: 10px;">
|
||||
and deliver
|
||||
<select type="text" id="node-config-input-bin" style="margin-left: 5px; width: 150px;">
|
||||
<option value="false">ascii strings</option>
|
||||
<option value="bin">binary buffers</option>
|
||||
</select>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-row" id="node-config-addchar">
|
||||
<label for="node-config-input-addchar"><i class="fa fa-sign-out"></i> On output</label>
|
||||
<select type="text" id="node-config-input-addchar" style="width: 77%;">
|
||||
<option value="false">don't add 'split' character to output messages</option>
|
||||
<option value="true">add 'split' character to output messages</option>
|
||||
</select>
|
||||
<div id="node-config-addchar">
|
||||
<div class="form-row">
|
||||
<label><i class="fa fa-sign-out"></i> Output</label>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<input style="width: 30px;margin-left: 10px; vertical-align: top;" type="checkbox" id="node-config-input-addchar"><label style="width: auto;" for="node-config-input-addchar">add split character to output messages</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-tips" id="tip-split">Tip: the "Split on" character is used to split the input into separate messages. It can also be added to every message sent out to the serial port.</div>
|
||||
<div class="form-tips" id="tip-bin" hidden>Tip: In timeout mode timeout starts from arrival of first character.</div>
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('serial-port',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
//name: {value:""},
|
||||
serialport: {value:"",required:true},
|
||||
serialbaud: {value:57600,required:true},
|
||||
databits: {value:8,required:true},
|
||||
parity: {value:"none",required:true},
|
||||
stopbits: {value:1,required:true},
|
||||
newline: {value:"\\n"},
|
||||
bin: {value:"false"},
|
||||
out: {value:"char"},
|
||||
addchar: {value:false}
|
||||
},
|
||||
label: function() {
|
||||
this.serialbaud = this.serialbaud || 57600;
|
||||
this.databits = this.databits || 8;
|
||||
this.parity = this.parity || 'none';
|
||||
this.stopbits = this.stopbits || 1;
|
||||
return this.serialport+":"+this.serialbaud+"-"+this.databits+this.parity.charAt(0).toUpperCase()+this.stopbits;
|
||||
},
|
||||
oneditprepare: function() {
|
||||
var previous = null;
|
||||
$("#node-config-input-out").on('focus', function () { previous = this.value; }).change(function() {
|
||||
if (previous == null) { previous = $("#node-config-input-out").val(); }
|
||||
@ -200,7 +227,7 @@
|
||||
$("#tip-bin").show();
|
||||
}
|
||||
else {
|
||||
if (previous != "count") { $("#node-config-input-newline").val("12"); }
|
||||
if (previous != "count") { $("#node-config-input-newline").val(""); }
|
||||
$("#node-units").text("chars");
|
||||
$("#node-config-addchar").hide();
|
||||
$("#node-config-input-addchar").val("false");
|
||||
@ -209,32 +236,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('serial-port',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
//name: {value:""},
|
||||
serialport: {value:"",required:true},
|
||||
serialbaud: {value:57600,required:true},
|
||||
databits: {value:8,required:true},
|
||||
parity: {value:"none",required:true},
|
||||
stopbits: {value:1,required:true},
|
||||
newline: {value:"\\n"},
|
||||
bin: {value:""},
|
||||
out: {value:""},
|
||||
addchar: {value:false}
|
||||
},
|
||||
label: function() {
|
||||
this.serialbaud = this.serialbaud || 57600;
|
||||
this.databits = this.databits || 8;
|
||||
this.parity = this.parity || 'none';
|
||||
this.stopbits = this.stopbits || 1;
|
||||
return this.serialport+":"+this.serialbaud+"-"+this.databits+this.parity.charAt(0).toUpperCase()+this.stopbits;
|
||||
},
|
||||
oneditprepare: function() {
|
||||
try {
|
||||
$("#node-config-input-serialport").autocomplete( "destroy" );
|
||||
} catch(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user