addec checkbox for autoconnect, fixed default reconnection

This commit is contained in:
htmltiger 2023-06-23 02:30:13 +01:00 committed by GitHub
parent 0c0f45b8f5
commit 64f12e8316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,12 +213,14 @@
</div> </div>
<div class="form-row" style="padding-left:18px; margin-bottom:18px;"> <div class="form-row" style="padding-left:18px; margin-bottom:18px;">
<span data-i18n="serial.label.responsetimeout"></span> <span data-i18n="serial.label.responsetimeout"></span>
<input type="text" id="node-config-input-responsetimeout" style="width:120px; height:28px;"> <input type="text" id="node-config-input-responsetimeout" style="width:90px; height:28px;">
<span data-i18n="serial.label.ms"></span> <span data-i18n="serial.label.ms"></span>
</div> </div>
<div class="form-row" style="padding-left:18px; margin-bottom:18px;"> <div class="form-row" style="margin-bottom:18px;">
<input type="checkbox" id="node-config-input-autoConnect" style="width:auto; margin-bottom: 4px;"/>
<label for="node-config-input-autoConnect"><span data-i18n="serial.label.autoconnect"></span></label>
<span data-i18n="serial.label.serialReconnectTime"></span> <span data-i18n="serial.label.serialReconnectTime"></span>
<input type="number" id="node-config-input-serialReconnectTime" style="width:120px; height:28px;"> <input type="number" id="node-config-input-serialReconnectTime" style="width:90px; height:28px;">
<span data-i18n="serial.label.ms"></span> <span data-i18n="serial.label.ms"></span>
</div> </div>
</div> </div>
@ -251,7 +253,8 @@
out: {value:"char"}, out: {value:"char"},
addchar: {value:""}, addchar: {value:""},
responsetimeout: {value: 10000}, responsetimeout: {value: 10000},
serialReconnectTime: {value: 15000} serialReconnectTime: {value: ""},
autoConnect: {value: true}
}, },
label: function() { label: function() {
this.serialbaud = this.serialbaud || 57600; this.serialbaud = this.serialbaud || 57600;
@ -261,6 +264,8 @@
return this.serialport+":"+this.serialbaud+"-"+this.databits+this.parity.charAt(0).toUpperCase()+this.stopbits; return this.serialport+":"+this.serialbaud+"-"+this.databits+this.parity.charAt(0).toUpperCase()+this.stopbits;
}, },
oneditprepare: function() { oneditprepare: function() {
if(typeof this.autoConnect === "undefined"){ this.autoConnect = true; }
var previous = null; var previous = null;
var blist = [ var blist = [
{value:"230400",label:"230400",hasValue:false}, {value:"230400",label:"230400",hasValue:false},
@ -357,6 +362,7 @@
}).autocomplete("search",""); }).autocomplete("search","");
}); });
}); });
}, },
oneditsave: function() { oneditsave: function() {
var mytype = $("#node-config-input-serialbaud").typedInput('type'); var mytype = $("#node-config-input-serialbaud").typedInput('type');