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.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="exec">
|
|
|
|
<div class="form-row">
|
2015-05-26 22:11:14 +02:00
|
|
|
<label for="node-input-command"><i class="fa fa-file"></i> <span data-i18n="exec.label.command"></span></label>
|
|
|
|
<input type="text" id="node-input-command" data-i18n="[placeholder]exec.label.command">
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-05-26 22:11:14 +02:00
|
|
|
<label><i class="fa fa-plus"></i> <span data-i18n="exec.label.append"></span></label>
|
2017-04-13 12:36:54 +02:00
|
|
|
<input type="checkbox" id="node-input-addpay" style="display:inline-block; width:auto; vertical-align:top;">
|
2015-03-11 18:43:42 +01:00
|
|
|
msg.payload
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-append"> </label>
|
2015-05-26 22:11:14 +02:00
|
|
|
<input type="text" id="node-input-append" data-i18n="[placeholder]exec.placeholder.extraparams">
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
2017-04-13 12:36:54 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label><i class="fa fa-sign-out"></i> <span data-i18n="exec.label.return"></span></label>
|
|
|
|
<select type="text" id="node-input-useSpawn" style="width:70%">
|
|
|
|
<option value="false" data-i18n="exec.opt.exec"></option>
|
|
|
|
<option value="true" data-i18n="exec.opt.spawn"></option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2016-04-27 23:32:58 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-timer"><i class="fa fa-clock-o"></i> <span data-i18n="exec.label.timeout"></span></label>
|
2017-07-19 14:50:34 +02:00
|
|
|
<input type="text" id="node-input-timer" style="width:65px;" data-i18n="[placeholder]exec.label.timeoutplace">
|
|
|
|
<span data-i18n="exec.label.seconds"></span>
|
2013-09-05 16:02:48 +02:00
|
|
|
</div>
|
|
|
|
<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('exec',{
|
2019-07-09 21:26:26 +02:00
|
|
|
category: 'function',
|
2013-09-05 16:02:48 +02:00
|
|
|
color:"darksalmon",
|
|
|
|
defaults: {
|
2017-03-29 22:44:58 +02:00
|
|
|
command: {value:""},
|
2015-03-11 18:43:42 +01:00
|
|
|
addpay: {value:true},
|
2013-09-05 16:02:48 +02:00
|
|
|
append: {value:""},
|
2017-04-13 12:36:54 +02:00
|
|
|
useSpawn: {value:"false"},
|
2016-04-27 23:32:58 +02:00
|
|
|
timer: {value:""},
|
2017-04-13 12:36:54 +02:00
|
|
|
oldrc: {value:false},
|
2013-09-05 16:02:48 +02:00
|
|
|
name: {value:""}
|
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:3,
|
2019-02-28 12:22:33 +01:00
|
|
|
outputLabels: function(i) {
|
|
|
|
return [
|
|
|
|
this._("exec.label.stdout"),
|
|
|
|
this._("exec.label.stderr"),
|
|
|
|
this._("exec.label.retcode")
|
|
|
|
][i];
|
|
|
|
},
|
2019-07-10 00:32:22 +02:00
|
|
|
icon: "cog.svg",
|
2013-09-05 16:02:48 +02:00
|
|
|
label: function() {
|
2018-03-30 15:31:59 +02:00
|
|
|
return this.name||this.command||(this.useSpawn=="true"?this._("exec.spawn"):this._("exec.exec"));
|
2014-06-17 21:07:29 +02:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2017-04-13 12:36:54 +02:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
if ($("#node-input-useSpawn").val() === null) {
|
|
|
|
$("#node-input-useSpawn").val(this.useSpawn.toString());
|
|
|
|
}
|
2013-09-05 16:02:48 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|