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 @@ - -
timestring
will parse the following keywords into time values:
ms, milli, millisecond, milliseconds
- will parse to millisecondss, sec, secs, second, seconds
- will parse to secondsm, min, mins, minute, minutes
- will parse to minutesh, hr, hrs, hour, hours
- will parse to hoursd, day, days
- will parse to daysw, week, weeks
- will parse to weeksmon, mth, mths, month, months
- will parse to monthsy, yr, yrs, year, years
- will parse to years