mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
2d92b44f52
commit
2dac28a421
@ -83,8 +83,68 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-tips"><b>Note:</b> "interval between times" and "at a specific time" will use cron.<br/>See info box for details.</div>
|
<div class="form-tips"><b>Note:</b> "interval between times" and "at a specific time" will use cron.<br/>See info box for details.</div>
|
||||||
<script>
|
</script>
|
||||||
{
|
<style>
|
||||||
|
.inject-time-row {
|
||||||
|
padding-left: 110px;
|
||||||
|
}
|
||||||
|
.inject-time-row select {
|
||||||
|
margin: 3px 0;
|
||||||
|
}
|
||||||
|
.inject-time-days {
|
||||||
|
width: 262px;
|
||||||
|
}
|
||||||
|
.inject-time-times {
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
.inject-time-row > .ui-spinner {
|
||||||
|
height: 28px;
|
||||||
|
margin: 3px 0;
|
||||||
|
border-color: rgb(204, 204, 204);
|
||||||
|
}
|
||||||
|
#inject-time-time {
|
||||||
|
margin-top: 3px;
|
||||||
|
width: 75px;
|
||||||
|
}
|
||||||
|
.inject-time-count {
|
||||||
|
width: 40px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/x-red" data-help-name="inject">
|
||||||
|
<p>Pressing the button on the left side of the node allows a message on a topic to be injected into the flow. This is mainly for test purposes.</p>
|
||||||
|
<p>If no payload is specified the payload is set to the current time in millisecs since 1970. This allows subsequent functions to perform time based actions.</p>
|
||||||
|
<p>The repeat function does what it says on the tin and continuously sends the payload every x seconds.</p>
|
||||||
|
<p>The Fire once at start option actually waits 50mS before firing to give other nodes a chance to instantiate properly.</p>
|
||||||
|
<p><b>Note: </b>"Interval between times" and "at a specific time" will use cron. This means that 20 mins will be at the next hour, 20 mins past and 40 mins past - not in 20 minutes time.
|
||||||
|
If you want every 20 mins from now - use the basic "interval" option.</p>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
RED.nodes.registerType('inject',{
|
||||||
|
category: 'input',
|
||||||
|
color:"#a6bbcf",
|
||||||
|
defaults: {
|
||||||
|
name: {value:""},
|
||||||
|
topic: {value:""},
|
||||||
|
payload: {value:""},
|
||||||
|
payloadType: {value:"date"},
|
||||||
|
repeat: {value:""},
|
||||||
|
crontab: {value:""},
|
||||||
|
once: {value:false}
|
||||||
|
},
|
||||||
|
inputs:0,
|
||||||
|
outputs:1,
|
||||||
|
icon: "inject.png",
|
||||||
|
label: function() {
|
||||||
|
if (this.payloadType == "string") {
|
||||||
|
return this.name||this.topic||this.payload||"inject";
|
||||||
|
}
|
||||||
|
else { return this.name||"inject"; }
|
||||||
|
},
|
||||||
|
labelStyle: function() {
|
||||||
|
return this.name?"node_label_italic":"";
|
||||||
|
},
|
||||||
|
oneditprepare: function() {
|
||||||
$("#inject-time-type-select").change(function() {
|
$("#inject-time-type-select").change(function() {
|
||||||
$("#node-input-crontab").val('');
|
$("#node-input-crontab").val('');
|
||||||
var id = $("#inject-time-type-select option:selected").val();
|
var id = $("#inject-time-type-select option:selected").val();
|
||||||
@ -159,76 +219,14 @@
|
|||||||
var d = new Date(value);
|
var d = new Date(value);
|
||||||
var h = d.getHours();
|
var h = d.getHours();
|
||||||
var m = d.getMinutes();
|
var m = d.getMinutes();
|
||||||
return ((h<10)?"0":"")+h+":"+((m<10)?"0":"")+m;
|
return ((h < 10)?"0":"")+h+":"+((m < 10)?"0":"")+m;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#inject-time-time").injecttimespinner();
|
$("#inject-time-time").injecttimespinner();
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
.inject-time-row {
|
|
||||||
padding-left: 110px;
|
|
||||||
}
|
|
||||||
.inject-time-row select {
|
|
||||||
margin: 3px 0;
|
|
||||||
}
|
|
||||||
.inject-time-days {
|
|
||||||
width: 262px;
|
|
||||||
}
|
|
||||||
.inject-time-times {
|
|
||||||
width: 90px;
|
|
||||||
}
|
|
||||||
.inject-time-row > .ui-spinner {
|
|
||||||
height: 28px;
|
|
||||||
margin: 3px 0;
|
|
||||||
border-color: rgb(204, 204, 204);
|
|
||||||
}
|
|
||||||
#inject-time-time {
|
|
||||||
margin-top: 3px;
|
|
||||||
width: 75px;
|
|
||||||
}
|
|
||||||
.inject-time-count {
|
|
||||||
width: 40px !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/x-red" data-help-name="inject">
|
|
||||||
<p>Pressing the button on the left side of the node allows a message on a topic to be injected into the flow. This is mainly for test purposes.</p>
|
|
||||||
<p>If no payload is specified the payload is set to the current time in millisecs since 1970. This allows subsequent functions to perform time based actions.</p>
|
|
||||||
<p>The repeat function does what it says on the tin and continuously sends the payload every x seconds.</p>
|
|
||||||
<p>The Fire once at start option actually waits 50mS before firing to give other nodes a chance to instantiate properly.</p>
|
|
||||||
<p><b>Note: </b>"Interval between times" and "at a specific time" will use cron. This means that 20 mins will be at the next hour, 20 mins past and 40 mins past - not in 20 minutes time.
|
|
||||||
If you want every 20 mins from now - use the basic "interval" option.</p>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
RED.nodes.registerType('inject',{
|
|
||||||
category: 'input',
|
|
||||||
color:"#a6bbcf",
|
|
||||||
defaults: {
|
|
||||||
name: {value:""},
|
|
||||||
topic: {value:""},
|
|
||||||
payload: {value:""},
|
|
||||||
payloadType: {value:"date"},
|
|
||||||
repeat: {value:""},
|
|
||||||
crontab: {value:""},
|
|
||||||
once: {value:false}
|
|
||||||
},
|
|
||||||
inputs:0,
|
|
||||||
outputs:1,
|
|
||||||
icon: "inject.png",
|
|
||||||
label: function() {
|
|
||||||
if (this.payloadType == "string") {
|
|
||||||
return this.name||this.topic||this.payload||"inject";
|
|
||||||
}
|
|
||||||
else { return this.name||"inject"; }
|
|
||||||
},
|
|
||||||
labelStyle: function() {
|
|
||||||
return this.name?"node_label_italic":"";
|
|
||||||
},
|
|
||||||
oneditprepare: function() {
|
|
||||||
var repeattype = "none";
|
var repeattype = "none";
|
||||||
if (this.repeat != "" && this.repeat != 0) {
|
if (this.repeat != "" && this.repeat != 0) {
|
||||||
repeattype = "interval";
|
repeattype = "interval";
|
||||||
|
@ -455,7 +455,7 @@ RED.editor = (function() {
|
|||||||
function showEditDialog(node) {
|
function showEditDialog(node) {
|
||||||
editing_node = node;
|
editing_node = node;
|
||||||
RED.view.state(RED.state.EDITING);
|
RED.view.state(RED.state.EDITING);
|
||||||
$("#dialog-form").html($("script[data-template-name='"+node.type+"']").html());
|
$("#dialog-form").html($("script[data-template-name='"+node.type+"']").html()+'<input type="text" style="display: none;" />');
|
||||||
prepareEditDialog(node,node._def,"node-input");
|
prepareEditDialog(node,node._def,"node-input");
|
||||||
$( "#dialog" ).dialog("option","title","Edit "+node.type+" node").dialog( "open" );
|
$( "#dialog" ).dialog("option","title","Edit "+node.type+" node").dialog( "open" );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user