mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tidy up some little wrinkles in Inject node html labels etc
This commit is contained in:
parent
7e2dbb13e4
commit
a0ac79384d
@ -136,10 +136,10 @@
|
|||||||
outputs:1,
|
outputs:1,
|
||||||
icon: "inject.png",
|
icon: "inject.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
if (this.payloadType == "string") {
|
if (this.payloadType === "string") {
|
||||||
return this.name||this.topic||this.payload||"inject";
|
return this.name||this.topic||this.payload||"inject";
|
||||||
}
|
}
|
||||||
else { return this.name||"inject"; }
|
else { return this.name||this.topic||"inject"; }
|
||||||
},
|
},
|
||||||
labelStyle: function() {
|
labelStyle: function() {
|
||||||
return this.name?"node_label_italic":"";
|
return this.name?"node_label_italic":"";
|
||||||
@ -158,7 +158,7 @@
|
|||||||
$("#node-input-once").prop('checked', false);
|
$("#node-input-once").prop('checked', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var days = [
|
var days = [
|
||||||
{v:"*",t:"every day"},
|
{v:"*",t:"every day"},
|
||||||
{v:"1-5",t:"Mondays to Fridays"},
|
{v:"1-5",t:"Mondays to Fridays"},
|
||||||
@ -171,31 +171,31 @@
|
|||||||
{v:"6",t:"Saturdays"},
|
{v:"6",t:"Saturdays"},
|
||||||
{v:"0",t:"Sundays"}
|
{v:"0",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));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".inject-time-times").each(function() {
|
$(".inject-time-times").each(function() {
|
||||||
for (var i=0;i<24;i++) {
|
for (var i=0;i<24;i++) {
|
||||||
var l = (i<10?"0":"")+i+":00";
|
var l = (i<10?"0":"")+i+":00";
|
||||||
$(this).append($("<option></option>").val(i).text(l));
|
$(this).append($("<option></option>").val(i).text(l));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".inject-time-count").spinner({
|
$(".inject-time-count").spinner({
|
||||||
//max:60,
|
//max:60,
|
||||||
min:1
|
min:1
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#inject-time-interval-units").change(function() {
|
$("#inject-time-interval-units").change(function() {
|
||||||
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
|
||||||
@ -222,11 +222,11 @@
|
|||||||
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();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var repeattype = "none";
|
var repeattype = "none";
|
||||||
if (this.repeat != "" && this.repeat != 0) {
|
if (this.repeat != "" && this.repeat != 0) {
|
||||||
repeattype = "interval";
|
repeattype = "interval";
|
||||||
@ -398,7 +398,9 @@
|
|||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
var label = (this.name||this.payload).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
var label = (this.name||this.payload).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
||||||
|
if (this.payloadType === "date") { label = "timestamp"; }
|
||||||
|
if (this.payloadType === "none") { label = "blank"; }
|
||||||
d3.xhr("inject/"+this.id).post(function(err,resp) {
|
d3.xhr("inject/"+this.id).post(function(err,resp) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.status == 404) {
|
if (err.status == 404) {
|
||||||
|
Loading…
Reference in New Issue
Block a user