mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
string or list for camera groups (#11616)
This commit is contained in:
parent
6dd9660ecd
commit
3dd401f57a
@ -1171,12 +1171,20 @@ class LoggerConfig(FrigateBaseModel):
|
|||||||
class CameraGroupConfig(FrigateBaseModel):
|
class CameraGroupConfig(FrigateBaseModel):
|
||||||
"""Represents a group of cameras."""
|
"""Represents a group of cameras."""
|
||||||
|
|
||||||
cameras: list[str] = Field(
|
cameras: Union[str, List[str]] = Field(
|
||||||
default_factory=list, title="List of cameras in this group."
|
default_factory=list, title="List of cameras in this group."
|
||||||
)
|
)
|
||||||
icon: str = Field(default="generic", title="Icon that represents camera group.")
|
icon: str = Field(default="generic", title="Icon that represents camera group.")
|
||||||
order: int = Field(default=0, title="Sort order for group.")
|
order: int = Field(default=0, title="Sort order for group.")
|
||||||
|
|
||||||
|
@field_validator("cameras", mode="before")
|
||||||
|
@classmethod
|
||||||
|
def validate_cameras(cls, v):
|
||||||
|
if isinstance(v, str) and "," not in v:
|
||||||
|
return [v]
|
||||||
|
|
||||||
|
return v
|
||||||
|
|
||||||
|
|
||||||
def verify_config_roles(camera_config: CameraConfig) -> None:
|
def verify_config_roles(camera_config: CameraConfig) -> None:
|
||||||
"""Verify that roles are setup in the config correctly."""
|
"""Verify that roles are setup in the config correctly."""
|
||||||
|
@ -555,9 +555,7 @@ export function CameraGroupEdit({
|
|||||||
message: "Invalid camera group name.",
|
message: "Invalid camera group name.",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
cameras: z.array(z.string()).min(2, {
|
cameras: z.array(z.string()),
|
||||||
message: "You must select at least two cameras.",
|
|
||||||
}),
|
|
||||||
icon: z
|
icon: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, { message: "You must select an icon." })
|
.min(1, { message: "You must select an icon." })
|
||||||
|
Loading…
Reference in New Issue
Block a user