mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-28 07:18:57 +03:00
Refactor birdseye activity modes as a list and add alerts/detections (#24012)
* backend * tests * frontend and i18n * e2e test schema * docs
This commit is contained in:
committed by
Nicolas Mowen
parent
e77155a4f1
commit
f4cf1e1539
@@ -22,6 +22,7 @@ import { ObjectLabelSwitchesWidget } from "./widgets/ObjectLabelSwitchesWidget";
|
||||
import { AudioLabelSwitchesWidget } from "./widgets/AudioLabelSwitchesWidget";
|
||||
import { ReviewLabelSwitchesWidget } from "./widgets/ReviewLabelSwitchesWidget";
|
||||
import { ZoneSwitchesWidget } from "./widgets/ZoneSwitchesWidget";
|
||||
import { BirdseyeModesWidget } from "./widgets/BirdseyeModesWidget";
|
||||
import { ArrayAsTextWidget } from "./widgets/ArrayAsTextWidget";
|
||||
import { FfmpegArgsWidget } from "./widgets/FfmpegArgsWidget";
|
||||
import { GenAIModelWidget } from "./widgets/GenAIModelWidget";
|
||||
@@ -87,6 +88,7 @@ export const frigateTheme: FrigateTheme = {
|
||||
audioLabels: AudioLabelSwitchesWidget,
|
||||
reviewLabels: ReviewLabelSwitchesWidget,
|
||||
zoneNames: ZoneSwitchesWidget,
|
||||
birdseyeModes: BirdseyeModesWidget,
|
||||
timezoneSelect: TimezoneSelectWidget,
|
||||
optionalField: OptionalFieldWidget,
|
||||
semanticSearchModel: SemanticSearchModelWidget,
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// Birdseye Modes Widget - For selecting Birdseye activity types via switches
|
||||
import type { WidgetProps } from "@rjsf/utils";
|
||||
import { SwitchesWidget } from "./SwitchesWidget";
|
||||
import type { FormContext } from "./SwitchesWidget";
|
||||
|
||||
// order matches BirdseyeModeEnum in frigate/config/camera/birdseye.py
|
||||
const BIRDSEYE_MODES: string[] = [
|
||||
"continuous",
|
||||
"motion",
|
||||
"all_objects",
|
||||
"alerts",
|
||||
"detections",
|
||||
];
|
||||
|
||||
function getBirdseyeModes(): string[] {
|
||||
return BIRDSEYE_MODES;
|
||||
}
|
||||
|
||||
function getBirdseyeModeLabel(mode: string, context?: FormContext): string {
|
||||
const t = context?.t;
|
||||
|
||||
if (!t) {
|
||||
return mode;
|
||||
}
|
||||
|
||||
return t(`configForm.birdseyeModes.options.${mode}`, {
|
||||
ns: "views/settings",
|
||||
defaultValue: mode,
|
||||
});
|
||||
}
|
||||
|
||||
export function BirdseyeModesWidget(props: WidgetProps) {
|
||||
return (
|
||||
<SwitchesWidget
|
||||
{...props}
|
||||
options={{
|
||||
...props.options,
|
||||
getEntities: getBirdseyeModes,
|
||||
getDisplayLabel: getBirdseyeModeLabel,
|
||||
i18nKey: "birdseyeModes",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user