mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-10 05:05:26 +03:00
Show activity indicator when review items are null
This commit is contained in:
parent
e23fea1ca6
commit
947089559b
@ -106,6 +106,10 @@ export default function EventView({
|
|||||||
// review paging
|
// review paging
|
||||||
|
|
||||||
const reviewItems = useMemo(() => {
|
const reviewItems = useMemo(() => {
|
||||||
|
if (!reviews) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const all: ReviewSegment[] = [];
|
const all: ReviewSegment[] = [];
|
||||||
const alerts: ReviewSegment[] = [];
|
const alerts: ReviewSegment[] = [];
|
||||||
const detections: ReviewSegment[] = [];
|
const detections: ReviewSegment[] = [];
|
||||||
@ -167,7 +171,7 @@ export default function EventView({
|
|||||||
|
|
||||||
const exportReview = useCallback(
|
const exportReview = useCallback(
|
||||||
(id: string) => {
|
(id: string) => {
|
||||||
const review = reviewItems.all?.find((seg) => seg.id == id);
|
const review = reviewItems?.all?.find((seg) => seg.id == id);
|
||||||
|
|
||||||
if (!review) {
|
if (!review) {
|
||||||
return;
|
return;
|
||||||
@ -280,7 +284,7 @@ export default function EventView({
|
|||||||
|
|
||||||
type DetectionReviewProps = {
|
type DetectionReviewProps = {
|
||||||
contentRef: MutableRefObject<HTMLDivElement | null>;
|
contentRef: MutableRefObject<HTMLDivElement | null>;
|
||||||
reviewItems: {
|
reviewItems?: {
|
||||||
all: ReviewSegment[];
|
all: ReviewSegment[];
|
||||||
alert: ReviewSegment[];
|
alert: ReviewSegment[];
|
||||||
detection: ReviewSegment[];
|
detection: ReviewSegment[];
|
||||||
@ -313,10 +317,14 @@ function DetectionReview({
|
|||||||
|
|
||||||
// review data
|
// review data
|
||||||
const currentItems = useMemo(() => {
|
const currentItems = useMemo(() => {
|
||||||
|
if (!reviewItems) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const current = reviewItems[severity];
|
const current = reviewItems[severity];
|
||||||
|
|
||||||
if (!current || current.length == 0) {
|
if (!current || current.length == 0) {
|
||||||
return null;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter?.showReviewed != 1) {
|
if (filter?.showReviewed != 1) {
|
||||||
@ -326,7 +334,7 @@ function DetectionReview({
|
|||||||
}
|
}
|
||||||
// only refresh when severity or filter changes
|
// only refresh when severity or filter changes
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [severity, filter, reviewItems.all.length]);
|
}, [severity, filter, reviewItems?.all.length]);
|
||||||
|
|
||||||
// preview
|
// preview
|
||||||
|
|
||||||
@ -351,7 +359,7 @@ function DetectionReview({
|
|||||||
// timeline interaction
|
// timeline interaction
|
||||||
|
|
||||||
const { alignStartDateToTimeline } = useEventUtils(
|
const { alignStartDateToTimeline } = useEventUtils(
|
||||||
reviewItems.all,
|
reviewItems?.all ?? [],
|
||||||
segmentDuration,
|
segmentDuration,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -444,7 +452,13 @@ function DetectionReview({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(currentItems == null || currentItems.length == 0) && (
|
{currentItems == null && (
|
||||||
|
<div className="absolute left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2">
|
||||||
|
<ActivityIndicator />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{currentItems != null && currentItems.length == 0 && (
|
||||||
<div className="absolute left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2 flex flex-col justify-center items-center text-center">
|
<div className="absolute left-1/2 -translate-x-1/2 top-1/2 -translate-y-1/2 flex flex-col justify-center items-center text-center">
|
||||||
<LuFolderCheck className="size-16" />
|
<LuFolderCheck className="size-16" />
|
||||||
There are no {severity.replace(/_/g, " ")}s to review
|
There are no {severity.replace(/_/g, " ")}s to review
|
||||||
@ -508,7 +522,7 @@ function DetectionReview({
|
|||||||
minimapEndTime={minimapBounds.end}
|
minimapEndTime={minimapBounds.end}
|
||||||
showHandlebar={previewTime != undefined}
|
showHandlebar={previewTime != undefined}
|
||||||
handlebarTime={previewTime}
|
handlebarTime={previewTime}
|
||||||
events={reviewItems.all}
|
events={reviewItems?.all ?? []}
|
||||||
severityType={severity}
|
severityType={severity}
|
||||||
contentRef={contentRef}
|
contentRef={contentRef}
|
||||||
/>
|
/>
|
||||||
@ -519,7 +533,7 @@ function DetectionReview({
|
|||||||
|
|
||||||
type MotionReviewProps = {
|
type MotionReviewProps = {
|
||||||
contentRef: MutableRefObject<HTMLDivElement | null>;
|
contentRef: MutableRefObject<HTMLDivElement | null>;
|
||||||
reviewItems: {
|
reviewItems?: {
|
||||||
all: ReviewSegment[];
|
all: ReviewSegment[];
|
||||||
alert: ReviewSegment[];
|
alert: ReviewSegment[];
|
||||||
detection: ReviewSegment[];
|
detection: ReviewSegment[];
|
||||||
@ -685,7 +699,7 @@ function MotionReview({
|
|||||||
showHandlebar
|
showHandlebar
|
||||||
handlebarTime={currentTime}
|
handlebarTime={currentTime}
|
||||||
setHandlebarTime={setCurrentTime}
|
setHandlebarTime={setCurrentTime}
|
||||||
events={reviewItems.all}
|
events={reviewItems?.all ?? []}
|
||||||
motion_events={motionData ?? []}
|
motion_events={motionData ?? []}
|
||||||
severityType="significant_motion"
|
severityType="significant_motion"
|
||||||
contentRef={contentRef}
|
contentRef={contentRef}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user