From 11054daebef6324d645a444cd560d7b1c3a87f49 Mon Sep 17 00:00:00 2001 From: James L <24962424+leccelecce@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:20:41 +0000 Subject: [PATCH] System page: add last updated time ago (#5195) --- frigate/stats.py | 2 ++ frigate/types.py | 1 + web/src/routes/System.jsx | 13 ++++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/frigate/stats.py b/frigate/stats.py index 0e23fb94e..459457d6e 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -53,6 +53,7 @@ def stats_init( "detectors": detectors, "started": int(time.time()), "latest_frigate_version": get_latest_version(config), + "last_updated": int(time.time()), } return stats_tracking @@ -244,6 +245,7 @@ def stats_snapshot( "latest_version": stats_tracking["latest_frigate_version"], "storage": {}, "temperatures": get_temperatures(), + "last_updated": int(time.time()), } for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]: diff --git a/frigate/types.py b/frigate/types.py index d31e0cd06..04339e366 100644 --- a/frigate/types.py +++ b/frigate/types.py @@ -29,3 +29,4 @@ class StatsTrackingTypes(TypedDict): detectors: dict[str, ObjectDetectProcess] started: int latest_frigate_version: str + last_updated: int diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index fdabed335..e1ff56ed0 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -9,6 +9,7 @@ import axios from 'axios'; import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table'; import { useState } from 'preact/hooks'; import Dialog from '../components/Dialog'; +import TimeAgo from '../components/TimeAgo'; import copy from 'copy-to-clipboard'; const emptyObject = Object.freeze({}); @@ -84,6 +85,12 @@ export default function System() { System {service.version} + {service.last_updated && ( +

+ Last refreshed: +

+ )} + {state.showFfprobe && (
@@ -247,11 +254,11 @@ export default function System() { {cameras[camera]['pid'] || '- '} {(() => { - if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 1) + if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 1) return {cameras[camera]['detection_fps']} ({cameras[camera]['skipped_fps']} skipped) - else if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 0) + else if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 0) return disabled - + return - })()}