fix red unsaved dot

This commit is contained in:
Josh Hawkins 2026-02-01 17:25:39 -06:00
parent b9149b6366
commit 5f262621c4
2 changed files with 42 additions and 3 deletions

View File

@ -464,6 +464,32 @@ const GLOBAL_SECTION_MAPPING: Record<string, SettingsType> = {
timestamp_style: "globalTimestampStyle",
};
const ENRICHMENTS_SECTION_MAPPING: Record<string, SettingsType> = {
semantic_search: "integrationSemanticSearch",
genai: "integrationGenerativeAi",
face_recognition: "integrationFaceRecognition",
lpr: "integrationLpr",
classification: "integrationObjectClassification",
audio_transcription: "integrationAudioTranscription",
};
const SYSTEM_SECTION_MAPPING: Record<string, SettingsType> = {
database: "systemDatabase",
mqtt: "systemMqtt",
tls: "systemTls",
auth: "systemAuthentication",
networking: "systemNetworking",
proxy: "systemProxy",
ui: "systemUi",
logger: "systemLogging",
environment_vars: "systemEnvironmentVariables",
telemetry: "systemTelemetry",
birdseye: "systemBirdseye",
ffmpeg: "systemFfmpeg",
detectors: "systemDetectorHardware",
model: "systemDetectionModel",
};
const CAMERA_SECTION_KEYS = new Set<SettingsType>(
Object.values(CAMERA_SECTION_MAPPING),
);
@ -661,7 +687,11 @@ export default function Settings() {
if (level === "camera") {
menuKey = CAMERA_SECTION_MAPPING[sectionKey] || sectionKey;
} else {
menuKey = GLOBAL_SECTION_MAPPING[sectionKey] || sectionKey;
menuKey =
GLOBAL_SECTION_MAPPING[sectionKey] ||
ENRICHMENTS_SECTION_MAPPING[sectionKey] ||
SYSTEM_SECTION_MAPPING[sectionKey] ||
sectionKey;
}
setSectionStatusByKey((prev) => ({

View File

@ -1,4 +1,4 @@
import { useState } from "react";
import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import type { SectionConfig } from "@/components/config-form/sections";
import { ConfigSectionTemplate } from "@/components/config-form/sections";
@ -47,6 +47,7 @@ export function SingleSectionPage({
showOverrideIndicator = true,
selectedCamera,
setUnsavedChanges,
onSectionStatusChange,
pendingDataBySection,
onPendingDataChange,
}: SingleSectionPageProps) {
@ -62,6 +63,14 @@ export function SingleSectionPage({
isOverridden: false,
});
const handleSectionStatusChange = useCallback(
(status: SectionStatus) => {
setSectionStatus(status);
onSectionStatusChange?.(sectionKey, level, status);
},
[level, onSectionStatusChange, sectionKey],
);
if (level === "camera" && !selectedCamera) {
return (
<div className="flex h-full items-center justify-center text-muted-foreground">
@ -122,7 +131,7 @@ export function SingleSectionPage({
pendingDataBySection={pendingDataBySection}
onPendingDataChange={onPendingDataChange}
requiresRestart={requiresRestart}
onStatusChange={setSectionStatus}
onStatusChange={handleSectionStatusChange}
/>
</div>
);