Skip to content

Commit

Permalink
Merge pull request #18774 from jeclrsg/hpcc-32076-logs-filter-start-date
Browse files Browse the repository at this point in the history
HPCC-32076 ECL Watch v9 fix Logs filter start date

Reviewed-by: Gordon Smith <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Jun 19, 2024
2 parents 8da1aee + bfb1f42 commit fedef8f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions esp/src/src-react/components/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Filter } from "./forms/Filter";
import { Fields } from "./forms/Fields";
import { ShortVerticalDivider } from "./Common";

const maximumTimeUntilRefresh = 8 * 60 * 60 * 1000;
const eightHours = 8 * 60 * 60 * 1000;
const startTimeOffset = 1 * 60 * 60 * 1000;
const endTimeOffset = 23 * 60 * 60 * 1000;
const defaultStartDate = new Date(new Date().getTime() - startTimeOffset);
Expand Down Expand Up @@ -115,8 +115,9 @@ export const Logs: React.FunctionComponent<LogsProps> = ({
if (typeof filter.StartDate === "string") {
filter.StartDate = new Date(filter.StartDate + ":00Z");
}
if (filter.StartDate && now.getTime() - filter.StartDate.getTime() > maximumTimeUntilRefresh) {
filter.StartDate = new Date(now.getTime() - startTimeOffset);
if (!filter.StartDate) {
//assign a reasonable default start date if one isn't set
filter.StartDate = new Date(now.getTime() - eightHours);
}
if (!filter.EndDate) {
filter.EndDate = new Date(now.getTime() + endTimeOffset);
Expand Down

0 comments on commit fedef8f

Please sign in to comment.