mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 05:35:25 +03:00
tweaks
This commit is contained in:
parent
57b91cd9d4
commit
98085a028b
@ -286,14 +286,14 @@ export default function PolygonItem({
|
|||||||
{!isMobile && hoveredPolygonIndex === index && (
|
{!isMobile && hoveredPolygonIndex === index && (
|
||||||
<div className="flex flex-row gap-2 items-center">
|
<div className="flex flex-row gap-2 items-center">
|
||||||
<div
|
<div
|
||||||
className="cursor-pointer size-[15px]"
|
className="cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setActivePolygonIndex(index);
|
setActivePolygonIndex(index);
|
||||||
setEditPane(polygon.type);
|
setEditPane(polygon.type);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger asChild>
|
||||||
<LuPencil
|
<LuPencil
|
||||||
className={`size-[15px] ${
|
className={`size-[15px] ${
|
||||||
hoveredPolygonIndex === index && "text-primary-variant"
|
hoveredPolygonIndex === index && "text-primary-variant"
|
||||||
@ -304,11 +304,11 @@ export default function PolygonItem({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="cursor-pointer size-[15px]"
|
className="cursor-pointer"
|
||||||
onClick={() => handleCopyCoordinates(index)}
|
onClick={() => handleCopyCoordinates(index)}
|
||||||
>
|
>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger asChild>
|
||||||
<LuCopy
|
<LuCopy
|
||||||
className={`size-[15px] ${
|
className={`size-[15px] ${
|
||||||
hoveredPolygonIndex === index && "text-primary-variant"
|
hoveredPolygonIndex === index && "text-primary-variant"
|
||||||
@ -319,11 +319,11 @@ export default function PolygonItem({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="cursor-pointer size-[15px]"
|
className="cursor-pointer"
|
||||||
onClick={() => !isLoading && setDeleteDialogOpen(true)}
|
onClick={() => !isLoading && setDeleteDialogOpen(true)}
|
||||||
>
|
>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger asChild>
|
||||||
<HiTrash
|
<HiTrash
|
||||||
className={`size-[15px] ${
|
className={`size-[15px] ${
|
||||||
hoveredPolygonIndex === index &&
|
hoveredPolygonIndex === index &&
|
||||||
|
|||||||
@ -107,12 +107,19 @@ export default function ZoneEditPane({
|
|||||||
message: "Zone name already exists on this camera.",
|
message: "Zone name already exists on this camera.",
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
inertia: z.coerce.number().min(1, {
|
inertia: z.coerce
|
||||||
|
.number()
|
||||||
|
.min(1, {
|
||||||
message: "Inertia must be above 0.",
|
message: "Inertia must be above 0.",
|
||||||
}),
|
})
|
||||||
loitering_time: z.coerce.number().min(0, {
|
.or(z.literal("")),
|
||||||
|
loitering_time: z.coerce
|
||||||
|
.number()
|
||||||
|
.min(0, {
|
||||||
message: "Loitering time must be greater than or equal to 0.",
|
message: "Loitering time must be greater than or equal to 0.",
|
||||||
}),
|
})
|
||||||
|
.optional()
|
||||||
|
.or(z.literal("")),
|
||||||
isFinished: z.boolean().refine(() => polygon?.isFinished === true, {
|
isFinished: z.boolean().refine(() => polygon?.isFinished === true, {
|
||||||
message: "The polygon drawing must be finished before saving.",
|
message: "The polygon drawing must be finished before saving.",
|
||||||
}),
|
}),
|
||||||
@ -127,16 +134,13 @@ export default function ZoneEditPane({
|
|||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: polygon?.name ?? "",
|
name: polygon?.name ?? "",
|
||||||
inertia:
|
inertia:
|
||||||
(polygon?.camera &&
|
polygon?.camera &&
|
||||||
polygon?.name &&
|
polygon?.name &&
|
||||||
config?.cameras[polygon.camera]?.zones[polygon.name]?.inertia) ||
|
config?.cameras[polygon.camera]?.zones[polygon.name]?.inertia,
|
||||||
3,
|
|
||||||
loitering_time:
|
loitering_time:
|
||||||
(polygon?.camera &&
|
polygon?.camera &&
|
||||||
polygon?.name &&
|
polygon?.name &&
|
||||||
config?.cameras[polygon.camera]?.zones[polygon.name]
|
config?.cameras[polygon.camera]?.zones[polygon.name]?.loitering_time,
|
||||||
?.loitering_time) ||
|
|
||||||
0,
|
|
||||||
isFinished: polygon?.isFinished ?? false,
|
isFinished: polygon?.isFinished ?? false,
|
||||||
objects: polygon?.objects ?? [],
|
objects: polygon?.objects ?? [],
|
||||||
review_alerts:
|
review_alerts:
|
||||||
@ -240,9 +244,19 @@ export default function ZoneEditPane({
|
|||||||
.required_zones || [],
|
.required_zones || [],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let inertiaQuery = "";
|
||||||
|
if (inertia) {
|
||||||
|
inertiaQuery = `&cameras.${polygon?.camera}.zones.${zoneName}.inertia=${inertia}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let loiteringTimeQuery = "";
|
||||||
|
if (loitering_time) {
|
||||||
|
loiteringTimeQuery = `&cameras.${polygon?.camera}.zones.${zoneName}.loitering_time=${loitering_time}`;
|
||||||
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.put(
|
.put(
|
||||||
`config/set?cameras.${polygon?.camera}.zones.${zoneName}.coordinates=${coordinates}&cameras.${polygon?.camera}.zones.${zoneName}.inertia=${inertia}&cameras.${polygon?.camera}.zones.${zoneName}.loitering_time=${loitering_time}${objectQueries}${alertQueries}${detectionQueries}`,
|
`config/set?cameras.${polygon?.camera}.zones.${zoneName}.coordinates=${coordinates}${inertiaQuery}${loiteringTimeQuery}${objectQueries}${alertQueries}${detectionQueries}`,
|
||||||
{ requires_restart: 0 },
|
{ requires_restart: 0 },
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -346,7 +360,7 @@ export default function ZoneEditPane({
|
|||||||
<FormLabel>Name</FormLabel>
|
<FormLabel>Name</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
className="w-full p-2 border border-input bg-background text-secondary-foreground hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
|
className="w-full p-2 border border-input bg-background hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
|
||||||
placeholder="Enter a name..."
|
placeholder="Enter a name..."
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
@ -368,7 +382,7 @@ export default function ZoneEditPane({
|
|||||||
<FormLabel>Inertia</FormLabel>
|
<FormLabel>Inertia</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
className="w-full p-2 border border-input bg-background text-secondary-foreground hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
|
className="w-full p-2 border border-input bg-background hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
|
||||||
placeholder="3"
|
placeholder="3"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
@ -390,7 +404,7 @@ export default function ZoneEditPane({
|
|||||||
<FormLabel>Loitering Time</FormLabel>
|
<FormLabel>Loitering Time</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
className="w-full p-2 border border-input bg-background text-secondary-foreground hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
|
className="w-full p-2 border border-input bg-background hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -196,7 +196,9 @@ function CameraSelectButton({
|
|||||||
>
|
>
|
||||||
<FaVideo className="text-background dark:text-primary" />
|
<FaVideo className="text-background dark:text-primary" />
|
||||||
<div className="hidden md:block text-background dark:text-primary">
|
<div className="hidden md:block text-background dark:text-primary">
|
||||||
{selectedCamera == undefined ? "No Camera" : selectedCamera}
|
{selectedCamera == undefined
|
||||||
|
? "No Camera"
|
||||||
|
: selectedCamera.replaceAll("_", " ")}
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user