mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Show correct time range when time filter is active (#10066)
* Show correct time range when time filter is active * remove console
This commit is contained in:
parent
20578de9d0
commit
e9076c0213
@ -28,9 +28,19 @@ export default function Events() {
|
|||||||
|
|
||||||
// review paging
|
// review paging
|
||||||
|
|
||||||
const timeRange = useMemo(() => {
|
const last24Hours = useMemo(() => {
|
||||||
return { before: Date.now() / 1000, after: getHoursAgo(24) };
|
return { before: Date.now() / 1000, after: getHoursAgo(24) };
|
||||||
}, []);
|
}, []);
|
||||||
|
const selectedTimeRange = useMemo(() => {
|
||||||
|
if (reviewSearchParams["after"] == undefined) {
|
||||||
|
return last24Hours;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
before: Math.floor(reviewSearchParams["before"]),
|
||||||
|
after: Math.floor(reviewSearchParams["after"]),
|
||||||
|
};
|
||||||
|
}, [reviewSearchParams]);
|
||||||
|
|
||||||
const reviewSegmentFetcher = useCallback((key: any) => {
|
const reviewSegmentFetcher = useCallback((key: any) => {
|
||||||
const [path, params] = Array.isArray(key) ? key : [key, undefined];
|
const [path, params] = Array.isArray(key) ? key : [key, undefined];
|
||||||
@ -47,7 +57,7 @@ export default function Events() {
|
|||||||
labels: reviewSearchParams["labels"],
|
labels: reviewSearchParams["labels"],
|
||||||
reviewed: reviewSearchParams["showReviewed"],
|
reviewed: reviewSearchParams["showReviewed"],
|
||||||
before: lastDate,
|
before: lastDate,
|
||||||
after: reviewSearchParams["after"] || timeRange.after,
|
after: reviewSearchParams["after"] || last24Hours.after,
|
||||||
limit: API_LIMIT,
|
limit: API_LIMIT,
|
||||||
};
|
};
|
||||||
return ["review", pagedParams];
|
return ["review", pagedParams];
|
||||||
@ -58,8 +68,8 @@ export default function Events() {
|
|||||||
labels: reviewSearchParams["labels"],
|
labels: reviewSearchParams["labels"],
|
||||||
reviewed: reviewSearchParams["showReviewed"],
|
reviewed: reviewSearchParams["showReviewed"],
|
||||||
limit: API_LIMIT,
|
limit: API_LIMIT,
|
||||||
before: reviewSearchParams["before"] || timeRange.before,
|
before: reviewSearchParams["before"] || last24Hours.before,
|
||||||
after: reviewSearchParams["after"] || timeRange.after,
|
after: reviewSearchParams["after"] || last24Hours.after,
|
||||||
};
|
};
|
||||||
return ["review", params];
|
return ["review", params];
|
||||||
},
|
},
|
||||||
@ -205,7 +215,7 @@ export default function Events() {
|
|||||||
<DesktopEventView
|
<DesktopEventView
|
||||||
reviewPages={reviewPages}
|
reviewPages={reviewPages}
|
||||||
relevantPreviews={allPreviews}
|
relevantPreviews={allPreviews}
|
||||||
timeRange={timeRange}
|
timeRange={selectedTimeRange}
|
||||||
reachedEnd={isDone}
|
reachedEnd={isDone}
|
||||||
isValidating={isValidating}
|
isValidating={isValidating}
|
||||||
filter={reviewFilter}
|
filter={reviewFilter}
|
||||||
|
Loading…
Reference in New Issue
Block a user