diff --git a/nodes/get-history/get-history.html b/nodes/get-history/get-history.html index 109ff45bce..1b677ae947 100644 --- a/nodes/get-history/get-history.html +++ b/nodes/get-history/get-history.html @@ -8,7 +8,12 @@ startdate: { value: "" }, enddate: { value: "" }, entityid: { value: "" }, - entityidtype: { value: "" } + entityidtype: { value: "" }, + useRelativeTime: { value: false }, + relativeTime: { value: "" }, + output_type: { value: "array" }, + output_location_type: { value: "msg" }, + output_location: { value: "payload" } }, inputs: 1, outputs: 1, @@ -18,7 +23,9 @@ if (this.name) { return this.name; } - if (this.startdate) { + if (this.useRelativeTime && this.relativeTime) { + return this.relativeTime; + } else if (this.startdate) { const startdate = new Date(this.startdate); return `${startdate.toLocaleDateString()} ${startdate.toLocaleTimeString()}`; } @@ -68,7 +75,7 @@ }); const validSelection = - this.availableEntities.indexOf(this.entity_id) > -1; + this.availableEntities.indexOf(NODE.entityid) > -1; if (validSelection) { $entityIdField.removeClass("input-error"); } else { @@ -88,6 +95,34 @@ } }); } + + $("#node-input-useRelativeTime").on("change", function() { + if (this.checked) { + $(".relative_row").show(); + $(".date_row").hide(); + } else { + $(".relative_row").hide(); + $(".date_row").show(); + } + }); + + if (this.output_location === undefined) { + $("#node-input-output_location").val("payload"); + } + if (this.output_type === undefined) { + $("#node-input-output_type").val("array"); + } + + $("#node-input-output_location").typedInput({ + types: ["msg", "flow", "global"], + typeField: "#node-input-output_location_type" + }); + + $("#node-input-output_type") + .on("change", e => + $(".output-option").toggle(e.target.value === "array") + ) + .trigger("change"); }, oneditsave: function() { this.entityid = $("#entity_id").val(); @@ -106,17 +141,6 @@ - -
- - -
- -
- - -
-
@@ -129,11 +153,60 @@
-
+
+   + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+

timestring will parse the following keywords into time values:

+
    +
  1. ms, milli, millisecond, milliseconds - will parse to milliseconds
  2. +
  3. s, sec, secs, second, seconds - will parse to seconds
  4. +
  5. m, min, mins, minute, minutes - will parse to minutes
  6. +
  7. h, hr, hrs, hour, hours - will parse to hours
  8. +
  9. d, day, days - will parse to days
  10. +
  11. w, week, weeks - will parse to weeks
  12. +
  13. mon, mth, mths, month, months - will parse to months
  14. +
  15. y, yr, yrs, year, years - will parse to years
  16. +
+
+ +
+ + +
+ +
+ + + +