|
16 | 16 |
|
17 | 17 | <script type="text/x-red" data-template-name="trigger"> |
18 | 18 | <div class="form-row"> |
19 | | - <span data-i18n="trigger.send"></span> |
20 | | - <select id="node-input-op1type" style="width:200px !important"> |
21 | | - <option value="val" data-i18n="trigger.output.string"></option> |
22 | | - <option value="num" data-i18n="trigger.output.number"></option> |
23 | | - <option value="pay" data-i18n="trigger.output.existing"></option> |
24 | | - <option value="nul" data-i18n="trigger.output.nothing"></option> |
25 | | - </select> |
26 | | - <input style="width: 180px !important" type="text" id="node-input-op1"> |
| 19 | + <label data-i18n="trigger.send" for="node-input-op1"></label> |
| 20 | + <input type="hidden" id="node-input-op1type"> |
| 21 | + <input style="width: 70%" type="text" id="node-input-op1"> |
27 | 22 | </div> |
28 | 23 | <div class="form-row"> |
29 | | - <span data-i18n="trigger.then"></span> |
30 | | - <select id="node-then-type" style="width:150px;"> |
| 24 | + <label data-i18n="trigger.then"></label> |
| 25 | + <select id="node-then-type" style="width:70%;"> |
31 | 26 | <option value="block" data-i18n="trigger.wait-reset"></option> |
32 | 27 | <option value="wait" data-i18n="trigger.wait-for"></option> |
33 | 28 | </select> |
34 | | - <span class="node-type-wait"> |
35 | | - <input type="text" id="node-input-duration" style="text-align:end; width:70px !important"> |
36 | | - <select id="node-input-units" style="width:140px !important"> |
37 | | - <option value="ms" data-i18n="trigger.duration.ms"></option> |
38 | | - <option value="s" data-i18n="trigger.duration.s"></option> |
39 | | - <option value="min" data-i18n="trigger.duration.m"></option> |
40 | | - <option value="hr" data-i18n="trigger.duration.h"></option> |
41 | | - </select> |
42 | | - </span> |
43 | 29 | </div> |
44 | 30 | <div class="form-row node-type-wait"> |
| 31 | + <label></label> |
| 32 | + <input type="text" id="node-input-duration" style="text-align:end; width:70px !important"> |
| 33 | + <select id="node-input-units" style="width:140px !important"> |
| 34 | + <option value="ms" data-i18n="trigger.duration.ms"></option> |
| 35 | + <option value="s" data-i18n="trigger.duration.s"></option> |
| 36 | + <option value="min" data-i18n="trigger.duration.m"></option> |
| 37 | + <option value="hr" data-i18n="trigger.duration.h"></option> |
| 38 | + </select> |
| 39 | + </div> |
| 40 | + <div class="form-row node-type-wait"> |
| 41 | + <label></label> |
45 | 42 | <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> |
46 | 43 | </div> |
47 | 44 | <div class="form-row node-type-wait"> |
48 | | - <span data-i18n="trigger.then-send"></span> |
49 | | - <select id="node-input-op2type" style="width:200px !important"> |
50 | | - <option value="val" data-i18n="trigger.output.string"></option> |
51 | | - <option value="num" data-i18n="trigger.output.number"></option> |
52 | | - <option value="pay" data-i18n="trigger.output.original"></option> |
53 | | - <option value="payl" data-i18n="trigger.output.latest"></option> |
54 | | - <option value="nul" data-i18n="trigger.output.nothing"></option> |
55 | | - </select> |
56 | | - <input style="width: 145px !important" type="text" id="node-input-op2"> |
| 45 | + <label data-i18n="trigger.then-send"></label> |
| 46 | + <input type="hidden" id="node-input-op2type"> |
| 47 | + <input style="width: 70%" type="text" id="node-input-op2"> |
57 | 48 | </div> |
58 | 49 | <div class="form-row"> |
59 | | - <span data-i18n="trigger.label.reset"></span><input type="text" id="node-input-reset" style="width:240px" data-i18n="[placeholder]trigger.label.resetprompt"> |
| 50 | + <label data-i18n="trigger.label.reset" style="width:auto"></label> |
| 51 | + <div style="display:inline-block; width:70%;vertical-align:top"> |
| 52 | + <ul> |
| 53 | + <li data-i18n="trigger.label.resetMessage"></li> |
| 54 | + <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> |
| 55 | + </ul> |
60 | 56 | </div> |
61 | 57 | <br/> |
62 | 58 | <div class="form-row"> |
63 | 59 | <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> |
64 | 60 | <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"></input> |
65 | 61 | </div> |
66 | | - <div class="form-tips" data-i18n="[html]trigger.tip"></div> |
67 | 62 | </script> |
68 | 63 |
|
69 | 64 | <script type="text/x-red" data-help-name="trigger"> |
|
118 | 113 | $("#node-then-type").change(function() { |
119 | 114 | if ($(this).val() == "block") { |
120 | 115 | $(".node-type-wait").hide(); |
121 | | - $(".form-tips").show(); |
122 | 116 | } else { |
123 | 117 | $(".node-type-wait").show(); |
124 | | - $(".form-tips").hide(); |
125 | 118 | } |
126 | 119 | }); |
127 | | - $("#node-input-op1type").change(function() { |
128 | | - if (($(this).val() == "val")||($(this).val() == "num")) { |
129 | | - $("#node-input-op1").show(); |
130 | | - } else { |
131 | | - $("#node-input-op1").hide(); |
132 | | - } |
| 120 | + |
| 121 | + if (this.op1type === 'val') { |
| 122 | + $("#node-input-op1type").val('str'); |
| 123 | + } |
| 124 | + if (this.op2type === 'val') { |
| 125 | + $("#node-input-op2type").val('str'); |
| 126 | + } |
| 127 | + |
| 128 | + var optionNothing = {value:"nul",label:this._("trigger.output.nothing"),hasValue:false}; |
| 129 | + var optionPayload = {value:"pay",label:this._("trigger.output.existing"),hasValue:false} |
| 130 | + |
| 131 | + var optionOriginalPayload = {value:"pay",label:this._("trigger.output.original"),hasValue:false} |
| 132 | + var optionLatestPayload = {value:"payl",label:this._("trigger.output.latest"),hasValue:false} |
| 133 | + |
| 134 | + $("#node-input-op1").typedInput({ |
| 135 | + default: 'str', |
| 136 | + typeField: $("#node-input-op1type"), |
| 137 | + types:['flow','global','str','num','bool','json', |
| 138 | + optionPayload, |
| 139 | + optionNothing |
| 140 | + ] |
133 | 141 | }); |
134 | | - $("#node-input-op2type").change(function() { |
135 | | - if (($(this).val() == "val")||($(this).val() == "num")) { |
136 | | - $("#node-input-op2").show(); |
137 | | - } else { |
138 | | - $("#node-input-op2").hide(); |
139 | | - } |
| 142 | + $("#node-input-op2").typedInput({ |
| 143 | + default: 'str', |
| 144 | + typeField: $("#node-input-op2type"), |
| 145 | + types:['flow','global','str','num','bool','json', |
| 146 | + optionOriginalPayload, |
| 147 | + optionLatestPayload, |
| 148 | + optionNothing |
| 149 | + ] |
140 | 150 | }); |
| 151 | + |
141 | 152 | if (this.duration == "0") { |
142 | 153 | $("#node-then-type").val("block"); |
143 | 154 | } else { |
144 | 155 | $("#node-then-type").val("wait"); |
145 | 156 | } |
146 | 157 | $("#node-then-type").change(); |
147 | | - $("#node-input-op1type").change(); |
148 | | - $("#node-input-op2type").change(); |
149 | 158 |
|
150 | 159 | if (this.extend === "true" || this.extend === true) { |
151 | 160 | $("#node-input-extend").prop("checked",true); |
|
0 commit comments