mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-27 21:38:57 +03:00
Improve System Health pane (#24188)
* build out system health pane * tweaks * fixes * fix notice link so it opens the correct camera * tweak language
This commit is contained in:
committed by
Nicolas Mowen
parent
6d33b31bc6
commit
70ce193e09
@@ -6,6 +6,7 @@ const audio: SectionConfigOverrides = {
|
||||
messages: [
|
||||
{
|
||||
key: "no-audio-role",
|
||||
health: (ctx) => ctx.fullCameraConfig?.audio?.enabled === true,
|
||||
messageKey: "configMessages.audio.noAudioRole",
|
||||
severity: "warning",
|
||||
condition: (ctx) => {
|
||||
|
||||
@@ -6,6 +6,8 @@ const audioTranscription: SectionConfigOverrides = {
|
||||
messages: [
|
||||
{
|
||||
key: "audio-detection-disabled",
|
||||
health: (ctx) =>
|
||||
ctx.fullCameraConfig?.audio_transcription?.enabled === true,
|
||||
messageKey: "configMessages.audioTranscription.audioDetectionDisabled",
|
||||
severity: "warning",
|
||||
condition: (ctx) => {
|
||||
|
||||
@@ -15,6 +15,7 @@ const detect: SectionConfigOverrides = {
|
||||
fieldMessages: [
|
||||
{
|
||||
key: "detect-resolution-not-multiple-of-four",
|
||||
health: true,
|
||||
field: "width",
|
||||
position: "before",
|
||||
messageKey: "configMessages.detect.resolutionShouldBeMultipleOfFour",
|
||||
@@ -46,6 +47,7 @@ const detect: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "detect-resolution-high",
|
||||
health: true,
|
||||
field: "width",
|
||||
position: "before",
|
||||
messageKey: "configMessages.detect.resolutionHigh",
|
||||
@@ -61,6 +63,7 @@ const detect: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "detect-square-resolution",
|
||||
health: true,
|
||||
field: "width",
|
||||
position: "before",
|
||||
messageKey: "configMessages.detect.squareResolution",
|
||||
@@ -112,6 +115,7 @@ const detect: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "detect-scene-without-model",
|
||||
health: true,
|
||||
field: "scene",
|
||||
position: "after",
|
||||
messageKey: "configMessages.detect.sceneWithoutModel",
|
||||
@@ -127,6 +131,7 @@ const detect: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "fps-greater-than-five",
|
||||
health: true,
|
||||
field: "fps",
|
||||
messageKey: "configMessages.detect.fpsGreaterThanFive",
|
||||
severity: "info",
|
||||
|
||||
@@ -6,6 +6,8 @@ const faceRecognition: SectionConfigOverrides = {
|
||||
messages: [
|
||||
{
|
||||
key: "global-disabled",
|
||||
health: (ctx) =>
|
||||
ctx.fullCameraConfig?.face_recognition?.enabled === true,
|
||||
messageKey: "configMessages.faceRecognition.globalDisabled",
|
||||
severity: "warning",
|
||||
condition: (ctx) => {
|
||||
@@ -15,6 +17,9 @@ const faceRecognition: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "person-not-tracked",
|
||||
health: (ctx) =>
|
||||
ctx.fullCameraConfig?.face_recognition?.enabled === true &&
|
||||
ctx.fullConfig.face_recognition?.enabled === true,
|
||||
messageKey: "configMessages.faceRecognition.personNotTracked",
|
||||
severity: "info",
|
||||
condition: (ctx) => {
|
||||
|
||||
@@ -52,6 +52,7 @@ const ffmpeg: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "inputs-missing-go2rtc-stream",
|
||||
health: true,
|
||||
field: "inputs",
|
||||
position: "before",
|
||||
messageKey: "configMessages.ffmpeg.inputsMissingGo2rtcStream",
|
||||
|
||||
@@ -7,6 +7,7 @@ const lpr: SectionConfigOverrides = {
|
||||
messages: [
|
||||
{
|
||||
key: "global-disabled",
|
||||
health: (ctx) => ctx.fullCameraConfig?.lpr?.enabled === true,
|
||||
messageKey: "configMessages.lpr.globalDisabled",
|
||||
severity: "warning",
|
||||
condition: (ctx) => {
|
||||
@@ -16,6 +17,9 @@ const lpr: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "vehicle-not-tracked",
|
||||
health: (ctx) =>
|
||||
ctx.fullCameraConfig?.lpr?.enabled === true &&
|
||||
ctx.fullConfig.lpr?.enabled === true,
|
||||
messageKey: "configMessages.lpr.vehicleNotTracked",
|
||||
severity: "info",
|
||||
condition: (ctx) => {
|
||||
|
||||
@@ -35,6 +35,7 @@ const models: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "model-input-dimensions-not-detect-resolution",
|
||||
health: true,
|
||||
field: "height",
|
||||
position: "after",
|
||||
messageKey: "configMessages.model.inputDimensionsNotDetectResolution",
|
||||
|
||||
@@ -72,6 +72,9 @@ const objects: SectionConfigOverrides = {
|
||||
fieldMessages: [
|
||||
{
|
||||
key: "genai-no-descriptions-provider",
|
||||
health: (ctx) =>
|
||||
(ctx.formData as { genai?: { enabled?: boolean } })?.genai
|
||||
?.enabled === true,
|
||||
field: "genai.enabled",
|
||||
messageKey: "configMessages.objects.genaiNoDescriptionsProvider",
|
||||
severity: "warning",
|
||||
|
||||
@@ -28,6 +28,8 @@ const onvif: SectionConfigOverrides = {
|
||||
fieldMessages: [
|
||||
{
|
||||
key: "autotracking-no-zones",
|
||||
health: (ctx) =>
|
||||
ctx.fullCameraConfig?.onvif?.autotracking?.enabled === true,
|
||||
field: "autotracking.required_zones",
|
||||
messageKey: "configMessages.onvif.autotrackingNoZones",
|
||||
severity: "error",
|
||||
|
||||
@@ -6,6 +6,7 @@ const record: SectionConfigOverrides = {
|
||||
messages: [
|
||||
{
|
||||
key: "no-record-role",
|
||||
health: (ctx) => ctx.fullCameraConfig?.record?.enabled === true,
|
||||
messageKey: "configMessages.record.noRecordRole",
|
||||
severity: "warning",
|
||||
condition: (ctx) => {
|
||||
@@ -17,6 +18,7 @@ const record: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "no-record-sub-role",
|
||||
health: (ctx) => ctx.fullCameraConfig?.record?.sub?.enabled === true,
|
||||
messageKey: "configMessages.record.noRecordSubRole",
|
||||
severity: "warning",
|
||||
condition: (ctx) => {
|
||||
|
||||
@@ -43,6 +43,9 @@ const review: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "genai-no-descriptions-provider",
|
||||
health: (ctx) =>
|
||||
(ctx.formData as { genai?: { enabled?: boolean } })?.genai
|
||||
?.enabled === true,
|
||||
field: "genai.enabled",
|
||||
messageKey: "configMessages.objects.genaiNoDescriptionsProvider",
|
||||
severity: "warning",
|
||||
@@ -57,6 +60,7 @@ const review: SectionConfigOverrides = {
|
||||
},
|
||||
{
|
||||
key: "genai-image-source-recordings-record-disabled",
|
||||
health: true,
|
||||
field: "genai.image_source",
|
||||
messageKey:
|
||||
"configMessages.review.genaiImageSourceRecordingsRecordDisabled",
|
||||
|
||||
@@ -21,6 +21,7 @@ const semanticSearch: SectionConfigOverrides = {
|
||||
fieldMessages: [
|
||||
{
|
||||
key: "jinav2-small-model-size",
|
||||
health: (ctx) => ctx.fullConfig.semantic_search?.enabled === true,
|
||||
field: "model_size",
|
||||
messageKey: "configMessages.semanticSearch.jinav2SmallModelSize",
|
||||
severity: "warning",
|
||||
|
||||
@@ -28,6 +28,13 @@ export type ConditionalMessage = {
|
||||
values?: Record<string, unknown>;
|
||||
/** Optional documentation path (e.g. "/configuration/object_detectors#model"). */
|
||||
docLink?: string;
|
||||
/**
|
||||
* Whether the Health tab evaluates this message against the saved config.
|
||||
* Absent or false: form only. true: shown whenever condition() holds. A
|
||||
* function: shown when both condition(ctx) and health(ctx) hold, for
|
||||
* messages the form deliberately shows even when the feature is off.
|
||||
*/
|
||||
health?: boolean | ((ctx: MessageConditionContext) => boolean);
|
||||
};
|
||||
|
||||
/** Field-level conditional message, adds field targeting */
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/** settings page id that edits each config section at camera level */
|
||||
export const CAMERA_PAGE_BY_SECTION: Record<string, string> = {
|
||||
detect: "cameraDetect",
|
||||
ffmpeg: "cameraFfmpeg",
|
||||
record: "cameraRecording",
|
||||
snapshots: "cameraSnapshots",
|
||||
motion: "cameraMotion",
|
||||
objects: "cameraObjects",
|
||||
review: "cameraReview",
|
||||
audio: "cameraAudioEvents",
|
||||
audio_transcription: "cameraAudioTranscription",
|
||||
notifications: "cameraNotifications",
|
||||
live: "cameraLivePlayback",
|
||||
birdseye: "cameraBirdseye",
|
||||
face_recognition: "cameraFaceRecognition",
|
||||
lpr: "cameraLpr",
|
||||
timestamp_style: "cameraTimestampStyle",
|
||||
onvif: "cameraOnvif",
|
||||
};
|
||||
|
||||
/** settings page id that edits each config section at global level */
|
||||
export const GLOBAL_PAGE_BY_SECTION: Record<string, string> = {
|
||||
detect: "globalDetect",
|
||||
record: "globalRecording",
|
||||
snapshots: "globalSnapshots",
|
||||
ffmpeg: "globalFfmpeg",
|
||||
motion: "globalMotion",
|
||||
objects: "globalObjects",
|
||||
review: "globalReview",
|
||||
audio: "globalAudioEvents",
|
||||
live: "globalLivePlayback",
|
||||
timestamp_style: "globalTimestampStyle",
|
||||
database: "systemDatabase",
|
||||
tls: "systemTls",
|
||||
auth: "systemAuthentication",
|
||||
networking: "systemNetworking",
|
||||
proxy: "systemProxy",
|
||||
ui: "systemUi",
|
||||
logger: "systemLogging",
|
||||
environment_vars: "systemEnvironmentVariables",
|
||||
telemetry: "systemTelemetry",
|
||||
birdseye: "systemBirdseye",
|
||||
models: "systemDetectorsAndModel",
|
||||
mqtt: "systemMqtt",
|
||||
semantic_search: "integrationSemanticSearch",
|
||||
genai: "integrationGenerativeAi",
|
||||
face_recognition: "integrationFaceRecognition",
|
||||
lpr: "integrationLpr",
|
||||
classification: "integrationObjectClassification",
|
||||
audio_transcription: "integrationAudioTranscription",
|
||||
};
|
||||
|
||||
export function settingsLink(
|
||||
section: string,
|
||||
level: "global" | "camera",
|
||||
cameraName?: string,
|
||||
): string | undefined {
|
||||
if (level === "camera") {
|
||||
const page = CAMERA_PAGE_BY_SECTION[section];
|
||||
return page && cameraName
|
||||
? `/settings?page=${page}&camera=${encodeURIComponent(cameraName)}`
|
||||
: undefined;
|
||||
}
|
||||
|
||||
const page = GLOBAL_PAGE_BY_SECTION[section];
|
||||
return page ? `/settings?page=${page}` : undefined;
|
||||
}
|
||||
@@ -25,24 +25,7 @@ import {
|
||||
pathMatchesHiddenPattern,
|
||||
} from "@/utils/configUtil";
|
||||
import { useOverrideFieldLabel } from "./useOverrideFieldLabel";
|
||||
|
||||
const CAMERA_PAGE_BY_SECTION: Record<string, string> = {
|
||||
detect: "cameraDetect",
|
||||
ffmpeg: "cameraFfmpeg",
|
||||
record: "cameraRecording",
|
||||
snapshots: "cameraSnapshots",
|
||||
motion: "cameraMotion",
|
||||
objects: "cameraObjects",
|
||||
review: "cameraReview",
|
||||
audio: "cameraAudioEvents",
|
||||
audio_transcription: "cameraAudioTranscription",
|
||||
notifications: "cameraNotifications",
|
||||
live: "cameraLivePlayback",
|
||||
birdseye: "cameraBirdseye",
|
||||
face_recognition: "cameraFaceRecognition",
|
||||
lpr: "cameraLpr",
|
||||
timestamp_style: "cameraTimestampStyle",
|
||||
};
|
||||
import { CAMERA_PAGE_BY_SECTION } from "@/components/config-form/sectionPages";
|
||||
|
||||
const MAX_FIELDS_PER_CAMERA = 5;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user