make notification ttl a global advanced setting

- Read `ttl` from the global notifications config and hide it on the camera form
- Show it under Advanced Settings on the Notifications page
- Remove extra padding that misaligned the Notifications cards with the rest of the form
- Shorten the ttl warning
This commit is contained in:
Josh Hawkins
2026-10-30 07:10:54 -05:00
parent 23e0c41fc0
commit 38e8e57329
5 changed files with 8 additions and 9 deletions
+2 -2
View File
@@ -117,8 +117,8 @@ Setting `ttl` tells the push service to keep retrying notifications sent while a
<ConfigTabs> <ConfigTabs>
<TabItem value="ui"> <TabItem value="ui">
1. Navigate to <NavPath path="Settings > Camera configuration > Notifications" /> and select the desired camera. 1. Navigate to <NavPath path="Settings > Notifications > Notifications" />.
- Set **Notification TTL** to the number of seconds to keep retrying (e.g. `10`) - Expand **Advanced Settings** and set **Notification TTL** to the number of seconds to keep retrying (e.g. `10`)
</TabItem> </TabItem>
<TabItem value="yaml"> <TabItem value="yaml">
+1 -1
View File
@@ -623,7 +623,7 @@ class WebPushClient(Communicator):
# if event is ongoing open to live view otherwise open to recordings view # if event is ongoing open to live view otherwise open to recordings view
direct_url = f"/review?id={reviewId}" if ended else f"/#{camera}" direct_url = f"/review?id={reviewId}" if ended else f"/#{camera}"
ttl = 3600 if ended else self.config.cameras[camera].notifications.ttl ttl = 3600 if ended else self.config.notifications.ttl
logger.debug(f"Sending push notification for {camera}, review ID {reviewId}") logger.debug(f"Sending push notification for {camera}, review ID {reviewId}")
+1 -1
View File
@@ -2052,7 +2052,7 @@
}, },
"notifications": { "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.", "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.",
"ttlDelay": "If your device can't be reached when an alert is active, its notifications can arrive up to this many seconds late. It will still say an object is detected and open the live view, even if the object has already left." "ttlDelay": "Notifications can arrive up to this many seconds late and still link to the live view after the review item has ended."
}, },
"birdseye": { "birdseye": {
"objectTrackingDetectDisabled": "Birdseye includes tracked objects, but object detection is disabled for this camera. The camera will not appear in Birdseye.", "objectTrackingDetectDisabled": "Birdseye includes tracked objects, but object detection is disabled for this camera. The camera will not appear in Birdseye.",
@@ -7,7 +7,7 @@ const notifications: SectionConfigOverrides = {
fieldOrder: ["enabled", "email"], fieldOrder: ["enabled", "email"],
fieldGroups: {}, fieldGroups: {},
hiddenFields: ["enabled_in_config"], hiddenFields: ["enabled_in_config"],
advancedFields: [], advancedFields: ["ttl"],
fieldMessages: [ fieldMessages: [
{ {
key: "profile-base-notifications-disabled", key: "profile-base-notifications-disabled",
@@ -41,12 +41,11 @@ const notifications: SectionConfigOverrides = {
enabled: { "ui:widget": "hidden" }, enabled: { "ui:widget": "hidden" },
email: { "ui:widget": "hidden" }, email: { "ui:widget": "hidden" },
cooldown: { "ui:widget": "hidden" }, cooldown: { "ui:widget": "hidden" },
ttl: { "ui:widget": "hidden" },
enabled_in_config: { "ui:widget": "hidden" }, enabled_in_config: { "ui:widget": "hidden" },
}, },
}, },
camera: { camera: {
hiddenFields: ["enabled_in_config", "email"], hiddenFields: ["enabled_in_config", "email", "ttl"],
}, },
}; };
@@ -340,7 +340,7 @@ export default function NotificationsSettingsExtras({
set(nextNotifications, "enabled", desiredEnabled); set(nextNotifications, "enabled", desiredEnabled);
const sanitizedNotifications = sanitizeSectionData( const sanitizedNotifications = sanitizeSectionData(
nextNotifications as ConfigSectionData, nextNotifications as ConfigSectionData,
["enabled_in_config", "email"], ["enabled_in_config", "email", "ttl"],
); );
onPendingDataChange("notifications", camera.name, sanitizedNotifications); onPendingDataChange("notifications", camera.name, sanitizedNotifications);
pendingCameraOverridesRef.current.add(camera.name); pendingCameraOverridesRef.current.add(camera.name);
@@ -490,7 +490,7 @@ export default function NotificationsSettingsExtras({
return ( return (
<div className="flex size-full flex-col md:flex-row"> <div className="flex size-full flex-col md:flex-row">
<div className="scrollbar-container order-last mb-2 mt-2 flex h-full w-full flex-col overflow-y-auto px-2 md:order-none"> <div className="scrollbar-container order-last mb-2 mt-2 flex h-full w-full flex-col overflow-y-auto md:order-none">
<div className={cn("w-full max-w-5xl space-y-6")}> <div className={cn("w-full max-w-5xl space-y-6")}>
{isAdmin && ( {isAdmin && (
<SettingsGroupCard <SettingsGroupCard