mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 20:25:26 +03:00
update mock review event generator
This commit is contained in:
parent
1aa788b759
commit
de96206bff
@ -10,7 +10,7 @@ import ActivityIndicator from "@/components/ui/activity-indicator";
|
|||||||
import { useApiHost } from "@/api";
|
import { useApiHost } from "@/api";
|
||||||
import TimelineScrubber from "@/components/playground/TimelineScrubber";
|
import TimelineScrubber from "@/components/playground/TimelineScrubber";
|
||||||
import EventReviewTimeline from "@/components/timeline/EventReviewTimeline";
|
import EventReviewTimeline from "@/components/timeline/EventReviewTimeline";
|
||||||
import { ReviewSegment } from "@/types/review";
|
import { ReviewData, ReviewSegment, ReviewSeverity } from "@/types/review";
|
||||||
|
|
||||||
// Color data
|
// Color data
|
||||||
const colors = [
|
const colors = [
|
||||||
@ -59,14 +59,39 @@ function eventsToScrubberItems(events: Event[]): ScrubberItem[] {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateRandomEvent = (): Event => {
|
const generateRandomEvent = (): ReviewSegment => {
|
||||||
const start_time = Math.floor(Date.now() / 1000) - Math.random() * 60 * 60;
|
const start_time = Math.floor(Date.now() / 1000) - Math.random() * 60 * 60;
|
||||||
const end_time = Math.floor(start_time + Math.random() * 60 * 10);
|
const end_time = Math.floor(start_time + Math.random() * 60 * 10);
|
||||||
const severities = ["motion", "detection", "alert"];
|
const severities: ReviewSeverity[] = [
|
||||||
|
"significant_motion",
|
||||||
|
"detection",
|
||||||
|
"alert",
|
||||||
|
];
|
||||||
const severity = severities[Math.floor(Math.random() * severities.length)];
|
const severity = severities[Math.floor(Math.random() * severities.length)];
|
||||||
const has_been_reviewed = Math.random() < 0.2;
|
const has_been_reviewed = Math.random() < 0.2;
|
||||||
const id = new Date(start_time * 1000).toISOString(); // Date string as mock ID
|
const id = new Date(start_time * 1000).toISOString(); // Date string as mock ID
|
||||||
return { id, start_time, end_time, severity, has_been_reviewed };
|
|
||||||
|
// You need to provide values for camera, thumb_path, and data
|
||||||
|
const camera = "CameraXYZ";
|
||||||
|
const thumb_path = "/path/to/thumb";
|
||||||
|
const data: ReviewData = {
|
||||||
|
audio: [],
|
||||||
|
detections: [],
|
||||||
|
objects: [],
|
||||||
|
significant_motion_areas: [],
|
||||||
|
zones: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
|
severity,
|
||||||
|
has_been_reviewed,
|
||||||
|
camera,
|
||||||
|
thumb_path,
|
||||||
|
data,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function UIPlayground() {
|
function UIPlayground() {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export interface ReviewSegment {
|
|||||||
|
|
||||||
export type ReviewSeverity = "alert" | "detection" | "significant_motion";
|
export type ReviewSeverity = "alert" | "detection" | "significant_motion";
|
||||||
|
|
||||||
type ReviewData = {
|
export type ReviewData = {
|
||||||
audio: string[];
|
audio: string[];
|
||||||
detections: string[];
|
detections: string[];
|
||||||
objects: string[];
|
objects: string[];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user