import { h, Fragment } from 'preact';
import ActivityIndicator from '../components/ActivityIndicator';
import Heading from '../components/Heading';
import { useWs } from '../api/ws';
import useSWR from 'swr';
import { Table, Tbody, Thead, Tr, Th, Td } from '../components/Table';
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
{(!service || !storage) ? (
) : (
Overview
Data
| Location |
Used MB |
Total MB |
| Snapshots & Recordings |
{service['storage']['/media/frigate/recordings']['used']} |
{service['storage']['/media/frigate/recordings']['total']} |
Memory
| Location |
Used MB |
Total MB |
| /dev/shm |
{service['storage']['/dev/shm']['used']} |
{service['storage']['/dev/shm']['total']} |
| /tmp/cache |
{service['storage']['/tmp/cache']['used']} |
{service['storage']['/tmp/cache']['total']} |
Cameras
{Object.entries(storage).map(([name, camera]) => (
{name}
| Usage |
Stream Bandwidth |
| {Math.round(camera['usage_percent'] ?? 0)}% |
{camera['bandwidth']} MB/hr |
))}
)}
);
}