mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-21 03:41:55 +03:00
UI tweaks (#23492)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* slightly darken bg-card * change menu label * move snapshot retain out of advanced fields * add new ui options for collapsibles * backend title and description * remove unused snapshot retention field * update reference config * remove further references to snapshots retain.mode
This commit is contained in:
parent
e84a89ef3e
commit
c79ca9838f
@ -655,11 +655,6 @@ snapshots:
|
|||||||
retain:
|
retain:
|
||||||
# Required: Default retention days (default: shown below)
|
# Required: Default retention days (default: shown below)
|
||||||
default: 10
|
default: 10
|
||||||
# Optional: Mode for retention. (default: shown below)
|
|
||||||
# all - save all snapshots regardless of activity
|
|
||||||
# motion - save snapshots for any detected motion
|
|
||||||
# active_objects - save snapshots for active/moving objects
|
|
||||||
mode: motion
|
|
||||||
# Optional: Per object retention days
|
# Optional: Per object retention days
|
||||||
objects:
|
objects:
|
||||||
person: 15
|
person: 15
|
||||||
|
|||||||
@ -111,7 +111,6 @@ Navigate to <NavPath path="Settings > Global configuration > Snapshots" />.
|
|||||||
| Field | Description |
|
| Field | Description |
|
||||||
| -------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
| -------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
||||||
| **Snapshot retention > Default retention** | Number of days to retain snapshots (default: 10) |
|
| **Snapshot retention > Default retention** | Number of days to retain snapshots (default: 10) |
|
||||||
| **Snapshot retention > Retention mode** | Retention mode: `all`, `motion`, or `active_objects` |
|
|
||||||
| **Snapshot retention > Object retention > Person** | Per-object overrides for retention days (e.g., keep `person` snapshots for 15 days) |
|
| **Snapshot retention > Object retention > Person** | Per-object overrides for retention days (e.g., keep `person` snapshots for 15 days) |
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@ -122,7 +121,6 @@ snapshots:
|
|||||||
enabled: True
|
enabled: True
|
||||||
retain:
|
retain:
|
||||||
default: 10
|
default: 10
|
||||||
mode: motion
|
|
||||||
objects:
|
objects:
|
||||||
person: 15
|
person: 15
|
||||||
```
|
```
|
||||||
|
|||||||
@ -100,8 +100,8 @@ class CameraConfig(FrigateBaseModel):
|
|||||||
description="Settings for face detection and recognition for this camera.",
|
description="Settings for face detection and recognition for this camera.",
|
||||||
)
|
)
|
||||||
ffmpeg: CameraFfmpegConfig = Field(
|
ffmpeg: CameraFfmpegConfig = Field(
|
||||||
title="FFmpeg",
|
title="Streams (FFmpeg)",
|
||||||
description="FFmpeg settings including binary path, args, hwaccel options, and per-role output args.",
|
description="Camera stream inputs and FFmpeg options, including binary path, args, hwaccel, and per-role output args.",
|
||||||
)
|
)
|
||||||
live: CameraLiveConfig = Field(
|
live: CameraLiveConfig = Field(
|
||||||
default_factory=CameraLiveConfig,
|
default_factory=CameraLiveConfig,
|
||||||
|
|||||||
@ -3,7 +3,6 @@ from typing import Optional
|
|||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
from ..base import FrigateBaseModel
|
from ..base import FrigateBaseModel
|
||||||
from .record import RetainModeEnum
|
|
||||||
|
|
||||||
__all__ = ["SnapshotsConfig", "RetainConfig"]
|
__all__ = ["SnapshotsConfig", "RetainConfig"]
|
||||||
|
|
||||||
@ -14,11 +13,6 @@ class RetainConfig(FrigateBaseModel):
|
|||||||
title="Default retention",
|
title="Default retention",
|
||||||
description="Default number of days to retain snapshots.",
|
description="Default number of days to retain snapshots.",
|
||||||
)
|
)
|
||||||
mode: RetainModeEnum = Field(
|
|
||||||
default=RetainModeEnum.motion,
|
|
||||||
title="Retention mode",
|
|
||||||
description="Mode for retention: all (save all segments), motion (save segments with motion), or active_objects (save segments with active objects).",
|
|
||||||
)
|
|
||||||
objects: dict[str, float] = Field(
|
objects: dict[str, float] = Field(
|
||||||
default_factory=dict,
|
default_factory=dict,
|
||||||
title="Object retention",
|
title="Object retention",
|
||||||
|
|||||||
@ -152,8 +152,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ffmpeg": {
|
"ffmpeg": {
|
||||||
"label": "FFmpeg",
|
"label": "Streams (FFmpeg)",
|
||||||
"description": "FFmpeg settings including binary path, args, hwaccel options, and per-role output args.",
|
"description": "Camera stream inputs and FFmpeg options, including binary path, args, hwaccel, and per-role output args.",
|
||||||
"path": {
|
"path": {
|
||||||
"label": "FFmpeg path",
|
"label": "FFmpeg path",
|
||||||
"description": "Path to the FFmpeg binary to use or a version alias (\"7.0\" or \"8.0\")."
|
"description": "Path to the FFmpeg binary to use or a version alias (\"7.0\" or \"8.0\")."
|
||||||
@ -666,10 +666,6 @@
|
|||||||
"label": "Default retention",
|
"label": "Default retention",
|
||||||
"description": "Default number of days to retain snapshots."
|
"description": "Default number of days to retain snapshots."
|
||||||
},
|
},
|
||||||
"mode": {
|
|
||||||
"label": "Retention mode",
|
|
||||||
"description": "Mode for retention: all (save all segments), motion (save segments with motion), or active_objects (save segments with active objects)."
|
|
||||||
},
|
|
||||||
"objects": {
|
"objects": {
|
||||||
"label": "Object retention",
|
"label": "Object retention",
|
||||||
"description": "Per-object overrides for snapshot retention days."
|
"description": "Per-object overrides for snapshot retention days."
|
||||||
|
|||||||
@ -1176,10 +1176,6 @@
|
|||||||
"label": "Default retention",
|
"label": "Default retention",
|
||||||
"description": "Default number of days to retain snapshots."
|
"description": "Default number of days to retain snapshots."
|
||||||
},
|
},
|
||||||
"mode": {
|
|
||||||
"label": "Retention mode",
|
|
||||||
"description": "Mode for retention: all (save all segments), motion (save segments with motion), or active_objects (save segments with active objects)."
|
|
||||||
},
|
|
||||||
"objects": {
|
"objects": {
|
||||||
"label": "Object retention",
|
"label": "Object retention",
|
||||||
"description": "Per-object overrides for snapshot retention days."
|
"description": "Per-object overrides for snapshot retention days."
|
||||||
|
|||||||
@ -85,7 +85,7 @@
|
|||||||
"integrationObjectClassification": "Object classification",
|
"integrationObjectClassification": "Object classification",
|
||||||
"integrationAudioTranscription": "Audio transcription",
|
"integrationAudioTranscription": "Audio transcription",
|
||||||
"cameraDetect": "Object detection",
|
"cameraDetect": "Object detection",
|
||||||
"cameraFfmpeg": "FFmpeg",
|
"cameraFfmpeg": "Streams (FFmpeg)",
|
||||||
"cameraRecording": "Recording",
|
"cameraRecording": "Recording",
|
||||||
"cameraSnapshots": "Snapshots",
|
"cameraSnapshots": "Snapshots",
|
||||||
"cameraMotion": "Motion detection",
|
"cameraMotion": "Motion detection",
|
||||||
|
|||||||
@ -44,7 +44,14 @@ const record: SectionConfigOverrides = {
|
|||||||
hiddenFields: ["enabled_in_config", "sync_recordings"],
|
hiddenFields: ["enabled_in_config", "sync_recordings"],
|
||||||
advancedFields: ["expire_interval", "preview", "export"],
|
advancedFields: ["expire_interval", "preview", "export"],
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
|
continuous: {
|
||||||
|
"ui:options": { defaultOpen: true, disableCollapsible: true },
|
||||||
|
},
|
||||||
|
motion: {
|
||||||
|
"ui:options": { defaultOpen: true, disableCollapsible: true },
|
||||||
|
},
|
||||||
export: {
|
export: {
|
||||||
|
"ui:options": { defaultOpen: true, disableCollapsible: true },
|
||||||
hwaccel_args: {
|
hwaccel_args: {
|
||||||
"ui:widget": "FfmpegArgsWidget",
|
"ui:widget": "FfmpegArgsWidget",
|
||||||
"ui:options": {
|
"ui:options": {
|
||||||
@ -59,9 +66,12 @@ const record: SectionConfigOverrides = {
|
|||||||
"detections.retain.mode": {
|
"detections.retain.mode": {
|
||||||
"ui:options": { enumI18nPrefix: "retainMode" },
|
"ui:options": { enumI18nPrefix: "retainMode" },
|
||||||
},
|
},
|
||||||
"preview.quality": {
|
preview: {
|
||||||
"ui:options": {
|
"ui:options": { defaultOpen: true, disableCollapsible: true },
|
||||||
enumI18nPrefix: "previewQuality",
|
quality: {
|
||||||
|
"ui:options": {
|
||||||
|
enumI18nPrefix: "previewQuality",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -21,13 +21,14 @@ const snapshots: SectionConfigOverrides = {
|
|||||||
"crop",
|
"crop",
|
||||||
"quality",
|
"quality",
|
||||||
"timestamp",
|
"timestamp",
|
||||||
|
"required_zones",
|
||||||
"retain",
|
"retain",
|
||||||
],
|
],
|
||||||
fieldGroups: {
|
fieldGroups: {
|
||||||
display: ["bounding_box", "crop", "quality", "timestamp"],
|
display: ["bounding_box", "crop", "quality", "timestamp"],
|
||||||
},
|
},
|
||||||
hiddenFields: ["enabled_in_config"],
|
hiddenFields: ["enabled_in_config"],
|
||||||
advancedFields: ["height", "quality", "retain"],
|
advancedFields: ["height", "quality"],
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
required_zones: {
|
required_zones: {
|
||||||
"ui:widget": "zoneNames",
|
"ui:widget": "zoneNames",
|
||||||
@ -35,11 +36,6 @@ const snapshots: SectionConfigOverrides = {
|
|||||||
suppressMultiSchema: true,
|
suppressMultiSchema: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"retain.mode": {
|
|
||||||
"ui:options": {
|
|
||||||
enumI18nPrefix: "retainMode",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
global: {
|
global: {
|
||||||
|
|||||||
@ -156,7 +156,8 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const hasModifiedDescendants = checkSubtreeModified(fieldPath);
|
const hasModifiedDescendants = checkSubtreeModified(fieldPath);
|
||||||
const [isOpen, setIsOpen] = useState(hasModifiedDescendants);
|
const defaultOpen = uiSchema?.["ui:options"]?.defaultOpen === true;
|
||||||
|
const [isOpen, setIsOpen] = useState(hasModifiedDescendants || defaultOpen);
|
||||||
const resetKey = `${formContext?.level ?? "global"}::${
|
const resetKey = `${formContext?.level ?? "global"}::${
|
||||||
formContext?.cameraName ?? "global"
|
formContext?.cameraName ?? "global"
|
||||||
}`;
|
}`;
|
||||||
@ -192,6 +193,8 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
(uiSchema?.["ui:groups"] as Record<string, string[]> | undefined) || {};
|
(uiSchema?.["ui:groups"] as Record<string, string[]> | undefined) || {};
|
||||||
const disableNestedCard =
|
const disableNestedCard =
|
||||||
uiSchema?.["ui:options"]?.disableNestedCard === true;
|
uiSchema?.["ui:options"]?.disableNestedCard === true;
|
||||||
|
const disableCollapsible =
|
||||||
|
uiSchema?.["ui:options"]?.disableCollapsible === true;
|
||||||
|
|
||||||
const isHiddenProp = (prop: (typeof properties)[number]) =>
|
const isHiddenProp = (prop: (typeof properties)[number]) =>
|
||||||
(prop.content.props as RjsfElementProps).uiSchema?.["ui:widget"] ===
|
(prop.content.props as RjsfElementProps).uiSchema?.["ui:widget"] ===
|
||||||
@ -228,10 +231,10 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (lastResetKeyRef.current !== resetKey) {
|
if (lastResetKeyRef.current !== resetKey) {
|
||||||
lastResetKeyRef.current = resetKey;
|
lastResetKeyRef.current = resetKey;
|
||||||
setIsOpen(hasModifiedDescendants);
|
setIsOpen(hasModifiedDescendants || defaultOpen);
|
||||||
setShowAdvanced(hasModifiedAdvanced);
|
setShowAdvanced(hasModifiedAdvanced);
|
||||||
}
|
}
|
||||||
}, [resetKey, hasModifiedDescendants, hasModifiedAdvanced]);
|
}, [resetKey, hasModifiedDescendants, hasModifiedAdvanced, defaultOpen]);
|
||||||
const { children } = props as ObjectFieldTemplateProps & {
|
const { children } = props as ObjectFieldTemplateProps & {
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
};
|
};
|
||||||
@ -458,6 +461,75 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Label/description/docs header shared by the collapsible and static layouts.
|
||||||
|
const cardHeaderContent = (
|
||||||
|
<div className="min-w-0 pr-3">
|
||||||
|
<CardTitle
|
||||||
|
className={cn(
|
||||||
|
"flex items-center text-sm",
|
||||||
|
hasModifiedDescendants && "text-unsaved",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{inferredLabel}
|
||||||
|
{objectRequiresRestart && <RestartRequiredIndicator className="ml-2" />}
|
||||||
|
</CardTitle>
|
||||||
|
{inferredDescription && (
|
||||||
|
<p className="mt-1 text-xs text-muted-foreground">
|
||||||
|
{inferredDescription}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{fieldDocsUrl && (
|
||||||
|
<div className="mt-1 flex items-center text-xs text-primary-variant">
|
||||||
|
<Link
|
||||||
|
to={fieldDocsUrl}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="inline"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
{t("readTheDocumentation", { ns: "common" })}
|
||||||
|
<LuExternalLink className="ml-2 inline-flex size-3" />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
// Body shared by the collapsible and static layouts.
|
||||||
|
const cardBody = hasCustomChildren ? (
|
||||||
|
children
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{renderGroupedFields(regularProps)}
|
||||||
|
<AddPropertyButton
|
||||||
|
onAddProperty={onAddProperty}
|
||||||
|
schema={schema}
|
||||||
|
uiSchema={uiSchema}
|
||||||
|
formData={formData}
|
||||||
|
disabled={disabled}
|
||||||
|
readonly={readonly}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AdvancedCollapsible
|
||||||
|
count={advancedProps.length}
|
||||||
|
open={showAdvanced}
|
||||||
|
onOpenChange={setShowAdvanced}
|
||||||
|
>
|
||||||
|
{renderGroupedFields(advancedProps)}
|
||||||
|
</AdvancedCollapsible>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
// Static (non-collapsible) card: keep the labeled header, always show content.
|
||||||
|
if (disableCollapsible) {
|
||||||
|
return (
|
||||||
|
<Card className="w-full">
|
||||||
|
<CardHeader className="p-4">{cardHeaderContent}</CardHeader>
|
||||||
|
<CardContent className="space-y-6 p-4 pt-0">{cardBody}</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Nested objects render as collapsible cards
|
// Nested objects render as collapsible cards
|
||||||
return (
|
return (
|
||||||
<Card className="w-full">
|
<Card className="w-full">
|
||||||
@ -465,38 +537,7 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
<CollapsibleTrigger asChild>
|
<CollapsibleTrigger asChild>
|
||||||
<CardHeader className="cursor-pointer p-4 transition-colors hover:bg-muted/50">
|
<CardHeader className="cursor-pointer p-4 transition-colors hover:bg-muted/50">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="min-w-0 pr-3">
|
{cardHeaderContent}
|
||||||
<CardTitle
|
|
||||||
className={cn(
|
|
||||||
"flex items-center text-sm",
|
|
||||||
hasModifiedDescendants && "text-unsaved",
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{inferredLabel}
|
|
||||||
{objectRequiresRestart && (
|
|
||||||
<RestartRequiredIndicator className="ml-2" />
|
|
||||||
)}
|
|
||||||
</CardTitle>
|
|
||||||
{inferredDescription && (
|
|
||||||
<p className="mt-1 text-xs text-muted-foreground">
|
|
||||||
{inferredDescription}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
{fieldDocsUrl && (
|
|
||||||
<div className="mt-1 flex items-center text-xs text-primary-variant">
|
|
||||||
<Link
|
|
||||||
to={fieldDocsUrl}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="inline"
|
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
{t("readTheDocumentation", { ns: "common" })}
|
|
||||||
<LuExternalLink className="ml-2 inline-flex size-3" />
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{isOpen ? (
|
{isOpen ? (
|
||||||
<LuChevronDown className="h-4 w-4 shrink-0" />
|
<LuChevronDown className="h-4 w-4 shrink-0" />
|
||||||
) : (
|
) : (
|
||||||
@ -506,31 +547,7 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
</CollapsibleTrigger>
|
</CollapsibleTrigger>
|
||||||
<CollapsibleContent>
|
<CollapsibleContent>
|
||||||
<CardContent className="space-y-6 p-4 pt-0">
|
<CardContent className="space-y-6 p-4 pt-0">{cardBody}</CardContent>
|
||||||
{hasCustomChildren ? (
|
|
||||||
children
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{renderGroupedFields(regularProps)}
|
|
||||||
<AddPropertyButton
|
|
||||||
onAddProperty={onAddProperty}
|
|
||||||
schema={schema}
|
|
||||||
uiSchema={uiSchema}
|
|
||||||
formData={formData}
|
|
||||||
disabled={disabled}
|
|
||||||
readonly={readonly}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<AdvancedCollapsible
|
|
||||||
count={advancedProps.length}
|
|
||||||
open={showAdvanced}
|
|
||||||
onOpenChange={setShowAdvanced}
|
|
||||||
>
|
|
||||||
{renderGroupedFields(advancedProps)}
|
|
||||||
</AdvancedCollapsible>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</CardContent>
|
|
||||||
</CollapsibleContent>
|
</CollapsibleContent>
|
||||||
</Collapsible>
|
</Collapsible>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@ -113,8 +113,8 @@
|
|||||||
--foreground: hsl(0, 0%, 100%);
|
--foreground: hsl(0, 0%, 100%);
|
||||||
--foreground: 0, 0%, 100%;
|
--foreground: 0, 0%, 100%;
|
||||||
|
|
||||||
--card: hsl(0, 0%, 15%);
|
--card: hsl(0, 0%, 12%);
|
||||||
--card: 0, 0%, 15%;
|
--card: 0, 0%, 12%;
|
||||||
|
|
||||||
--card-foreground: hsl(210, 40%, 98%);
|
--card-foreground: hsl(210, 40%, 98%);
|
||||||
--card-foreground: 210 40% 98%;
|
--card-foreground: 210 40% 98%;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user