Replace individual storage graphs with combined graph (#13438)

* Replace individual storage graphs with combined graph

* replace underscores with spaces

* fix bar height
This commit is contained in:
Josh Hawkins
2024-08-30 08:56:55 -05:00
committed by GitHub
parent a8dcc87019
commit 6a0b5c3a3f
3 changed files with 247 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
import { CombinedStorageGraph } from "@/components/graph/CombinedStorageGraph";
import { StorageGraph } from "@/components/graph/StorageGraph";
import { FrigateStats } from "@/types/stats";
import { getUnitSize } from "@/utils/storageUtil";
import { useMemo } from "react";
import useSWR from "swr";
@@ -74,22 +74,12 @@ export default function StorageMetrics({
<div className="mt-4 text-sm font-medium text-muted-foreground">
Camera Storage
</div>
<div className="mt-4 grid grid-cols-1 gap-2 sm:grid-cols-3">
{Object.keys(cameraStorage).map((camera) => (
<div className="flex-col rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
<div className="mb-5 flex flex-row items-center justify-between">
<div className="capitalize">{camera.replaceAll("_", " ")}</div>
<div className="text-xs text-muted-foreground">
{getUnitSize(cameraStorage[camera].bandwidth)} / hour
</div>
</div>
<StorageGraph
graphId={`${camera}-storage`}
used={cameraStorage[camera].usage}
total={totalStorage.used}
/>
</div>
))}
<div className="mt-4 bg-background_alt p-2.5 md:rounded-2xl">
<CombinedStorageGraph
graphId={`single-storage`}
cameraStorage={cameraStorage}
totalStorage={totalStorage}
/>
</div>
</div>
);