Update Join node runtime to match UI changes

This commit is contained in:
Nick O'Leary
2016-06-05 23:32:03 +01:00
parent 9f8c32ce8f
commit e594ffe0f8
4 changed files with 169 additions and 144 deletions

View File

@@ -44,7 +44,7 @@
color:"#E2D96E",
defaults: {
name: {value:""},
splt: {value:""}
splt: {value:"\\n"}
},
inputs:1,
outputs:1,
@@ -61,12 +61,12 @@
<script type="text/x-red" data-template-name="join">
<div class="form-row">
<label for="node-input-out"><i class="fa fa-long-arrow-right"></i> Output</label>
<select id="node-input-out" style="width:70%; margin-right:5px;">
<label for="node-input-build"><i class="fa fa-long-arrow-right"></i> Output</label>
<select id="node-input-build" style="width:70%; margin-right:5px;">
<option value="auto">automatic</option>
<option value="str">a String of joined properties</option>
<option value="arr">an Array of properties</option>
<option value="obj">an Object of key/property pairs</option>
<option value="string">a String of joined properties</option>
<option value="array">an Array of properties</option>
<option value="object">an Object of key/property pairs</option>
</select>
</div>
<div class="form-row node-row-key">
@@ -78,22 +78,24 @@
<input type="text" id="node-input-property">
<input type="hidden" id="node-input-propertyType">
</div>
<div class="form-row node-row-join">
<label for="node-input-join" style="padding-right: 10px; box-sizing: border-box; text-align: right;">joined using</label>
<input type="text" id="node-input-join" style="width: 40px">
<div class="form-row node-row-joiner">
<label for="node-input-joiner" style="padding-right: 10px; box-sizing: border-box; text-align: right;">joined using</label>
<input type="text" id="node-input-joiner" style="width: 40px">
</div>
<div class="form-row node-row-trigger">
<label style="width: auto;">Send the message:</label>
<div style="height: 40px;">
<label style="margin-left: 40px; width: auto;"><input type="checkbox" style="width: auto;margin-bottom: 5px;"> after a fixed number of messages: <input type="text" style="width: 75px;"></label>
</div>
<div style="height: 40px;">
<label style="margin-left: 40px; width: auto;"><input type="checkbox" style="width: auto;margin-bottom: 5px;"> after a timeout following the first message: <input placeholder="seconds" type="text" style="width: 75px;"></label>
</div>
<div style="height: 40px; padding-top: 6px;" class="node-row-accumulate">
<label style="margin-left: 40px; width: auto;"><input type="checkbox" style="width: auto;margin-bottom: 5px;"> whenever a property is updated</label>
</div>
<ul>
<li style="height: 40px;">
<label style="width: 280px;" for="node-input-count">After a fixed number of messages:</label> <input id="node-input-count" placeholder="count" type="text" style="width: 75px;">
</li>
<li style="height: 40px;">
<label style="width: 280px;" for="node-input-timeout">After a timeout following the first message:</label> <input id="node-input-timeout" placeholder="seconds" type="text" style="width: 75px;">
</li>
<li style="height: 40px; padding-top: 6px;" class="node-row-accumulate">
<label style="width: auto;"><input type="checkbox" id="node-input-accumulate" style="width: auto;margin-bottom: 5px;margin-right: 5px;"> whenever a property is updated</label>
</li>
</ul>
</div>
<div class="form-tips form-tips-auto hide">This mode assumes this node is either
@@ -122,13 +124,14 @@
color:"#E2D96E",
defaults: {
name: {value:""},
out: { value:"auto"},
build: { value:"auto"},
property: { value: "payload"},
propertyType: { value:"msg"},
key: {value:"topic"},
joiner: { value:"\\n"},
timeout: {value:""},
timerr: {value:"send"},
count: {value:""},
joiner: {value:""},
build: {value:"array"}
accumulate: {value: false}
},
inputs:1,
outputs:1,
@@ -140,14 +143,19 @@
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
$("#node-input-out").change(function(e) {
$("#node-input-build").change(function(e) {
var val = $(this).val();
$(".node-row-key").toggle(val==='obj');
$(".node-row-property").toggle(val!=='auto');
$(".node-row-join").toggle(val==='str');
$(".node-row-joiner").toggle(val==='str');
$(".node-row-trigger").toggle(val!=='auto');
$(".node-row-accumulate").toggle(val==='obj');
$(".form-tips-auto").toggle(val==='auto');
if (val === 'str') {
$("#node-input-property").typedInput('types',['msg']);
} else if (val !== 'auto') {
$("#node-input-property").typedInput('types',['msg', {value:"full",label:"complete message",hasValue:false}]);
}
})
$("#node-input-property").typedInput({
@@ -158,7 +166,7 @@
types:['msg']
})
$("#node-input-out").change();
$("#node-input-build").change();
}
});
</script>