add a basic set of messages

This commit is contained in:
Josh Hawkins 2026-03-29 13:06:52 -05:00
parent 78ea005724
commit 6ee5e70005
9 changed files with 128 additions and 3 deletions

View File

@ -1609,13 +1609,34 @@
}, },
"configMessages": { "configMessages": {
"review": { "review": {
"recordDisabled": "Recording is disabled, review items will not be generated." "recordDisabled": "Recording is disabled, review items will not be generated.",
"detectDisabled": "Object detection is disabled. Review items require detected objects to categorize alerts and detections."
}, },
"audio": { "audio": {
"noAudioRole": "No streams have the audio role defined. You must enable the audio role for audio detection to function." "noAudioRole": "No streams have the audio role defined. You must enable the audio role for audio detection to function."
}, },
"audioTranscription": {
"audioDetectionDisabled": "Audio detection is not enabled for this camera. Audio transcription requires audio detection to be active."
},
"detect": { "detect": {
"fpsGreaterThanFive": "Setting the detect FPS higher than 5 is not recommended." "fpsGreaterThanFive": "Setting the detect FPS higher than 5 is not recommended."
},
"faceRecognition": {
"globalDisabled": "Face recognition is not enabled at the global level. Enable it in global settings for camera-level face recognition to function.",
"personNotTracked": "Face recognition requires the 'person' object to be tracked. Ensure 'person' is in the object tracking list."
},
"lpr": {
"globalDisabled": "License plate recognition is not enabled at the global level. Enable it in global settings for camera-level LPR to function.",
"vehicleNotTracked": "License plate recognition requires 'car' or 'motorcycle' to be tracked."
},
"record": {
"noRecordRole": "No streams have the record role defined. Recording will not function."
},
"birdseye": {
"objectsModeDetectDisabled": "Birdseye is set to 'objects' mode, but object detection is disabled for this camera. The camera will not appear in Birdseye."
},
"snapshots": {
"detectDisabled": "Object detection is disabled. Snapshots are generated from tracked objects and will not be created."
} }
} }
} }

View File

@ -36,12 +36,12 @@ export function ConfigMessageBanner({ messages }: ConfigMessageBannerProps) {
if (messages.length === 0) return null; if (messages.length === 0) return null;
return ( return (
<div className="space-y-2"> <div className="max-w-5xl space-y-2">
{messages.map((msg) => ( {messages.map((msg) => (
<Alert <Alert
key={msg.key} key={msg.key}
variant={severityVariantMap[msg.severity]} variant={severityVariantMap[msg.severity]}
className="flex items-center [&>svg]:static [&>svg~*]:pl-2 [&>svg+div]:translate-y-0" className="flex items-center [&>svg+div]:translate-y-0 [&>svg]:static [&>svg~*]:pl-2"
> >
<SeverityIcon severity={msg.severity} /> <SeverityIcon severity={msg.severity} />
<AlertDescription>{t(msg.messageKey)}</AlertDescription> <AlertDescription>{t(msg.messageKey)}</AlertDescription>

View File

@ -3,6 +3,19 @@ import type { SectionConfigOverrides } from "./types";
const audioTranscription: SectionConfigOverrides = { const audioTranscription: SectionConfigOverrides = {
base: { base: {
sectionDocs: "/configuration/audio_detectors#audio-transcription", sectionDocs: "/configuration/audio_detectors#audio-transcription",
messages: [
{
key: "audio-detection-disabled",
messageKey: "configMessages.audioTranscription.audioDetectionDisabled",
severity: "warning",
condition: (ctx) => {
if (ctx.level === "camera" && ctx.fullCameraConfig) {
return ctx.fullCameraConfig.audio.enabled === false;
}
return false;
},
},
],
restartRequired: [], restartRequired: [],
fieldOrder: ["enabled", "language", "device", "model_size"], fieldOrder: ["enabled", "language", "device", "model_size"],
hiddenFields: ["enabled_in_config", "live_enabled"], hiddenFields: ["enabled_in_config", "live_enabled"],

View File

@ -3,6 +3,20 @@ import type { SectionConfigOverrides } from "./types";
const birdseye: SectionConfigOverrides = { const birdseye: SectionConfigOverrides = {
base: { base: {
sectionDocs: "/configuration/birdseye", sectionDocs: "/configuration/birdseye",
messages: [
{
key: "objects-mode-detect-disabled",
messageKey: "configMessages.birdseye.objectsModeDetectDisabled",
severity: "info",
condition: (ctx) => {
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
return (
ctx.formData?.mode === "objects" &&
ctx.fullCameraConfig.detect?.enabled === false
);
},
},
],
restartRequired: [], restartRequired: [],
fieldOrder: ["enabled", "mode", "order"], fieldOrder: ["enabled", "mode", "order"],
hiddenFields: [], hiddenFields: [],

View File

@ -3,6 +3,26 @@ import type { SectionConfigOverrides } from "./types";
const faceRecognition: SectionConfigOverrides = { const faceRecognition: SectionConfigOverrides = {
base: { base: {
sectionDocs: "/configuration/face_recognition", sectionDocs: "/configuration/face_recognition",
messages: [
{
key: "global-disabled",
messageKey: "configMessages.faceRecognition.globalDisabled",
severity: "warning",
condition: (ctx) => {
if (ctx.level !== "camera") return false;
return ctx.fullConfig.face_recognition?.enabled === false;
},
},
{
key: "person-not-tracked",
messageKey: "configMessages.faceRecognition.personNotTracked",
severity: "info",
condition: (ctx) => {
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
return !ctx.fullCameraConfig.objects?.track?.includes("person");
},
},
],
restartRequired: [], restartRequired: [],
fieldOrder: ["enabled", "min_area"], fieldOrder: ["enabled", "min_area"],
hiddenFields: [], hiddenFields: [],

View File

@ -3,6 +3,28 @@ import type { SectionConfigOverrides } from "./types";
const lpr: SectionConfigOverrides = { const lpr: SectionConfigOverrides = {
base: { base: {
sectionDocs: "/configuration/license_plate_recognition", sectionDocs: "/configuration/license_plate_recognition",
messages: [
{
key: "global-disabled",
messageKey: "configMessages.lpr.globalDisabled",
severity: "warning",
condition: (ctx) => {
if (ctx.level !== "camera") return false;
return ctx.fullConfig.lpr?.enabled === false;
},
},
{
key: "vehicle-not-tracked",
messageKey: "configMessages.lpr.vehicleNotTracked",
severity: "info",
condition: (ctx) => {
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
if (ctx.fullCameraConfig.type === "lpr") return false;
const tracked = ctx.fullCameraConfig.objects?.track ?? [];
return !tracked.some((o) => ["car", "motorcycle"].includes(o));
},
},
],
fieldDocs: { fieldDocs: {
enhancement: "/configuration/license_plate_recognition#enhancement", enhancement: "/configuration/license_plate_recognition#enhancement",
}, },

View File

@ -3,6 +3,19 @@ import type { SectionConfigOverrides } from "./types";
const record: SectionConfigOverrides = { const record: SectionConfigOverrides = {
base: { base: {
sectionDocs: "/configuration/record", sectionDocs: "/configuration/record",
messages: [
{
key: "no-record-role",
messageKey: "configMessages.record.noRecordRole",
severity: "warning",
condition: (ctx) => {
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
return !ctx.fullCameraConfig.ffmpeg?.inputs?.some((i) =>
i.roles?.includes("record"),
);
},
},
],
restartRequired: [], restartRequired: [],
fieldOrder: [ fieldOrder: [
"enabled", "enabled",

View File

@ -15,6 +15,17 @@ const review: SectionConfigOverrides = {
return ctx.fullConfig.record?.enabled === false; return ctx.fullConfig.record?.enabled === false;
}, },
}, },
{
key: "detect-disabled",
messageKey: "configMessages.review.detectDisabled",
severity: "info",
condition: (ctx) => {
if (ctx.level === "camera" && ctx.fullCameraConfig) {
return ctx.fullCameraConfig.detect?.enabled === false;
}
return false;
},
},
], ],
fieldDocs: { fieldDocs: {
"alerts.labels": "/configuration/review/#alerts-and-detections", "alerts.labels": "/configuration/review/#alerts-and-detections",

View File

@ -3,6 +3,17 @@ import type { SectionConfigOverrides } from "./types";
const snapshots: SectionConfigOverrides = { const snapshots: SectionConfigOverrides = {
base: { base: {
sectionDocs: "/configuration/snapshots", sectionDocs: "/configuration/snapshots",
messages: [
{
key: "detect-disabled",
messageKey: "configMessages.snapshots.detectDisabled",
severity: "info",
condition: (ctx) => {
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
return ctx.fullCameraConfig.detect?.enabled === false;
},
},
],
restartRequired: [], restartRequired: [],
fieldOrder: [ fieldOrder: [
"enabled", "enabled",