node-red/nodes/core/core/89-trigger.html
samarsultan e5511ea86d Rework bidi file structure
Closes #1026,#983,#982,#978

PR #1026 contains the full history of the changes made herein.
Due to the volume of commits with no meaningful comment, they
have been squashed down to this one.

Adding bidi Files

Tuning code style

Adding rest of bidi files and its dependencies

Tuning code style

editing numeric shaping value

Tuning Code style

adding bidi support

Adding Bidi Support for the rest of files

Adding Bidi support

Editing Bidi menu

adding mirroring enablement

handeling code style

Addinng Bidi Support

Adding Bidi Support

Adding locale settings to national calendar support

Adding Numeric Shaping Support

scss files after adding rtl direction part 1

adding rtl direction at scss files part2

adding right directionality at comman typeInput

correcting some comments

editing spaces

applying code style

editing code style

editing code style

editing code style

editing code style

adding right directionality

adding right directionality

adding style in case of right directionality

adding style in case of right directionality

adding style in case of right directionality

create a global variable for ui direction to call it once need

Update main.js

Update typedInput.js

Update 10-switch.html

manage palette mirroring

adding RTL directionality to Tabs and Manage palette

Style Editing

Adding mirroring to subflow workspace

handle mirroring defects at manage palette

Handle Mirroring defects at sidebar seperator

Numeric Shaping Updates

Editing code style

Handling mirroring defects

Handling mirroring defects

Fixing mirroring defects

editing code style

fixing mirroring defects at deploy dialog

editing code style

Updating Bidi Support

handling some reviewing comments

handling chicks

Update base-text-dir.js

Update bidi-util.js

Update bidi-util.js

Handling reviewing comment

Fixing Popover mirroring defect

Handling namespace structure for bidi features

reflecting new namespace structure for bidi features at editorfiles

Handling comments that related to css

moving bidi.js under js/bidi folder
2016-12-05 14:10:31 +00:00

184 lines
7.6 KiB
HTML

<!--
Copyright 2014, 2015 IBM Corp.
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.
-->
<script type="text/x-red" data-template-name="trigger">
<div class="form-row">
<label data-i18n="trigger.send" for="node-input-op1"></label>
<input type="hidden" id="node-input-op1type">
<input style="width: 70%" type="text" id="node-input-op1">
</div>
<div class="form-row">
<label data-i18n="trigger.then"></label>
<select id="node-then-type" style="width:70%;">
<option value="block" data-i18n="trigger.wait-reset"></option>
<option value="wait" data-i18n="trigger.wait-for"></option>
</select>
</div>
<div class="form-row node-type-wait">
<label></label>
<input type="text" id="node-input-duration" style="text-align:end; width:70px !important">
<select id="node-input-units" style="width:140px !important">
<option value="ms" data-i18n="trigger.duration.ms"></option>
<option value="s" data-i18n="trigger.duration.s"></option>
<option value="min" data-i18n="trigger.duration.m"></option>
<option value="hr" data-i18n="trigger.duration.h"></option>
</select>
</div>
<div class="form-row node-type-wait">
<label></label>
<input type="checkbox" id="node-input-extend" style="margin-left: 0px; vertical-align: top; width: auto !important;"> <label style="width:auto !important;" for="node-input-extend" data-i18n="trigger.extend"></label>
</div>
<div class="form-row node-type-wait">
<label data-i18n="trigger.then-send"></label>
<input type="hidden" id="node-input-op2type">
<input style="width: 70%" type="text" id="node-input-op2">
</div>
<div class="form-row">
<label data-i18n="trigger.label.reset" style="width:auto"></label>
<div class="trigger-reset-options-div" >
<ul>
<li data-i18n="trigger.label.resetMessage"></li>
<li><span data-i18n="trigger.label.resetPayload"></span> <input type="text" id="node-input-reset" style="width:150px" data-i18n="[placeholder]trigger.label.resetprompt"></li>
</ul>
</div>
<br/>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"></input>
</div>
</script>
<script type="text/x-red" data-help-name="trigger">
<p>Creates two messages on the output separated by a timeout whenever <i>any</i> <code>msg</code> arrives on the input.</p>
<p>For example, this can be used to toggle a Raspberry PI GPIO pin on and off.</p>
<p>The two output states can be specified as can the duration of the timer.
Either output can be set to a value, or templated from the inbound
<code>msg</code> using mustache syntax. <pre>The payload is {{payload}}</pre></p>
<p>If the <code>msg.payload</code> is an object then setting the output to
<i>existing payload</i> will pass the complete payload object through.</p>
<p>Optionally the timer can be extended by being retriggered... or not.</p>
<p>By setting the first output to <i>nothing</i>, and selecting extend timer - a watchdog timer can be created.
No output will happen as long as repeated inputs occur within the timeout period.</p>
<p>Setting the timer to 0 creates an "infinite" timeout - the first output will happen but the second
never will, and neither can the first be retriggered - so a true one shot.</p>
<p>If a <code>msg.reset</code> property is present, or the <code>msg.payload</code>
matches the optional reset value, any timeout currently in progress
will be cleared and the second output will not happen.</p>
<p>The blue status icon will be visible while the node is active.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('trigger',{
category: 'function',
color:"#E6E0F8",
defaults: {
op1: {value:"1"},
op2: {value:"0"},
op1type: {value:"val"},
op2type: {value:"val"},
duration: {value:"250",required:true,validate:RED.validators.number()},
extend: {value:"false"},
units: {value:"ms"},
reset: {value:""},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "trigger.png",
label: function() {
if (this.duration > 0) {
return this.name|| this._("trigger.label.trigger")+" "+this.duration+this.units;
}
else {
return this.name|| this._("trigger.label.trigger-block");
}
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
$("#node-then-type").change(function() {
if ($(this).val() == "block") {
$(".node-type-wait").hide();
} else {
$(".node-type-wait").show();
}
});
if (this.op1type === 'val') {
$("#node-input-op1type").val('str');
}
if (this.op2type === 'val') {
$("#node-input-op2type").val('str');
}
var optionNothing = {value:"nul",label:this._("trigger.output.nothing"),hasValue:false};
var optionPayload = {value:"pay",label:this._("trigger.output.existing"),hasValue:false}
var optionOriginalPayload = {value:"pay",label:this._("trigger.output.original"),hasValue:false}
var optionLatestPayload = {value:"payl",label:this._("trigger.output.latest"),hasValue:false}
$("#node-input-op1").typedInput({
default: 'str',
typeField: $("#node-input-op1type"),
types:['flow','global','str','num','bool','json',
optionPayload,
optionNothing
]
});
$("#node-input-op2").typedInput({
default: 'str',
typeField: $("#node-input-op2type"),
types:['flow','global','str','num','bool','json',
optionOriginalPayload,
optionLatestPayload,
optionNothing
]
});
if (this.duration == "0") {
$("#node-then-type").val("block");
} else {
$("#node-then-type").val("wait");
}
$("#node-then-type").change();
if (this.extend === "true" || this.extend === true) {
$("#node-input-extend").prop("checked",true);
} else {
$("#node-input-extend").prop("checked",false);
}
},
oneditsave: function() {
if ($("#node-then-type").val() == "block") {
$("#node-input-duration").val("0");
}
}
});
</script>
<style>
.trigger-reset-options-div {
display:inline-block;
width:70%;
vertical-align:top;
}
[dir="rtl"] .trigger-reset-options-div {
padding-right: 13px;
}
</style>