mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tweak Inject Fire at Once options as per Issue #145
This commit is contained in:
parent
bdd9d901ec
commit
b1de42b297
@ -23,6 +23,7 @@
|
|||||||
<option value="string">string</option>
|
<option value="string">string</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row" id="node-input-row-payload">
|
<div class="form-row" id="node-input-row-payload">
|
||||||
<label for="node-input-payload"></label>
|
<label for="node-input-payload"></label>
|
||||||
<input type="text" id="node-input-payload" placeholder="Payload">
|
<input type="text" id="node-input-payload" placeholder="Payload">
|
||||||
@ -33,9 +34,9 @@
|
|||||||
<input type="text" id="node-input-topic" placeholder="Topic">
|
<input type="text" id="node-input-topic" placeholder="Topic">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row" id="node-once">
|
||||||
<label> </label>
|
<label> </label>
|
||||||
<input type="checkbox" id="node-input-once" placeholder="once" style="display: inline-block; width: auto; vertical-align: top;">
|
<input type="checkbox" id="node-input-once" style="display: inline-block; width: auto; vertical-align: top;">
|
||||||
<label for="node-input-once" style="width: 70%;">Fire once at start ?</label>
|
<label for="node-input-once" style="width: 70%;">Fire once at start ?</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -71,11 +72,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
{
|
{
|
||||||
|
|
||||||
$("#inject-time-type-select").change(function() {
|
$("#inject-time-type-select").change(function() {
|
||||||
|
$("#node-input-crontab").val('');
|
||||||
var id = $("#inject-time-type-select option:selected").val();
|
var id = $("#inject-time-type-select option:selected").val();
|
||||||
$(".inject-time-row").hide();
|
$(".inject-time-row").hide();
|
||||||
$("#inject-time-row-"+id).show();
|
$("#inject-time-row-"+id).show();
|
||||||
|
if ((id == "none") || (id == "interval")) {
|
||||||
|
$("#node-once").show();
|
||||||
|
}
|
||||||
|
else { $("#node-once").hide(); }
|
||||||
});
|
});
|
||||||
|
|
||||||
var days = [
|
var days = [
|
||||||
@ -90,6 +95,7 @@
|
|||||||
{v:"6",t:"Saturdays"},
|
{v:"6",t:"Saturdays"},
|
||||||
{v:"7",t:"Sundays"}
|
{v:"7",t:"Sundays"}
|
||||||
];
|
];
|
||||||
|
|
||||||
$(".inject-time-days").each(function() {
|
$(".inject-time-days").each(function() {
|
||||||
for (var d in days) {
|
for (var d in days) {
|
||||||
$(this).append($("<option></option>").val(days[d].v).text(days[d].t));
|
$(this).append($("<option></option>").val(days[d].v).text(days[d].t));
|
||||||
@ -102,6 +108,7 @@
|
|||||||
$(this).append($("<option></option>").val(i).text(l));
|
$(this).append($("<option></option>").val(i).text(l));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".inject-time-count").spinner({
|
$(".inject-time-count").spinner({
|
||||||
min:1,
|
min:1,
|
||||||
max:60
|
max:60
|
||||||
@ -111,10 +118,8 @@
|
|||||||
var units = $("#inject-time-interval-units option:selected").val();
|
var units = $("#inject-time-interval-units option:selected").val();
|
||||||
$("#inject-time-interval-days").prop("disabled",(units == "s")?"disabled":false);
|
$("#inject-time-interval-days").prop("disabled",(units == "s")?"disabled":false);
|
||||||
$(".inject-time-count").spinner("option","max",(units == "h")?24:60);
|
$(".inject-time-count").spinner("option","max",(units == "h")?24:60);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$.widget( "ui.injecttimespinner", $.ui.spinner, {
|
$.widget( "ui.injecttimespinner", $.ui.spinner, {
|
||||||
options: {
|
options: {
|
||||||
// seconds
|
// seconds
|
||||||
@ -139,16 +144,13 @@
|
|||||||
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>
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
@ -176,8 +178,6 @@
|
|||||||
.inject-time-count {
|
.inject-time-count {
|
||||||
width: 30px !important;
|
width: 30px !important;
|
||||||
}
|
}
|
||||||
.
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script type="text/x-red" data-help-name="inject">
|
<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>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>
|
||||||
@ -307,6 +307,7 @@
|
|||||||
});
|
});
|
||||||
$("#node-input-payloadType").val(this.payloadType);
|
$("#node-input-payloadType").val(this.payloadType);
|
||||||
$("#node-input-payloadType").change();
|
$("#node-input-payloadType").change();
|
||||||
|
$("#inject-time-type-select").change();
|
||||||
|
|
||||||
},
|
},
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
|
@ -32,6 +32,9 @@ function InjectNode(n) {
|
|||||||
var node = this;
|
var node = this;
|
||||||
this.interval_id = null;
|
this.interval_id = null;
|
||||||
this.cronjob = null;
|
this.cronjob = null;
|
||||||
|
if (this.crontab) {
|
||||||
|
if (this.crontab.split(" ")[4] != "*") { this.once = false; }
|
||||||
|
}
|
||||||
|
|
||||||
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
|
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
|
||||||
this.repeat = this.repeat * 1000;
|
this.repeat = this.repeat * 1000;
|
||||||
|
Loading…
Reference in New Issue
Block a user