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>
|
|
|
|
|
|
|
|
.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;
|
|
|
|
}
|
2021-02-25 16:49:56 +01:00
|
|
|
.form-row.mqtt5-out > label {
|
|
|
|
width: 130px;
|
|
|
|
}
|
2020-10-08 21:24:35 +02:00
|
|
|
.form-row.mqtt-flags-row > label {
|
|
|
|
vertical-align: top;
|
|
|
|
}
|
|
|
|
.form-row.mqtt-flags-row > .mqtt-flags {
|
2021-02-25 16:49:56 +01:00
|
|
|
display: inline-block;
|
2020-10-08 21:24:35 +02:00
|
|
|
width: 70%
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-row.mqtt-flags-row > .mqtt-flags > .mqtt-flag > label {
|
|
|
|
display: block;
|
2021-02-25 16:49:56 +01:00
|
|
|
width: 100%;
|
2020-10-08 21:24:35 +02:00
|
|
|
}
|
|
|
|
.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>
|
2021-02-20 20:58:13 +01: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%;">
|
|
|
|
<option value="auto" data-i18n="mqtt.output.auto"></option>
|
|
|
|
<option value="buffer" data-i18n="mqtt.output.buffer"></option>
|
|
|
|
<option value="utf8" data-i18n="mqtt.output.string"></option>
|
|
|
|
<option value="json" data-i18n="mqtt.output.json"></option>
|
|
|
|
<option value="base64" data-i18n="mqtt.output.base64"></option>
|
|
|
|
</select>
|
2021-02-25 16:49:56 +01:00
|
|
|
</div>
|
|
|
|
<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>
|
2021-02-25 16:49:56 +01:00
|
|
|
</label>
|
2020-10-08 21:24:35 +02:00
|
|
|
</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>
|
2021-02-25 16:49:56 +01:00
|
|
|
</label>
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-25 16:49:56 +01:00
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label for="node-input-rh" style="width:100%"><i class="fa fa-tag"></i> <span data-i18n="mqtt.label.rh"></span></label>
|
|
|
|
<select id="node-input-rh" style="margin-left: 104px; width: 70%">
|
2020-10-15 00:30:03 +02:00
|
|
|
<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>
|
2021-02-25 16:49:56 +01:00
|
|
|
</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>
|
|
|
|
|
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>
|
2021-02-25 16:49:56 +01:00
|
|
|
|
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>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-input-userProps"><span data-i18n="mqtt.label.userProperties"></span></label>
|
|
|
|
<input type="text" id="node-input-userProps" style="width: calc(100% - 166px);">
|
2021-02-20 20:58:13 +01:00
|
|
|
</div>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-input-respTopic"><span data-i18n="mqtt.label.responseTopic"></span></label>
|
|
|
|
<input type="text" id="node-input-respTopic" style="width: calc(100% - 166px);">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-input-correl"><span data-i18n="mqtt.label.correlationData"></span></label>
|
|
|
|
<input type="text" id="node-input-correl" style="width: calc(100% - 166px);">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-input-contentType"><span data-i18n="mqtt.label.contentType"></span></label>
|
|
|
|
<input type="text" id="node-input-contentType" style="width: calc(100% - 166px);">
|
2020-10-08 21:24:35 +02:00
|
|
|
</div>
|
|
|
|
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt-form-row-cols2 mqtt5 mqtt5-out">
|
|
|
|
<label for="node-input-expiry" class="mqtt-form-row-col1"><span data-i18n="mqtt.label.expiry"></span></label>
|
|
|
|
<input id="node-input-expiry" style="width: calc(100% - 166px);" class="mqtt-form-row-col1" >
|
|
|
|
</div>
|
2020-10-08 21:24:35 +02:00
|
|
|
|
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>
|
|
|
|
|
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>
|
2021-02-25 16:49:56 +01:00
|
|
|
<input type="text" id="node-config-input-broker" style="width: calc(100% - 300px);" 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>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row" style="height: 34px;">
|
2021-04-12 12:48:10 +02:00
|
|
|
<input type="checkbox" id="node-config-input-usetls" style="height: 34px; margin: 0 5px 0 104px; display: inline-block; width: auto; vertical-align: top;">
|
|
|
|
<label for="node-config-input-usetls" style="width: 100px; line-height: 34px;"><span data-i18n="mqtt.label.use-tls"></span></label>
|
2021-02-25 16:49:56 +01:00
|
|
|
<span id="node-config-row-tls" class="hide"><input style="width: 320px;" type="text" id="node-config-input-tls"></span>
|
|
|
|
</div>
|
2016-04-27 13:31:54 +02:00
|
|
|
<div class="form-row">
|
2021-02-25 16:49:56 +01: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>
|
2016-04-27 13:31:54 +02:00
|
|
|
</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">
|
2021-02-25 16:49:56 +01:00
|
|
|
<label for="node-config-input-keepalive"><i class="fa fa-heartbeat"></i> <span data-i18n="mqtt.label.keepalive"></span></label>
|
|
|
|
<input type="number" min="0" id="node-config-input-keepalive" style="width: 100px">
|
2020-10-15 00:30:03 +02:00
|
|
|
</div>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row" style="margin-bottom:0">
|
2021-03-03 02:07:33 +01:00
|
|
|
<label style="vertical-align:top;"><i class="fa fa-info"></i> <span data-i18n="mqtt.label.session"></span></label>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div style="display: inline-block; width:calc(100% - 110px)">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-config-input-cleansession" style="width: auto;">
|
|
|
|
<input type="checkbox" id="node-config-input-cleansession" style="position: relative;vertical-align: bottom; top: -2px; width: 15px;height: 15px;">
|
|
|
|
<span id="node-config-input-cleansession-label" data-i18n="mqtt.label.cleansession"></span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5">
|
|
|
|
<label style="width:auto" for="node-config-input-sessionExpiry"><span data-i18n="mqtt.label.sessionExpiry"></span></label>
|
|
|
|
<input type="number" min="0" id="node-config-input-sessionExpiry" style="width: 100px" >
|
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
</div>
|
2015-09-01 23:30:15 +02:00
|
|
|
</div>
|
2020-10-15 00:30:03 +02:00
|
|
|
<div class="form-row mqtt5">
|
2021-02-25 16:49:56 +01:00
|
|
|
<label style="width: 125px;" for="node-config-input-userProps"><span data-i18n="mqtt.label.userProperties"></span></label>
|
|
|
|
<input type="text" id="node-config-input-userProps" style="width: calc(100% - 166px);">
|
|
|
|
</div>
|
|
|
|
<br>
|
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>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-birth-contentType" data-i18n="mqtt.label.contentType"></label>
|
|
|
|
<input type="text" style="width:calc(100% - 200px);" id="node-config-input-birth-contentType">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-birth-props" data-i18n="mqtt.label.userProperties"></label>
|
|
|
|
<input type="text" style="width:calc(100% - 200px);" id="node-config-input-birth-props">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-birth-respTopic"><span data-i18n="mqtt.label.responseTopic"></span></label>
|
|
|
|
<input type="text" id="node-config-input-birth-respTopic" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-birth-correl"><span data-i18n="mqtt.label.correlationData"></span></label>
|
|
|
|
<input type="text" id="node-config-input-birth-correl" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-birth-expiry"><span data-i18n="mqtt.label.expiry"></span></label>
|
|
|
|
<input id="node-config-input-birth-expiry" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
2018-05-03 00:15:58 +02:00
|
|
|
</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>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-close-contentType" data-i18n="mqtt.label.contentType"></label>
|
|
|
|
<input type="text" style="width:calc(100% - 200px);" id="node-config-input-close-contentType">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-close-props" data-i18n="mqtt.label.userProperties"></label>
|
|
|
|
<input type="text" style="width:calc(100% - 200px);" id="node-config-input-close-props">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-close-respTopic"><span data-i18n="mqtt.label.responseTopic"></span></label>
|
|
|
|
<input type="text" id="node-config-input-close-respTopic" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-close-correl"><span data-i18n="mqtt.label.correlationData"></span></label>
|
|
|
|
<input type="text" id="node-config-input-close-correl" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-close-expiry"><span data-i18n="mqtt.label.expiry"></span></label>
|
|
|
|
<input id="node-config-input-close-expiry" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
2018-05-03 00:15:58 +02:00
|
|
|
</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>
|
2021-02-25 16:49:56 +01:00
|
|
|
<div class="form-row mqtt5">
|
2021-03-03 02:07:33 +01:00
|
|
|
<label><span data-i18n="mqtt.label.delay"></span></label>
|
2021-02-25 16:49:56 +01:00
|
|
|
<input type="number" min="0" id="node-config-input-will-delay" style="width: 100px" >
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-will-contentType" data-i18n="mqtt.label.contentType"></label>
|
|
|
|
<input type="text" style="width:calc(100% - 200px);" id="node-config-input-will-contentType">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-will-props" data-i18n="mqtt.label.userProperties"></label>
|
|
|
|
<input type="text" style="width:calc(100% - 200px);" id="node-config-input-will-props">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-will-respTopic"><span data-i18n="mqtt.label.responseTopic"></span></label>
|
|
|
|
<input type="text" id="node-config-input-will-respTopic" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-will-correl"><span data-i18n="mqtt.label.correlationData"></span></label>
|
|
|
|
<input type="text" id="node-config-input-will-correl" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
|
|
|
<div class="form-row mqtt5 mqtt5-out">
|
|
|
|
<label for="node-config-input-will-expiry"><span data-i18n="mqtt.label.expiry"></span></label>
|
|
|
|
<input id="node-config-input-will-expiry" style="width: calc(100% - 200px);">
|
|
|
|
</div>
|
2018-05-03 00:15:58 +02:00
|
|
|
</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">
|
2021-02-25 16:49:56 +01:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
var typedInputNoneOpt = { value: 'none', label: '', hasValue: false };
|
|
|
|
var makeTypedInputOpt = function(value){
|
|
|
|
return {
|
|
|
|
value: value,
|
|
|
|
label:value,
|
|
|
|
hasValue: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var contentTypeOpts = [
|
|
|
|
typedInputNoneOpt,
|
|
|
|
makeTypedInputOpt("application/json"),
|
|
|
|
makeTypedInputOpt("application/octet-stream"),
|
|
|
|
makeTypedInputOpt("text/csv"),
|
|
|
|
makeTypedInputOpt("text/html"),
|
|
|
|
makeTypedInputOpt("text/plain"),
|
|
|
|
{value:"other", label:""}
|
|
|
|
];
|
|
|
|
|
|
|
|
function getDefaultContentType(value) {
|
|
|
|
var defaultContentType;
|
|
|
|
var matchedContentType = contentTypeOpts.filter(function(v) {
|
|
|
|
return v.value === value;
|
|
|
|
})
|
|
|
|
if (matchedContentType.length > 0) {
|
|
|
|
defaultContentType = matchedContentType[0].value;
|
|
|
|
}
|
|
|
|
if (value && !defaultContentType) {
|
|
|
|
defaultContentType = 'other';
|
|
|
|
}
|
|
|
|
return defaultContentType || 'none'
|
|
|
|
}
|
|
|
|
|
2013-09-05 16:02:48 +02:00
|
|
|
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:""},
|
2021-02-25 16:49:56 +01:00
|
|
|
birthMsg: { value: {}},
|
2018-05-03 00:15:58 +02:00
|
|
|
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:""},
|
2021-02-25 16:49:56 +01:00
|
|
|
closeMsg: { value: {}},
|
2018-05-07 00:38:45 +02:00
|
|
|
willTopic: {value:""},
|
|
|
|
willQos: {value:"0"},
|
|
|
|
willRetain: {value:false},
|
2020-10-08 21:24:35 +02:00
|
|
|
willPayload: {value:""},
|
2021-02-25 16:49:56 +01:00
|
|
|
willMsg: { value: {}},
|
|
|
|
sessionExpiry: {value:0}
|
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
|
|
|
|
2021-02-25 16:49:56 +01:00
|
|
|
function setUpSection(sectionId, v5Opts, isExpanded) {
|
|
|
|
var birthMessageSection = $("#mqtt-broker-section-"+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);
|
2021-02-25 16:49:56 +01:00
|
|
|
$("#node-config-input-"+sectionId+"-contentType").val(v5Opts?v5Opts.contentType:"").typedInput({
|
|
|
|
default: getDefaultContentType(v5Opts?v5Opts.contentType:""),
|
|
|
|
types: contentTypeOpts,
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#node-config-input-"+sectionId+"-props").val(v5Opts?v5Opts.userProps:"").typedInput({
|
|
|
|
default: !(v5Opts?v5Opts.userProps:null)? 'none':'json',
|
|
|
|
types: [typedInputNoneOpt, 'json'],
|
|
|
|
});
|
|
|
|
$("#node-config-input-"+sectionId+"-respTopic").val(v5Opts?v5Opts.respTopic:"").typedInput({
|
|
|
|
default: !(v5Opts?v5Opts.respTopic:null)? 'none':'str',
|
|
|
|
types: [typedInputNoneOpt, 'str'],
|
|
|
|
});
|
|
|
|
$("#node-config-input-"+sectionId+"-correl").val(v5Opts?v5Opts.correl:"").typedInput({
|
|
|
|
default: !(v5Opts?v5Opts.correl:null)? 'none':'str',
|
|
|
|
types: [typedInputNoneOpt, 'str'],
|
|
|
|
});
|
|
|
|
$("#node-config-input-"+sectionId+"-expiry").val(v5Opts?v5Opts.expiry:"").typedInput({
|
|
|
|
default: !(v5Opts?v5Opts.expiry:null)? 'none':'num',
|
|
|
|
types: [typedInputNoneOpt, 'num'],
|
|
|
|
});
|
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 == "";
|
2021-02-25 16:49:56 +01:00
|
|
|
setUpSection('birth', this.birthMsg, showBirthSection);
|
|
|
|
setUpSection('close', this.closeMsg, this.closeTopic !== "");
|
|
|
|
setUpSection('will', this.willMsg, this.willTopic !== "");
|
|
|
|
|
|
|
|
if (this.willMsg) {
|
|
|
|
$("#node-config-input-will-delay").val(this.willMsg.delay);
|
|
|
|
}
|
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;
|
|
|
|
}
|
2021-02-25 16:49:56 +01:00
|
|
|
$("#node-config-input-protocolVersion").on("change", function() {
|
2020-10-15 00:30:03 +02:00
|
|
|
var v5 = $("#node-config-input-protocolVersion").val() == "5";
|
|
|
|
if(v5) {
|
2021-02-25 16:49:56 +01:00
|
|
|
$("#node-config-input-cleansession-label").text(RED._("node-red:mqtt.label.cleanstart"))
|
2021-02-20 16:52:14 +01:00
|
|
|
$("div.form-row.mqtt5").show();
|
2020-10-15 00:30:03 +02:00
|
|
|
} else {
|
2021-02-25 16:49:56 +01:00
|
|
|
$("#node-config-input-cleansession-label").text(RED._("node-red:mqtt.label.cleansession"))
|
2021-02-20 16:52:14 +01:00
|
|
|
$("div.form-row.mqtt5").hide();
|
2020-10-15 00:30:03 +02:00
|
|
|
}
|
|
|
|
});
|
2020-10-08 21:24:35 +02:00
|
|
|
$("#node-config-input-protocolVersion").val(this.protocolVersion);
|
2021-02-25 16:49:56 +01:00
|
|
|
$("#node-config-input-userProps").typedInput({
|
|
|
|
default: !this.userProps ? 'none':'json',
|
|
|
|
types: [typedInputNoneOpt, 'json']
|
|
|
|
});
|
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
|
|
|
|
2021-02-25 16:49:56 +01: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
|
|
|
}
|
2021-02-25 16:49:56 +01:00
|
|
|
$("#node-config-input-clientid").trigger("change");
|
2015-09-01 23:30:15 +02:00
|
|
|
}
|
|
|
|
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);
|
2021-02-25 16:49:56 +01:00
|
|
|
setTimeout(function() {
|
|
|
|
$("#node-config-input-protocolVersion").trigger("change");
|
|
|
|
},50);
|
2018-01-11 23:46:18 +01:00
|
|
|
|
2016-04-27 13:31:54 +02:00
|
|
|
},
|
|
|
|
oneditsave: function() {
|
|
|
|
if (!$("#node-config-input-usetls").is(':checked')) {
|
|
|
|
$("#node-config-input-tls").val("");
|
|
|
|
}
|
2021-02-25 16:49:56 +01:00
|
|
|
|
|
|
|
var v5 = $("#node-config-input-protocolVersion").val() == "5";
|
|
|
|
|
|
|
|
function saveV5Message(section) {
|
|
|
|
var msg = {};
|
|
|
|
if ($("#node-config-input-"+section+"Topic").val().trim().length > 0) {
|
|
|
|
var contentType = $("#node-config-input-"+section+"-contentType").val().trim();
|
|
|
|
if (contentType === '') {
|
|
|
|
contentType = $("#node-config-input-"+section+"-contentType").typedInput('type');
|
|
|
|
if (contentType === 'none' || contentType === 'other') {
|
|
|
|
contentType = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (contentType) {
|
|
|
|
msg.contentType = contentType;
|
|
|
|
}
|
|
|
|
var props = $("#node-config-input-"+section+"-props").val().trim();
|
|
|
|
if (props) {
|
|
|
|
msg.userProps = props;
|
|
|
|
}
|
|
|
|
var resp = $("#node-config-input-"+section+"-respTopic").val().trim();
|
|
|
|
if (props) {
|
|
|
|
msg.respTopic = resp;
|
|
|
|
}
|
|
|
|
var correl = $("#node-config-input-"+section+"-correl").val().trim();
|
|
|
|
if (correl) {
|
|
|
|
msg.correl = correl;
|
|
|
|
}
|
|
|
|
var expiry = $("#node-config-input-"+section+"-expiry").val().trim();
|
|
|
|
if (expiry) {
|
|
|
|
msg.expiry = expiry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (v5) {
|
|
|
|
this.birthMsg = saveV5Message("birth");
|
|
|
|
this.closeMsg = saveV5Message("close");
|
|
|
|
this.willMsg = saveV5Message("will");
|
|
|
|
var willDelay = $("#node-config-input-will-delay").val();
|
|
|
|
if (willDelay) {
|
|
|
|
this.willMsg.delay = willDelay;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.willMsg = {};
|
|
|
|
this.birthMsg = {};
|
|
|
|
this.closeMsg = {};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
RED.nodes.registerType('mqtt in',{
|
|
|
|
category: 'network',
|
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
|
|
|
topic: {value:"",required:true,validate: RED.validators.regex(/^(#$|(\+|[^+#]*)(\/(\+|[^+#]*))*(\/(\+|#|[^+#]*))?$)/)},
|
|
|
|
qos: {value: "2"},
|
|
|
|
datatype: {value:"auto",required:true},
|
|
|
|
broker: {type:"mqtt-broker", required:true},
|
|
|
|
// subscriptionIdentifier: {value:0},
|
|
|
|
nl: {value:false},
|
|
|
|
rap: {value:true},
|
|
|
|
rh: {value:0},
|
|
|
|
},
|
|
|
|
color:"#d8bfd8",
|
|
|
|
inputs:0,
|
|
|
|
outputs:1,
|
|
|
|
icon: "bridge.svg",
|
|
|
|
label: function() {
|
|
|
|
return this.name||this.topic||"mqtt";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
$("#node-input-broker").on("change",function(d){
|
|
|
|
var confNode = RED.nodes.node($("#node-input-broker").val());
|
|
|
|
var v5 = confNode && confNode.protocolVersion == "5";
|
|
|
|
if(v5) {
|
|
|
|
$("div.form-row.mqtt5").show();
|
|
|
|
} else {
|
|
|
|
$("div.form-row.mqtt5").hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (this.qos === undefined) {
|
|
|
|
$("#node-input-qos").val("2");
|
|
|
|
}
|
|
|
|
if (this.datatype === undefined) {
|
|
|
|
$("#node-input-datatype").val("auto");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
RED.nodes.registerType('mqtt out',{
|
|
|
|
category: 'network',
|
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
|
|
|
topic: {value:""},
|
|
|
|
qos: {value:""},
|
|
|
|
retain: {value:""},
|
|
|
|
respTopic: {value:""},
|
|
|
|
contentType: {value:""},
|
|
|
|
userProps: {value:''},
|
|
|
|
correl: {value:''},
|
|
|
|
expiry: {value:''},
|
|
|
|
broker: {type:"mqtt-broker", required:true}
|
|
|
|
},
|
|
|
|
color:"#d8bfd8",
|
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
|
|
|
icon: "bridge.svg",
|
|
|
|
align: "right",
|
|
|
|
label: function() {
|
|
|
|
return this.name||this.topic||"mqtt";
|
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
function showHideDynamicFields() {
|
|
|
|
var confNode = RED.nodes.node($("#node-input-broker").val());
|
|
|
|
var v5 = confNode && confNode.protocolVersion == "5";
|
|
|
|
if(v5) {
|
|
|
|
$("div.form-row.mqtt5").show();
|
|
|
|
var t = $("#node-input-respTopic").typedInput("type");
|
|
|
|
if (t == 'none') {
|
|
|
|
$("#node-input-correl").parent().hide();
|
|
|
|
} else {
|
|
|
|
$("#node-input-correl").parent().show();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$("div.form-row.mqtt5").hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#node-input-broker").on("change",function(d){
|
|
|
|
showHideDynamicFields();
|
|
|
|
});
|
|
|
|
|
|
|
|
var respTopicTI = $("#node-input-respTopic").typedInput({
|
|
|
|
default: !this.respTopic ? 'none':'str',
|
|
|
|
types: [typedInputNoneOpt, 'str'],
|
|
|
|
});
|
|
|
|
|
|
|
|
var correlTI = $("#node-input-correl").typedInput({
|
|
|
|
default: !this.correl ? 'none':'str',
|
|
|
|
types: [typedInputNoneOpt, 'str']
|
|
|
|
});
|
|
|
|
//show / hide correlation data depending on respTopic
|
|
|
|
respTopicTI.on("change", showHideDynamicFields);
|
|
|
|
respTopicTI.triggerHandler("change");
|
|
|
|
|
|
|
|
$("#node-input-userProps").typedInput({
|
|
|
|
default: !this.userProps ? 'none':'json',
|
|
|
|
types: [typedInputNoneOpt, 'json'],
|
|
|
|
});
|
|
|
|
$("#node-input-expiry").typedInput({
|
|
|
|
default: !this.expiry ? 'none':'num',
|
|
|
|
types: [typedInputNoneOpt, 'num']
|
|
|
|
});
|
|
|
|
$("#node-input-contentType").on('change', function (event, type, value, urg) {
|
|
|
|
console.log(event);
|
|
|
|
console.log("ct change",type,value, urg);
|
|
|
|
}).typedInput({
|
|
|
|
default: getDefaultContentType(this.contentType),
|
|
|
|
types: contentTypeOpts
|
|
|
|
})
|
|
|
|
},
|
|
|
|
oneditsave: function() {
|
|
|
|
|
|
|
|
var contentType = $("#node-input-contentType").val().trim();
|
|
|
|
if (contentType === '') {
|
|
|
|
contentType = $("#node-input-contentType").typedInput('type');
|
|
|
|
if (contentType === 'none' || contentType === 'other') {
|
|
|
|
contentType = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$("#node-input-contentType").val(contentType)
|
|
|
|
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2013-09-05 16:02:48 +02:00
|
|
|
}
|
|
|
|
});
|
2021-02-25 16:49:56 +01:00
|
|
|
})();
|
2021-03-03 02:07:33 +01:00
|
|
|
</script>
|