Add some info words to config nodes

This commit is contained in:
Dave Conway-Jones 2016-06-04 09:04:58 +01:00
parent d125ecc671
commit ea76c18f59
2 changed files with 26 additions and 23 deletions

View File

@ -227,9 +227,13 @@
</div> </div>
</div> </div>
</div> </div>
</script>
<script type="text/x-red" data-help-name="mqtt-broker">
<p>A minimum MQTT broker connecton requires only a broker server address to be added to the default configuration.</p>
<p>To secure the connection with SSL/TLS, a TLS Configuration must also be configured and selected.</p>
<p>If you create a Client ID it must be unique to the broker you are connecting to.</p>
<p>For more information about MQTT see the <a href="http://www.eclipse.org/paho/" target="_new">Eclipse Paho</a> site.</p>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
@ -239,14 +243,14 @@
broker: {value:"",required:true}, broker: {value:"",required:true},
port: {value:1883,required:true,validate:RED.validators.number()}, port: {value:1883,required:true,validate:RED.validators.number()},
tls: {type:"tls-config",required: false}, tls: {type:"tls-config",required: false},
clientid: { value:"", validate: function(v) { clientid: {value:"", validate: function(v) {
if ($("#node-config-input-clientid").length) { if ($("#node-config-input-clientid").length) {
// Currently editing the node // Currently editing the node
return $("#node-config-input-cleansession").is(":checked") || v.length > 0; return $("#node-config-input-cleansession").is(":checked") || v.length > 0;
} else { } else {
return this.cleansession || v.length > 0; return this.cleansession || v.length > 0;
} }
}}, }},
usetls: {value: false}, usetls: {value: false},
verifyservercert: { value: false}, verifyservercert: { value: false},
compatmode: { value: true}, compatmode: { value: true},
@ -266,7 +270,7 @@
password: {type: "password"} password: {type: "password"}
}, },
label: function() { label: function() {
if (this.broker == "") { this.broker = "localhost"; } if (this.broker === "") { this.broker = "localhost"; }
return (this.clientid?this.clientid+"@":"")+this.broker+":"+this.port; return (this.clientid?this.clientid+"@":"")+this.broker+":"+this.port;
}, },
oneditprepare: function () { oneditprepare: function () {
@ -298,15 +302,15 @@
this.cleansession = true; this.cleansession = true;
$("#node-config-input-cleansession").prop("checked",true); $("#node-config-input-cleansession").prop("checked",true);
} }
if (typeof this.usetls === 'undefined'){ if (typeof this.usetls === 'undefined') {
this.usetls = false; this.usetls = false;
$("#node-config-input-usetls").prop("checked",false); $("#node-config-input-usetls").prop("checked",false);
} }
if (typeof this.compatmode === 'undefined'){ if (typeof this.compatmode === 'undefined') {
this.compatmode = true; this.compatmode = true;
$("#node-config-input-compatmode").prop('checked', true); $("#node-config-input-compatmode").prop('checked', true);
} }
if (typeof this.keepalive === 'undefined'){ if (typeof this.keepalive === 'undefined') {
this.keepalive = 15; this.keepalive = 15;
$("#node-config-input-keepalive").val(this.keepalive); $("#node-config-input-keepalive").val(this.keepalive);
} }

View File

@ -49,8 +49,8 @@
function ws_oneditprepare() { function ws_oneditprepare() {
$("#websocket-client-row").hide(); $("#websocket-client-row").hide();
$("#node-input-mode").change(function(){ $("#node-input-mode").change(function() {
if( $("#node-input-mode").val() === 'client') { if ( $("#node-input-mode").val() === 'client') {
$("#websocket-server-row").hide(); $("#websocket-server-row").hide();
$("#websocket-client-row").show(); $("#websocket-client-row").show();
} }
@ -60,7 +60,7 @@
} }
}); });
if(this.client) { if (this.client) {
$("#node-input-mode").val('client').change(); $("#node-input-mode").val('client').change();
} }
else { else {
@ -69,7 +69,7 @@
} }
function ws_oneditsave() { function ws_oneditsave() {
if($("#node-input-mode").val() === 'client') { if ($("#node-input-mode").val() === 'client') {
$("#node-input-server").append('<option value="">Dummy</option>'); $("#node-input-server").append('<option value="">Dummy</option>');
$("#node-input-server").val(''); $("#node-input-server").val('');
} }
@ -86,7 +86,7 @@
} }
function ws_validateserver() { function ws_validateserver() {
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) { if ($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
return true; return true;
} }
else { else {
@ -95,7 +95,7 @@
} }
function ws_validateclient() { function ws_validateclient() {
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) { if ($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
return RED.nodes.node(this.client) != null; return RED.nodes.node(this.client) != null;
} }
else { else {
@ -167,7 +167,7 @@
if (root.slice(-1) == "/") { if (root.slice(-1) == "/") {
root = root.slice(0,-1); root = root.slice(0,-1);
} }
if (root == "") { if (root === "") {
$("#node-config-ws-tip").hide(); $("#node-config-ws-tip").hide();
} else { } else {
$("#node-config-ws-path").html(root); $("#node-config-ws-path").html(root);
@ -248,7 +248,7 @@
</script> </script>
<script type="text/x-red" data-help-name="websocket-listener"> <script type="text/x-red" data-help-name="websocket-listener">
<p>This configuration node creates a WebSocket Server using the specified path</p> <p>This configuration node creates a WebSocket Server endpoint using the specified path.</p>
</script> </script>
<!-- WebSocket Client configuration node --> <!-- WebSocket Client configuration node -->
@ -273,4 +273,3 @@
<script type="text/x-red" data-help-name="websocket-client"> <script type="text/x-red" data-help-name="websocket-client">
<p>This configuration node connects a WebSocket client to the specified URL.</p> <p>This configuration node connects a WebSocket client to the specified URL.</p>
</script> </script>