diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index 91d3e06c81..1f50863e46 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -1952,7 +1952,11 @@ "modelSizeLarge": "The 'large' model is optimized for multi-line license plates. The 'small' model provides better performance over 'large' and should be used unless your region uses multi-line plate formats." }, "record": { - "noRecordRole": "No streams have the record role defined. Recording will not function." + "noRecordRole": "No streams have the record role defined. Recording will not function.", + "profileBaseDisabled": "Recording is disabled in this camera's base config, so enabling it in a profile has no effect. Enable recording in the base config and use a profile to disable it instead." + }, + "notifications": { + "profileBaseDisabled": "No cameras have notifications enabled in their base config, so enabling them in a profile has no effect. Enable notifications in the base config of at least one camera." }, "birdseye": { "objectsModeDetectDisabled": "Birdseye is set to 'objects' mode, but object detection is disabled for this camera. The camera will not appear in Birdseye." diff --git a/web/src/components/config-form/section-configs/notifications.ts b/web/src/components/config-form/section-configs/notifications.ts index 68fd78f788..62adcab520 100644 --- a/web/src/components/config-form/section-configs/notifications.ts +++ b/web/src/components/config-form/section-configs/notifications.ts @@ -8,6 +8,23 @@ const notifications: SectionConfigOverrides = { fieldGroups: {}, hiddenFields: ["enabled_in_config"], advancedFields: [], + fieldMessages: [ + { + key: "profile-base-notifications-disabled", + field: "enabled", + messageKey: "configMessages.notifications.profileBaseDisabled", + severity: "warning", + position: "after", + condition: (ctx) => + !!ctx.profileName && + ctx.formData?.enabled === true && + !Object.values(ctx.fullConfig.cameras).some( + (camera) => + camera.enabled_in_config && + camera.notifications.enabled_in_config, + ), + }, + ], }, global: { uiSchema: { diff --git a/web/src/components/config-form/section-configs/record.ts b/web/src/components/config-form/section-configs/record.ts index 9271e025fb..b267385124 100644 --- a/web/src/components/config-form/section-configs/record.ts +++ b/web/src/components/config-form/section-configs/record.ts @@ -16,6 +16,21 @@ const record: SectionConfigOverrides = { }, }, ], + fieldMessages: [ + { + key: "profile-base-record-disabled", + field: "enabled", + messageKey: "configMessages.record.profileBaseDisabled", + severity: "warning", + position: "after", + docLink: + "/configuration/profiles#why-cant-a-profile-enable-recording-when-its-disabled-in-the-base-config", + condition: (ctx) => + !!ctx.profileName && + ctx.formData?.enabled === true && + ctx.fullCameraConfig?.record.enabled_in_config === false, + }, + ], fieldDocs: { "alerts.pre_capture": "/configuration/record#pre-capture-and-post-capture", diff --git a/web/src/components/config-form/section-configs/types.ts b/web/src/components/config-form/section-configs/types.ts index 510d3bfa4f..30f6e6be93 100644 --- a/web/src/components/config-form/section-configs/types.ts +++ b/web/src/components/config-form/section-configs/types.ts @@ -8,6 +8,7 @@ export type MessageConditionContext = { fullCameraConfig?: CameraConfig; level: "global" | "camera"; cameraName?: string; + profileName?: string; formData: ConfigSectionData; }; diff --git a/web/src/components/config-form/sections/BaseSection.tsx b/web/src/components/config-form/sections/BaseSection.tsx index 685b06ebe3..f68a39d1d0 100644 --- a/web/src/components/config-form/sections/BaseSection.tsx +++ b/web/src/components/config-form/sections/BaseSection.tsx @@ -619,9 +619,10 @@ export function ConfigSection({ : undefined, level: effectiveLevel, cameraName, + profileName, formData: currentFormData as ConfigSectionData, }; - }, [config, currentFormData, effectiveLevel, cameraName]); + }, [config, currentFormData, effectiveLevel, cameraName, profileName]); const { activeMessages, activeFieldMessages } = useConfigMessages( sectionConfig.messages,