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):
|
||||
"""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."
|
||||
)
|
||||
icon: str = Field(default="generic", title="Icon that represents camera 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:
|
||||
"""Verify that roles are setup in the config correctly."""
|
||||
|
@ -555,9 +555,7 @@ export function CameraGroupEdit({
|
||||
message: "Invalid camera group name.",
|
||||
}),
|
||||
|
||||
cameras: z.array(z.string()).min(2, {
|
||||
message: "You must select at least two cameras.",
|
||||
}),
|
||||
cameras: z.array(z.string()),
|
||||
icon: z
|
||||
.string()
|
||||
.min(1, { message: "You must select an icon." })
|
||||
|
Loading…
Reference in New Issue
Block a user