2013-09-05 16:02:48 +02:00
|
|
|
<!--
|
2017-01-11 16:24:33 +01:00
|
|
|
Copyright JS Foundation and other contributors, http://js.foundation
|
2013-09-05 16:02:48 +02:00
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2020-10-08 21:24:35 +02:00
|
|
|
<style>
|
|
|
|
.form-row label:first-child {
|
|
|
|
width: 125px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mqtt-form-row-cols2 > input.mqtt-form-row-col1 {
|
|
|
|
width: calc(35% - 75px);
|
|
|
|
}
|
|
|
|
.mqtt-form-row-cols2 > select.mqtt-form-row-col1 {
|
|
|
|
width: calc(35% - 75px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.mqtt-form-row-cols2 > label.mqtt-form-row-col2 {
|
|
|
|
width: 100px;
|
|
|
|
margin-left: 42px;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
.mqtt-form-row-cols2 > input.mqtt-form-row-col2 {
|
|
|
|
width: calc(35% - 75px);
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
.mqtt-form-row-cols2 > select.mqtt-form-row-col2 {
|
|
|
|
width: calc(35% - 75px);
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-row.mqtt-flags-row > label {
|
|
|
|
vertical-align: top;
|
|
|
|
}
|
|
|
|
.form-row.mqtt-flags-row > .mqtt-flags {
|
|
|
|
display: inline-block;
|
|
|
|
width: 70%
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-row.mqtt-flags-row > .mqtt-flags > .mqtt-flag > label {
|
|
|
|
display: block;
|
|
|
|
padding-left: 15px;
|
|
|
|
text-indent: -15px;
|
|
|
|
width: 70%;
|
|
|
|
}
|
|
|
|
.form-row.mqtt-flags-row > .mqtt-flags > .mqtt-flag > label > input {
|
|
|
|
position: relative;
|
|
|
|
vertical-align: bottom;
|
|
|
|
top: -2px;
|
|
|
|
width: 15px;
|
|
|
|
height: 15px;
|
|
|
|
}
|
|
|
|
</style>
|
2013-09-05 16:02:48 +02:00
|
|
|
|
2020-01-15 03:40:48 +01:00
|
|
|
<script type="text/html" data-template-name="mqtt in">
|
2013-09-05 16:02:48 +02:00
|
|
|
<div class="form-row">
|
2015-05-10 22:47:22 +02:00
|
|
|
<label for="node-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
2013-09-05 16:02:48 +02:00
|
|
|
<input type="text" id="node-input-broker">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-05-10 22:47:22 +02:00
|
|
|
<label for="node-input-topic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
2015-05-26 22:11:14 +02:00
|
|
|
<input type="text" id="node-input-topic" data-i18n="[placeholder]common.label.topic">
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
2016-04-10 19:51:45 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-qos"><i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
|
|
|
<select id="node-input-qos" style="width:125px !important">
|
|
|
|
<option value="0">0</option>
|
|
|
|
<option value="1">1</option>
|
|
|
|
<option value="2">2</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-userProperties"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.userProperties"></span></label>
|
2020-10-08 21:24:35 +02:00
|
|
|
<input id="node-input-userPropertiesType" type="hidden">
|
2020-10-15 00:30:03 +02:00
|
|
|
<input type="text" id="node-input-userProperties" style="width: 70%;" data-i18n="[placeholder]mqtt.label.userProperties" placeholder="">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-subscriptionIdentifier" class="mqtt-form-row-col1"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.subscriptionIdentifier"></span></label>
|
2020-10-08 21:24:35 +02:00
|
|
|
<input type="number" min="0" max="268435455" id="node-input-subscriptionIdentifier" class="mqtt-form-row-col1" >
|
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt-flags-row mqtt5">
|
2020-10-08 21:24:35 +02:00
|
|
|
<label for="node-input-nl" ><i class="fa fa-flag"></i> <span data-i18n="mqtt.label.flags">Flags</span></label>
|
|
|
|
<div class="mqtt-flags">
|
|
|
|
<div class="mqtt-flag">
|
|
|
|
<label for="node-input-nl">
|
|
|
|
<input type="checkbox" id="node-input-nl">
|
2020-10-15 00:30:03 +02:00
|
|
|
<span data-i18n="mqtt.label.nl"></span>
|
2020-10-08 21:24:35 +02:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="mqtt-flag">
|
|
|
|
<label for="node-input-rap">
|
|
|
|
<input type="checkbox" id="node-input-rap">
|
2020-10-15 00:30:03 +02:00
|
|
|
<span data-i18n="mqtt.label.rap"></span>
|
2020-10-08 21:24:35 +02:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-rh" ><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.rh"></span></label>
|
|
|
|
<select id="node-input-rh" style="width:70%;">
|
|
|
|
<option value="0" data-i18n="mqtt.label.rh0"></option>
|
|
|
|
<option value="1" data-i18n="mqtt.label.rh1"></option>
|
|
|
|
<option value="2" data-i18n="mqtt.label.rh2"></option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2018-10-11 21:22:44 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-datatype"><i class="fa fa-sign-out"></i> <span data-i18n="mqtt.label.output"></span></label>
|
|
|
|
<select id="node-input-datatype" style="width:70%;">
|
2018-10-29 15:10:04 +01:00
|
|
|
<option value="auto" data-i18n="mqtt.output.auto"></option>
|
2018-10-11 21:22:44 +02:00
|
|
|
<option value="buffer" data-i18n="mqtt.output.buffer"></option>
|
|
|
|
<option value="utf8" data-i18n="mqtt.output.string"></option>
|
2019-02-04 17:35:42 +01:00
|
|
|
<option value="json" data-i18n="mqtt.output.json"></option>
|
2018-10-29 15:10:04 +01:00
|
|
|
<option value="base64" data-i18n="mqtt.output.base64"></option>
|
2018-10-11 21:22:44 +02:00
|
|
|
</select>
|
|
|
|
</div>
|
2013-09-05 16:02:48 +02:00
|
|
|
<div class="form-row">
|
2015-05-10 22:47:22 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
2015-05-26 22:11:14 +02:00
|
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('mqtt in',{
|
2019-08-21 15:21:19 +02:00
|
|
|
category: 'network',
|
2013-09-05 16:02:48 +02:00
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
2016-02-10 23:38:59 +01:00
|
|
|
topic: {value:"",required:true,validate: RED.validators.regex(/^(#$|(\+|[^+#]*)(\/(\+|[^+#]*))*(\/(\+|#|[^+#]*))?$)/)},
|
2016-04-10 19:51:45 +02:00
|
|
|
qos: {value: "2"},
|
2018-10-29 15:10:04 +01:00
|
|
|
datatype: {value:"auto",required:true},
|
2020-10-15 00:30:03 +02:00
|
|
|
broker: {type:"mqtt-broker", required:true},
|
|
|
|
userPropertiesType: {value:"json"},
|
|
|
|
userProperties: {value:"{}"},
|
2020-10-08 21:24:35 +02:00
|
|
|
subscriptionIdentifier: {value:0},
|
|
|
|
nl: {value:false},
|
2020-10-15 00:30:03 +02:00
|
|
|
rap: {value:true},
|
2020-10-25 10:50:57 +01:00
|
|
|
rh: {value:0},
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
2014-01-08 17:44:47 +01:00
|
|
|
color:"#d8bfd8",
|
2013-09-05 16:02:48 +02:00
|
|
|
inputs:0,
|
|
|
|
outputs:1,
|
2019-06-21 13:36:20 +02:00
|
|
|
icon: "bridge.svg",
|
2013-09-05 16:02:48 +02:00
|
|
|
label: function() {
|
2013-09-27 11:38:59 +02:00
|
|
|
return this.name||this.topic||"mqtt";
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2016-04-10 19:51:45 +02:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
2020-10-15 00:30:03 +02:00
|
|
|
$("#node-input-broker").change(function(d){
|
|
|
|
var confNode = RED.nodes.node($("#node-input-broker").val());
|
|
|
|
var v5 = confNode && confNode.protocolVersion == "5";
|
|
|
|
if(v5) {
|
|
|
|
$(".mqtt5").show();
|
|
|
|
} else {
|
|
|
|
$(".mqtt5").hide();
|
|
|
|
}
|
|
|
|
});
|
2016-04-10 19:51:45 +02:00
|
|
|
if (this.qos === undefined) {
|
|
|
|
$("#node-input-qos").val("2");
|
|
|
|
}
|
2018-10-11 21:22:44 +02:00
|
|
|
if (this.datatype === undefined) {
|
2018-10-29 15:10:04 +01:00
|
|
|
$("#node-input-datatype").val("auto");
|
2018-10-11 21:22:44 +02:00
|
|
|
}
|
2020-10-08 21:24:35 +02:00
|
|
|
$("#node-input-userProperties").typedInput({
|
2020-10-15 00:30:03 +02:00
|
|
|
default: "json",
|
|
|
|
types:['json','flow','global'],
|
2020-10-08 21:24:35 +02:00
|
|
|
typeField: $("#node-input-userPropertiesType")
|
|
|
|
});
|
2013-09-05 16:02:48 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-01-15 03:40:48 +01:00
|
|
|
<script type="text/html" data-template-name="mqtt out">
|
2013-09-05 16:02:48 +02:00
|
|
|
<div class="form-row">
|
2015-05-10 22:47:22 +02:00
|
|
|
<label for="node-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
2013-09-05 16:02:48 +02:00
|
|
|
<input type="text" id="node-input-broker">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-05-10 22:47:22 +02:00
|
|
|
<label for="node-input-topic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
2015-05-26 22:11:14 +02:00
|
|
|
<input type="text" id="node-input-topic" data-i18n="[placeholder]common.label.topic">
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
2020-10-08 21:24:35 +02:00
|
|
|
|
|
|
|
<div class="form-row mqtt-form-row-cols2">
|
|
|
|
<label for="node-input-qos" class="mqtt-form-row-col1"><i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
|
|
|
<select id="node-input-qos" class="mqtt-form-row-col1">
|
2014-08-22 13:42:07 +02:00
|
|
|
<option value=""></option>
|
|
|
|
<option value="0">0</option>
|
|
|
|
<option value="1">1</option>
|
|
|
|
<option value="2">2</option>
|
|
|
|
</select>
|
2020-10-08 21:24:35 +02:00
|
|
|
|
|
|
|
<label for="node-input-retain" class="mqtt-form-row-col2"><i class="fa fa-history"></i> <span data-i18n="mqtt.retain"></span></label>
|
|
|
|
<select id="node-input-retain" class="mqtt-form-row-col2" >
|
2014-08-22 13:42:07 +02:00
|
|
|
<option value=""></option>
|
2015-05-10 22:47:22 +02:00
|
|
|
<option value="false" data-i18n="mqtt.false"></option>
|
|
|
|
<option value="true" data-i18n="mqtt.true"></option>
|
2014-08-22 13:42:07 +02:00
|
|
|
</select>
|
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-responseTopic"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.responseTopic"></span></label>
|
|
|
|
<input type="text" id="node-input-responseTopic" data-i18n="[placeholder]mqtt.label.responseTopic" placeholder="">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-correlationData"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.correlationData"></span></label>
|
2020-10-08 21:24:35 +02:00
|
|
|
<input id="node-input-correlationDataType" type="hidden">
|
2020-10-15 00:30:03 +02:00
|
|
|
<input type="text" id="node-input-correlationData" style="width: 70%;" data-i18n="[placeholder]mqtt.label.correlationData" placeholder="">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-userProperties"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.userProperties"></span></label>
|
|
|
|
<input id="node-input-userPropertiesType" type="hidden">
|
|
|
|
<input type="text" id="node-input-userProperties" style="width: 70%;" data-i18n="[placeholder]mqtt.label.userProperties" placeholder="">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-contentType"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.contentType"></span></label>
|
|
|
|
<input type="text" id="node-input-contentType" data-i18n="[placeholder]mqtt.label.contentType" placeholder="">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
|
|
|
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt-form-row-cols2 mqtt5">
|
|
|
|
<label for="node-input-messageExpiryInterval" class="mqtt-form-row-col1"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.messageExpiryInterval"></span></label>
|
2020-10-08 21:24:35 +02:00
|
|
|
<input type="number" min="0" id="node-input-messageExpiryInterval" class="mqtt-form-row-col1" >
|
|
|
|
|
|
|
|
<label for="node-input-topicAlias" class="mqtt-form-row-col2"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.topicAlias">Alias</span></label>
|
|
|
|
<input type="number" min="0" id="node-input-topicAlias" class="mqtt-form-row-col2" >
|
|
|
|
</div>
|
|
|
|
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt-form-row-cols2 mqtt5">
|
|
|
|
<label for="node-input-subscriptionIdentifier" class="mqtt-form-row-col1"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.subscriptionIdentifier"></span></label>
|
2020-10-08 21:24:35 +02:00
|
|
|
<input type="number" min="0" max="268435455" id="node-input-subscriptionIdentifier" class="mqtt-form-row-col1" >
|
|
|
|
|
2020-10-15 00:30:03 +02:00
|
|
|
<label for="node-input-payloadFormatIndicator" class="mqtt-form-row-col2"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.payloadFormatIndicator"></span></label>
|
2020-10-08 21:24:35 +02:00
|
|
|
<select id="node-input-payloadFormatIndicator" class="mqtt-form-row-col2" >
|
|
|
|
<option value=""></option>
|
2020-10-15 00:30:03 +02:00
|
|
|
<option value="false" data-i18n="mqtt.label.payloadFormatIndicatorFalse"></option>
|
|
|
|
<option value="true" data-i18n="mqtt.label.payloadFormatIndicatorTrue"></option>
|
2020-10-08 21:24:35 +02:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
2013-09-05 16:02:48 +02:00
|
|
|
<div class="form-row">
|
2015-05-10 22:47:22 +02:00
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
2015-05-26 22:11:14 +02:00
|
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
2015-05-10 22:47:22 +02:00
|
|
|
<div class="form-tips"><span data-i18n="mqtt.tip"></span></div>
|
2013-09-05 16:02:48 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('mqtt out',{
|
2019-08-21 15:21:19 +02:00
|
|
|
category: 'network',
|
2013-09-05 16:02:48 +02:00
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
|
|
|
topic: {value:""},
|
2014-08-22 13:42:07 +02:00
|
|
|
qos: {value:""},
|
|
|
|
retain: {value:""},
|
2020-10-08 21:24:35 +02:00
|
|
|
responseTopic: {value:""},
|
|
|
|
contentType: {value:""},
|
|
|
|
userProperties: {value:'userProperties'},
|
2020-10-15 00:30:03 +02:00
|
|
|
userPropertiesType: {value:'msg'},
|
2020-10-08 21:24:35 +02:00
|
|
|
correlationData: {value:'correlationData'},
|
2020-10-15 00:30:03 +02:00
|
|
|
correlationDataType: {value:'msg'},
|
2020-10-08 21:24:35 +02:00
|
|
|
topicAlias: {value:0},
|
|
|
|
messageExpiryInterval: {value:0},
|
|
|
|
payloadFormatIndicator: {value:false},
|
|
|
|
subscriptionIdentifier: {value:0},
|
2013-09-05 16:02:48 +02:00
|
|
|
broker: {type:"mqtt-broker", required:true}
|
|
|
|
},
|
2014-01-08 17:44:47 +01:00
|
|
|
color:"#d8bfd8",
|
2013-09-05 16:02:48 +02:00
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
2019-06-21 13:36:20 +02:00
|
|
|
icon: "bridge.svg",
|
2013-09-05 16:02:48 +02:00
|
|
|
align: "right",
|
|
|
|
label: function() {
|
2020-12-07 10:41:43 +01:00
|
|
|
return this.name||this.topic||(this.topicAlias ? "@"+this.topicAlias : "mqtt");
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
2020-10-08 21:24:35 +02:00
|
|
|
oneditprepare: function() {
|
2020-10-15 00:30:03 +02:00
|
|
|
$("#node-input-broker").change(function(d){
|
|
|
|
var confNode = RED.nodes.node($("#node-input-broker").val());
|
|
|
|
var v5 = confNode && confNode.protocolVersion == "5";
|
|
|
|
if(v5) {
|
|
|
|
$(".mqtt5").show();
|
|
|
|
} else {
|
|
|
|
$(".mqtt5").hide();
|
|
|
|
}
|
|
|
|
});
|
2020-10-08 21:24:35 +02:00
|
|
|
$("#node-input-correlationData").typedInput({
|
|
|
|
default: "none",
|
2020-10-15 00:30:03 +02:00
|
|
|
types:[{ value:"none", label: "None", hasValue:false },'bin','msg','flow','global'],
|
2020-10-08 21:24:35 +02:00
|
|
|
typeField: $("#node-input-correlationDataType")
|
|
|
|
});
|
|
|
|
$("#node-input-userProperties").typedInput({
|
2020-10-15 00:30:03 +02:00
|
|
|
default: "msg",
|
|
|
|
types:['msg','flow','global','json'],
|
2020-10-08 21:24:35 +02:00
|
|
|
typeField: $("#node-input-userPropertiesType")
|
|
|
|
});
|
|
|
|
},
|
2013-09-05 16:02:48 +02:00
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-01-15 03:40:48 +01:00
|
|
|
<script type="text/html" data-template-name="mqtt-broker">
|
2017-08-09 23:22:40 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
|
|
<input type="text" id="node-config-input-name" data-i18n="[placeholder]common.label.name">
|
|
|
|
</div>
|
2015-06-03 08:54:43 +02:00
|
|
|
<div class="form-row">
|
2019-05-15 14:54:29 +02:00
|
|
|
<ul style="min-width: 600px; margin-bottom: 20px;" id="node-config-mqtt-broker-tabs"></ul>
|
2013-11-25 23:50:08 +01:00
|
|
|
</div>
|
2020-01-01 22:32:56 +01:00
|
|
|
<div id="node-config-mqtt-broker-tabs-content" style="min-height:150px;">
|
2015-09-01 23:30:15 +02:00
|
|
|
<div id="mqtt-broker-tab-connection" style="display:none">
|
|
|
|
<div class="form-row node-input-broker">
|
|
|
|
<label for="node-config-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
2019-05-15 14:54:29 +02:00
|
|
|
<input type="text" id="node-config-input-broker" style="width:40%;" data-i18n="[placeholder]mqtt.label.example">
|
2017-07-19 14:50:34 +02:00
|
|
|
<label for="node-config-input-port" style="margin-left:20px; width:43px; "> <span data-i18n="mqtt.label.port"></span></label>
|
2017-02-14 21:59:52 +01:00
|
|
|
<input type="text" id="node-config-input-port" data-i18n="[placeholder]mqtt.label.port" style="width:55px">
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
2016-04-27 13:31:54 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<input type="checkbox" id="node-config-input-usetls" style="display: inline-block; width: auto; vertical-align: top;">
|
|
|
|
<label for="node-config-input-usetls" style="width: auto" data-i18n="mqtt.label.use-tls"></label>
|
|
|
|
<div id="node-config-row-tls" class="hide">
|
|
|
|
<label style="width: auto; margin-left: 20px; margin-right: 10px;" for="node-config-input-tls"><span data-i18n="mqtt.label.tls-config"></span></label><input style="width: 300px;" type="text" id="node-config-input-tls">
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-09-01 23:30:15 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-clientid"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.clientid"></span></label>
|
|
|
|
<input type="text" id="node-config-input-clientid" data-i18n="[placeholder]mqtt.placeholder.clientid">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-keepalive" style="width: auto"><i class="fa fa-clock-o"></i> <span data-i18n="mqtt.label.keepalive"></span></label>
|
|
|
|
<input type="text" id="node-config-input-keepalive" style="width: 50px">
|
2020-10-15 00:30:03 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt-form-row-cols2">
|
|
|
|
<label for="node-config-input-cleansession" class="mqtt-form-row-col1"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.session"></span>Session</label>
|
|
|
|
<div class="mqtt-flag mqtt-form-row-col1" style="display: inline-block;width: calc(35% - 75px);">
|
|
|
|
<label for="node-config-input-cleansession" style="display: block; padding-left: 15px; text-indent: -15px;">
|
|
|
|
<input type="checkbox" id="node-config-input-cleansession" style="position: relative;vertical-align: bottom; top: -2px; width: 15px;height: 15px;">
|
|
|
|
<span data-i18n="mqtt.label.cleansession"></span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<label for="node-config-input-sessionExpiryInterval" class="mqtt-form-row-col2 mqtt5 sessionExpiryInterval"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.sessionExpiryInterval"></span></label>
|
|
|
|
<input type="number" min="0" id="node-config-input-sessionExpiryInterval" class="mqtt-form-row-col2 mqtt5 sessionExpiryInterval" >
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2020-10-08 21:24:35 +02:00
|
|
|
<label for="node-config-input-protocolVersion"><i class="fa fa-cog"></i> <span data-i18n="mqtt.label.protocolVersion"></span></label>
|
|
|
|
<select id="node-config-input-protocolVersion" style="width:70%;">
|
|
|
|
<option value="3" data-i18n="mqtt.label.protocolVersion3"></option>
|
|
|
|
<option value="4" data-i18n="mqtt.label.protocolVersion4"></option>
|
|
|
|
<option value="5" data-i18n="mqtt.label.protocolVersion5"></option>
|
|
|
|
</select>
|
2020-10-15 00:30:03 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-config-input-userProperties"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.userProperties"></span></label>
|
|
|
|
<input id="node-config-input-userPropertiesType" type="hidden">
|
2020-12-07 12:50:33 +01:00
|
|
|
<input type="text" id="node-config-input-userProperties" style="width: 70%;" data-i18n="[placeholder]mqtt.label.userProperties" placeholder="">
|
2020-10-15 00:30:03 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-config-input-topicAliasMaximum"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.topicAliasMaximum"></span></label>
|
|
|
|
<input type="number" min="0" id="node-config-input-topicAliasMaximum">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-config-input-maximumPacketSize" ><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.maximumPacketSize"></span></label>
|
|
|
|
<input type="number" min="0" id="node-config-input-maximumPacketSize">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-config-input-receiveMaximum" ><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.receiveMaximum"></span></label>
|
|
|
|
<input type="number" min="0" id="node-config-input-receiveMaximum">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
|
|
|
<div id="mqtt-broker-tab-security" style="display:none">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-user"><i class="fa fa-user"></i> <span data-i18n="common.label.username"></span></label>
|
|
|
|
<input type="text" id="node-config-input-user">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="common.label.password"></span></label>
|
|
|
|
<input type="password" id="node-config-input-password">
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-05-03 00:15:58 +02:00
|
|
|
<div id="mqtt-broker-tab-messages" style="display:none">
|
|
|
|
<div id="mqtt-broker-section-birth">
|
2019-05-09 20:22:40 +02:00
|
|
|
<div class="red-ui-palette-header">
|
2018-05-07 00:38:45 +02:00
|
|
|
<i class="fa fa-angle-down"></i><span data-i18n="mqtt.sections-label.birth-message"></span>
|
2018-05-03 00:15:58 +02:00
|
|
|
</div>
|
2018-05-07 00:38:45 +02:00
|
|
|
<div class="section-content" style="padding:10px 0 0 10px">
|
2018-05-03 00:15:58 +02:00
|
|
|
<div class="form-row">
|
2018-05-08 18:23:28 +02:00
|
|
|
<label style="width: 100px !important;" for="node-config-input-birthTopic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
|
|
|
<input style="width: calc(100% - 300px) !important" type="text" id="node-config-input-birthTopic" data-i18n="[placeholder]mqtt.placeholder.birth-topic">
|
|
|
|
<label style="margin-left: 10px; width: 90px !important;" for="node-config-input-birthRetain"><i class="fa fa-history"></i> <span data-i18n="mqtt.label.retain"></span></label>
|
|
|
|
<select id="node-config-input-birthRetain" style="width:75px !important">
|
2018-05-03 00:15:58 +02:00
|
|
|
<option value="false" data-i18n="mqtt.false"></option>
|
|
|
|
<option value="true" data-i18n="mqtt.true"></option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2018-05-08 18:23:28 +02:00
|
|
|
<label style="width: 100px !important;" for="node-config-input-birthPayload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label>
|
|
|
|
<input style="width: calc(100% - 300px) !important" type="text" id="node-config-input-birthPayload" style="width:300px" data-i18n="[placeholder]common.label.payload">
|
|
|
|
<label style="margin-left: 10px; width: 90px !important;" for="node-config-input-birthQos"><i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
|
|
|
<select id="node-config-input-birthQos" style="width:75px !important">
|
2018-05-03 21:42:39 +02:00
|
|
|
<option value="0">0</option>
|
|
|
|
<option value="1">1</option>
|
|
|
|
<option value="2">2</option>
|
|
|
|
</select>
|
2018-05-03 00:15:58 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
2018-05-07 00:38:45 +02:00
|
|
|
<div id="mqtt-broker-section-close">
|
2019-05-09 20:22:40 +02:00
|
|
|
<div class="red-ui-palette-header">
|
2018-05-07 00:38:45 +02:00
|
|
|
<i class="fa fa-angle-down"></i><span data-i18n="mqtt.sections-label.close-message"></span>
|
2018-05-03 00:15:58 +02:00
|
|
|
</div>
|
2018-05-07 00:38:45 +02:00
|
|
|
<div class="section-content" style="padding:10px 0 0 10px">
|
2018-05-03 00:15:58 +02:00
|
|
|
<div class="form-row">
|
2018-05-08 18:23:28 +02:00
|
|
|
<label style="width: 100px !important;" for="node-config-input-closeTopic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
|
|
|
<input style="width: calc(100% - 300px) !important" type="text" id="node-config-input-closeTopic" style="width:300px" data-i18n="[placeholder]mqtt.placeholder.close-topic">
|
|
|
|
<label style="margin-left: 10px; width: 90px !important;" for="node-config-input-closeRetain"><i class="fa fa-history"></i> <span data-i18n="mqtt.label.retain"></span></label>
|
|
|
|
<select id="node-config-input-closeRetain" style="width:75px !important">
|
2018-05-03 00:15:58 +02:00
|
|
|
<option value="false" data-i18n="mqtt.false"></option>
|
|
|
|
<option value="true" data-i18n="mqtt.true"></option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2018-05-08 18:23:28 +02:00
|
|
|
<label style="width: 100px !important;" for="node-config-input-closePayload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label>
|
|
|
|
<input style="width: calc(100% - 300px) !important" type="text" id="node-config-input-closePayload" style="width:300px" data-i18n="[placeholder]common.label.payload">
|
|
|
|
<label style="margin-left: 10px; width: 90px !important;" for="node-config-input-closeQos"><i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
|
|
|
<select id="node-config-input-closeQos" style="width:75px !important">
|
2018-05-03 21:42:39 +02:00
|
|
|
<option value="0">0</option>
|
|
|
|
<option value="1">1</option>
|
|
|
|
<option value="2">2</option>
|
|
|
|
</select>
|
2018-05-03 00:15:58 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
2018-05-07 00:38:45 +02:00
|
|
|
<div id="mqtt-broker-section-will">
|
2019-05-09 20:22:40 +02:00
|
|
|
<div class="red-ui-palette-header">
|
2018-05-07 00:38:45 +02:00
|
|
|
<i class="fa fa-angle-down"></i><span data-i18n="mqtt.sections-label.will-message"></span>
|
2018-05-03 00:15:58 +02:00
|
|
|
</div>
|
2018-05-07 00:38:45 +02:00
|
|
|
<div class="section-content" style="padding:10px 0 0 10px">
|
2018-05-03 21:42:39 +02:00
|
|
|
<div class="form-row">
|
2018-05-08 18:23:28 +02:00
|
|
|
<label style="width: 100px !important;" for="node-config-input-willTopic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
|
|
|
<input style="width: calc(100% - 300px) !important" type="text" id="node-config-input-willTopic" style="width:300px" data-i18n="[placeholder]mqtt.placeholder.will-topic">
|
|
|
|
<label style="margin-left: 10px; width: 90px !important;" for="node-config-input-willRetain"><i class="fa fa-history"></i> <span data-i18n="mqtt.label.retain"></span></label>
|
|
|
|
<select id="node-config-input-willRetain" style="width:75px !important">
|
2018-05-03 21:42:39 +02:00
|
|
|
<option value="false" data-i18n="mqtt.false"></option>
|
|
|
|
<option value="true" data-i18n="mqtt.true"></option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2018-05-08 18:23:28 +02:00
|
|
|
<label style="width: 100px !important;" for="node-config-input-willPayload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label>
|
|
|
|
<input style="width: calc(100% - 300px) !important" type="text" id="node-config-input-willPayload" style="width:300px" data-i18n="[placeholder]common.label.payload">
|
|
|
|
<label style="margin-left: 10px; width: 90px !important;" for="node-config-input-willQos"><i class="fa fa-empire"></i> <span data-i18n="mqtt.label.qos"></span></label>
|
|
|
|
<select id="node-config-input-willQos" style="width:75px !important">
|
2018-05-03 21:42:39 +02:00
|
|
|
<option value="0">0</option>
|
|
|
|
<option value="1">1</option>
|
|
|
|
<option value="2">2</option>
|
|
|
|
</select>
|
2018-05-03 00:15:58 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2013-11-25 23:50:08 +01:00
|
|
|
</div>
|
2016-06-04 10:04:58 +02:00
|
|
|
</script>
|
2015-09-01 23:30:15 +02:00
|
|
|
|
2013-09-05 16:02:48 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('mqtt-broker',{
|
|
|
|
category: 'config',
|
|
|
|
defaults: {
|
2017-08-09 23:22:40 +02:00
|
|
|
name: {value:""},
|
2014-05-29 23:13:21 +02:00
|
|
|
broker: {value:"",required:true},
|
2018-01-11 23:46:18 +01:00
|
|
|
port: {value:1883,required:false,validate:RED.validators.number(true)},
|
2016-04-27 13:31:54 +02:00
|
|
|
tls: {type:"tls-config",required: false},
|
2016-06-04 10:04:58 +02:00
|
|
|
clientid: {value:"", validate: function(v) {
|
2018-01-11 23:46:18 +01:00
|
|
|
if ($("#node-config-input-clientid").length) {
|
|
|
|
// Currently editing the node
|
|
|
|
return $("#node-config-input-cleansession").is(":checked") || (v||"").length > 0;
|
|
|
|
} else {
|
|
|
|
return (this.cleansession===undefined || this.cleansession) || (v||"").length > 0;
|
|
|
|
}
|
|
|
|
}},
|
2015-09-01 23:30:15 +02:00
|
|
|
usetls: {value: false},
|
|
|
|
verifyservercert: { value: false},
|
2019-09-27 15:22:37 +02:00
|
|
|
compatmode: { value: false},
|
2020-10-08 21:24:35 +02:00
|
|
|
protocolVersion: { value: 4},
|
2016-02-19 23:52:43 +01:00
|
|
|
keepalive: {value:60,validate:RED.validators.number()},
|
2015-09-01 23:30:15 +02:00
|
|
|
cleansession: {value: true},
|
2015-09-02 12:18:59 +02:00
|
|
|
birthTopic: {value:""},
|
|
|
|
birthQos: {value:"0"},
|
|
|
|
birthRetain: {value:false},
|
2018-05-03 00:15:58 +02:00
|
|
|
birthPayload: {value:""},
|
|
|
|
closeTopic: {value:""},
|
2018-05-03 21:42:39 +02:00
|
|
|
closeQos: {value:"0"},
|
|
|
|
closeRetain: {value:false},
|
2018-05-07 00:38:45 +02:00
|
|
|
closePayload: {value:""},
|
|
|
|
willTopic: {value:""},
|
|
|
|
willQos: {value:"0"},
|
|
|
|
willRetain: {value:false},
|
2020-10-08 21:24:35 +02:00
|
|
|
willPayload: {value:""},
|
|
|
|
sessionExpiryInterval: {value:0},
|
|
|
|
topicAliasMaximum: {value:0},
|
|
|
|
maximumPacketSize: {value:0},
|
2020-10-15 00:30:03 +02:00
|
|
|
receiveMaximum: {value:0},
|
|
|
|
userPropertiesType: {value:"json"},
|
|
|
|
userProperties: {value:"{}"},
|
2014-07-18 15:47:58 +02:00
|
|
|
},
|
|
|
|
credentials: {
|
|
|
|
user: {type:"text"},
|
|
|
|
password: {type: "password"}
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
|
|
|
label: function() {
|
2018-01-11 23:46:18 +01:00
|
|
|
if (this.name) {
|
|
|
|
return this.name;
|
|
|
|
}
|
2016-08-04 11:02:27 +02:00
|
|
|
var b = this.broker;
|
2020-05-12 14:42:01 +02:00
|
|
|
if (!b) { b = "undefined"; }
|
2017-04-12 19:31:49 +02:00
|
|
|
var lab = "";
|
|
|
|
lab = (this.clientid?this.clientid+"@":"")+b;
|
|
|
|
if (b.indexOf("://") === -1){
|
|
|
|
if (!this.port){ lab = lab + ":1883"; }
|
|
|
|
else { lab = lab + ":" + this.port; }
|
2017-08-09 23:22:40 +02:00
|
|
|
}
|
|
|
|
return lab;
|
2015-06-03 08:54:43 +02:00
|
|
|
},
|
|
|
|
oneditprepare: function () {
|
2015-09-01 23:30:15 +02:00
|
|
|
var tabs = RED.tabs.create({
|
|
|
|
id: "node-config-mqtt-broker-tabs",
|
|
|
|
onchange: function(tab) {
|
|
|
|
$("#node-config-mqtt-broker-tabs-content").children().hide();
|
|
|
|
$("#" + tab.id).show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
tabs.addTab({
|
|
|
|
id: "mqtt-broker-tab-connection",
|
|
|
|
label: this._("mqtt.tabs-label.connection")
|
|
|
|
});
|
|
|
|
tabs.addTab({
|
|
|
|
id: "mqtt-broker-tab-security",
|
|
|
|
label: this._("mqtt.tabs-label.security")
|
|
|
|
});
|
2018-05-08 18:23:28 +02:00
|
|
|
|
2015-09-02 12:18:59 +02:00
|
|
|
tabs.addTab({
|
2018-05-03 00:15:58 +02:00
|
|
|
id: "mqtt-broker-tab-messages",
|
|
|
|
label: this._("mqtt.tabs-label.messages")
|
2015-09-01 23:30:15 +02:00
|
|
|
});
|
2018-05-03 00:15:58 +02:00
|
|
|
|
2018-05-05 01:52:21 +02:00
|
|
|
function setUpSection(sectionId, isExpanded) {
|
2018-05-03 00:15:58 +02:00
|
|
|
var birthMessageSection = $(sectionId);
|
2019-05-09 20:22:40 +02:00
|
|
|
var paletteHeader = birthMessageSection.find('.red-ui-palette-header');
|
2018-05-05 01:52:21 +02:00
|
|
|
var twistie = paletteHeader.find('i');
|
2018-05-03 00:15:58 +02:00
|
|
|
var sectionContent = birthMessageSection.find('.section-content');
|
|
|
|
|
2018-05-05 01:52:21 +02:00
|
|
|
function toggleSection(expanded) {
|
|
|
|
twistie.toggleClass('expanded', expanded);
|
|
|
|
sectionContent.toggle(expanded);
|
|
|
|
}
|
2019-04-29 12:50:15 +02:00
|
|
|
paletteHeader.on("click", function(e) {
|
2018-05-03 00:15:58 +02:00
|
|
|
e.preventDefault();
|
|
|
|
var isExpanded = twistie.hasClass('expanded');
|
2018-05-05 01:52:21 +02:00
|
|
|
toggleSection(!isExpanded);
|
2018-05-03 00:15:58 +02:00
|
|
|
});
|
2018-05-05 01:52:21 +02:00
|
|
|
toggleSection(isExpanded);
|
2018-05-03 00:15:58 +02:00
|
|
|
}
|
2018-05-08 18:23:28 +02:00
|
|
|
|
2018-05-05 01:52:21 +02:00
|
|
|
// show first section if none are set so the user gets the idea
|
|
|
|
var showBirthSection = this.birthTopic !== ""
|
|
|
|
|| this.willTopic === ""
|
|
|
|
&& this.birthTopic === ""
|
|
|
|
&& this.closeTopic == "";
|
|
|
|
setUpSection('#mqtt-broker-section-birth', showBirthSection);
|
|
|
|
setUpSection('#mqtt-broker-section-close', this.closeTopic !== "");
|
2018-05-07 00:38:45 +02:00
|
|
|
setUpSection('#mqtt-broker-section-will', this.willTopic !== "");
|
2018-05-03 00:15:58 +02:00
|
|
|
|
2017-03-10 21:12:52 +01:00
|
|
|
setTimeout(function() { tabs.resize(); },0);
|
2015-09-01 23:58:26 +02:00
|
|
|
if (typeof this.cleansession === 'undefined') {
|
|
|
|
this.cleansession = true;
|
|
|
|
$("#node-config-input-cleansession").prop("checked",true);
|
|
|
|
}
|
2016-06-04 10:04:58 +02:00
|
|
|
if (typeof this.usetls === 'undefined') {
|
2015-09-01 23:30:15 +02:00
|
|
|
this.usetls = false;
|
|
|
|
$("#node-config-input-usetls").prop("checked",false);
|
2015-06-03 08:54:43 +02:00
|
|
|
}
|
2020-10-08 21:24:35 +02:00
|
|
|
if (this.compatmode === 'true' || this.compatmode === true) {
|
|
|
|
delete this.compatmode;
|
|
|
|
this.protocolVersion = 4;
|
2015-06-03 08:54:43 +02:00
|
|
|
}
|
2020-10-08 21:24:35 +02:00
|
|
|
if (typeof this.protocolVersion === 'undefined') {
|
|
|
|
this.protocolVersion = 4;
|
|
|
|
}
|
2020-10-15 00:30:03 +02:00
|
|
|
function updateSessionExpiryIntervalVisibility() {
|
|
|
|
var hide = ($("#node-config-input-cleansession").is(":checked") || $("#node-config-input-protocolVersion").val() != "5");
|
|
|
|
if(hide) {
|
|
|
|
$(".sessionExpiryInterval").hide();
|
|
|
|
} else {
|
|
|
|
$(".sessionExpiryInterval").show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$("#node-config-input-protocolVersion").change(function(){
|
|
|
|
var v5 = $("#node-config-input-protocolVersion").val() == "5";
|
|
|
|
if(v5) {
|
|
|
|
$(".mqtt5").show();
|
|
|
|
} else {
|
|
|
|
$(".mqtt5").hide();
|
|
|
|
}
|
|
|
|
updateSessionExpiryIntervalVisibility();
|
|
|
|
});
|
2020-10-08 21:24:35 +02:00
|
|
|
$("#node-config-input-protocolVersion").val(this.protocolVersion);
|
2020-10-15 00:30:03 +02:00
|
|
|
$("#node-config-input-userProperties").typedInput({
|
|
|
|
default: "json",
|
2020-12-07 12:45:02 +01:00
|
|
|
types:['json'],
|
2020-10-15 00:30:03 +02:00
|
|
|
typeField: $("#node-config-input-userPropertiesType")
|
|
|
|
});
|
2016-06-04 10:04:58 +02:00
|
|
|
if (typeof this.keepalive === 'undefined') {
|
2015-09-01 23:30:15 +02:00
|
|
|
this.keepalive = 15;
|
2015-09-01 23:58:26 +02:00
|
|
|
$("#node-config-input-keepalive").val(this.keepalive);
|
2015-06-03 08:54:43 +02:00
|
|
|
}
|
2015-09-02 12:18:59 +02:00
|
|
|
if (typeof this.birthQos === 'undefined') {
|
|
|
|
this.birthQos = "0";
|
|
|
|
$("#node-config-input-birthQos").val("0");
|
|
|
|
}
|
2018-05-03 00:15:58 +02:00
|
|
|
if (typeof this.closeQos === 'undefined') {
|
|
|
|
this.willQos = "0";
|
|
|
|
$("#node-config-input-willQos").val("0");
|
|
|
|
}
|
2018-05-07 00:38:45 +02:00
|
|
|
if (typeof this.willQos === 'undefined') {
|
|
|
|
this.willQos = "0";
|
|
|
|
$("#node-config-input-willQos").val("0");
|
|
|
|
}
|
2015-06-03 08:54:43 +02:00
|
|
|
|
2015-09-01 23:30:15 +02:00
|
|
|
function updateTLSOptions() {
|
|
|
|
if ($("#node-config-input-usetls").is(':checked')) {
|
2016-04-27 13:31:54 +02:00
|
|
|
$("#node-config-row-tls").show();
|
2015-09-01 23:30:15 +02:00
|
|
|
} else {
|
2016-04-27 13:31:54 +02:00
|
|
|
$("#node-config-row-tls").hide();
|
2015-09-01 23:30:15 +02:00
|
|
|
}
|
2015-06-03 08:54:43 +02:00
|
|
|
}
|
2015-09-01 23:30:15 +02:00
|
|
|
updateTLSOptions();
|
|
|
|
$("#node-config-input-usetls").on("click",function() {
|
|
|
|
updateTLSOptions();
|
|
|
|
});
|
|
|
|
var node = this;
|
|
|
|
function updateClientId() {
|
|
|
|
if ($("#node-config-input-cleansession").is(":checked")) {
|
|
|
|
$("#node-config-input-clientid").attr("placeholder",node._("mqtt.placeholder.clientid"));
|
2015-06-03 08:54:43 +02:00
|
|
|
} else {
|
2015-09-01 23:30:15 +02:00
|
|
|
$("#node-config-input-clientid").attr("placeholder",node._("mqtt.placeholder.clientid-nonclean"));
|
2015-06-03 08:54:43 +02:00
|
|
|
}
|
2020-10-15 00:30:03 +02:00
|
|
|
updateSessionExpiryIntervalVisibility();
|
2015-09-01 23:30:15 +02:00
|
|
|
$("#node-config-input-clientid").change();
|
|
|
|
}
|
|
|
|
setTimeout(updateClientId,0);
|
|
|
|
$("#node-config-input-cleansession").on("click",function() {
|
|
|
|
updateClientId();
|
2015-06-03 08:54:43 +02:00
|
|
|
});
|
2018-01-11 23:46:18 +01:00
|
|
|
|
2017-04-12 19:31:49 +02:00
|
|
|
function updatePortEntry(){
|
|
|
|
var disabled = $("#node-config-input-port").prop("disabled");
|
|
|
|
if ($("#node-config-input-broker").val().indexOf("://") === -1){
|
|
|
|
if (disabled){
|
|
|
|
$("#node-config-input-port").prop("disabled", false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!disabled){
|
|
|
|
$("#node-config-input-port").prop("disabled", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-29 12:50:15 +02:00
|
|
|
$("#node-config-input-broker").on("change", function() {
|
2017-04-12 19:31:49 +02:00
|
|
|
updatePortEntry();
|
|
|
|
});
|
|
|
|
$("#node-config-input-broker").on( "keyup", function() {
|
|
|
|
updatePortEntry();
|
|
|
|
});
|
2018-01-11 23:46:18 +01:00
|
|
|
setTimeout(updatePortEntry,50);
|
|
|
|
|
2016-04-27 13:31:54 +02:00
|
|
|
},
|
|
|
|
oneditsave: function() {
|
|
|
|
if (!$("#node-config-input-usetls").is(':checked')) {
|
|
|
|
$("#node-config-input-tls").val("");
|
|
|
|
}
|
2013-09-05 16:02:48 +02:00
|
|
|
}
|
|
|
|
});
|
2020-10-08 21:24:35 +02:00
|
|
|
</script>
|