diff --git a/frigate/storage.py b/frigate/storage.py index 8700f3714..55146047b 100644 --- a/frigate/storage.py +++ b/frigate/storage.py @@ -71,7 +71,10 @@ class StorageMaintainer(threading.Thread): .scalar() ) - usages[camera] = {"usage": camera_storage} + usages[camera] = { + "usage": camera_storage, + "bandwidth": self.camera_storage_stats[camera]["bandwidth"], + } return usages diff --git a/web/src/routes/Storage.jsx b/web/src/routes/Storage.jsx index 7d68e376f..238f8eb3b 100644 --- a/web/src/routes/Storage.jsx +++ b/web/src/routes/Storage.jsx @@ -1,21 +1,84 @@ import { h, Fragment } from 'preact'; import ActivityIndicator from '../components/ActivityIndicator'; -import Button from '../components/Button'; import Heading from '../components/Heading'; -import Link from '../components/Link'; -import { useMqtt } from '../api/mqtt'; +import { useWs } from '../api/ws'; import useSWR from 'swr'; import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table'; -import { useCallback } from 'preact/hooks'; + +const emptyObject = Object.freeze({}); export default function Storage() { const { data: storage } = useSWR('recordings/storage'); + const { + value: { payload: stats }, + } = useWs('stats'); + const { data: initialStats } = useSWR('stats'); + + const { service = {} } = stats || initialStats || emptyObject; + return (
- - Storage - + Storage + + {!service ? ( +
+ +
+ ) : ( + + Overview +
+
+
Data
+
+ + + + + + + + + + + + + + + +
LocationUsedTotal
Recordings{service['storage']['/media/frigate/recordings']['used']}{service['storage']['/media/frigate/recordings']['total']}
+
+
+
+
Memory
+
+ + + + + + + + + + + + + + + + + + + + +
LocationUsedTotal
/dev/shm{service['storage']['/dev/shm']['used']}{service['storage']['/dev/shm']['total']}
/tmp/cache{service['storage']['/tmp/cache']['used']}{service['storage']['/tmp/cache']['total']}
+
+
+
+
+ )}
); -} \ No newline at end of file +}