System page: add last updated time ago (#5195)

This commit is contained in:
James L 2023-01-27 12:20:41 +00:00 committed by GitHub
parent 7926ddd008
commit 11054daebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -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"]:

View File

@ -29,3 +29,4 @@ class StatsTrackingTypes(TypedDict):
detectors: dict[str, ObjectDetectProcess]
started: int
latest_frigate_version: str
last_updated: int

View File

@ -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 <span className="text-sm">{service.version}</span>
</Heading>
{service.last_updated && (
<p>
<span>Last refreshed: <TimeAgo time={service.last_updated * 1000} dense /></span>
</p>
)}
{state.showFfprobe && (
<Dialog>
<div className="p-4">
@ -247,11 +254,11 @@ export default function System() {
<Td>{cameras[camera]['pid'] || '- '}</Td>
{(() => {
if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 1)
if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 1)
return <Td>{cameras[camera]['detection_fps']} ({cameras[camera]['skipped_fps']} skipped)</Td>
else if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 0)
else if (cameras[camera]['pid'] && cameras[camera]['detection_enabled'] == 0)
return <Td>disabled</Td>
return <Td>- </Td>
})()}