mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 05:35:25 +03:00
Cleanup rendering
This commit is contained in:
parent
e5b9e7e5cd
commit
84064ea1c1
@ -1,5 +1,6 @@
|
||||
import { useFrigateStats } from "@/api/ws";
|
||||
import { CameraLineGraph } from "@/components/graph/SystemGraph";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
import { FrigateStats } from "@/types/stats";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
@ -148,12 +149,13 @@ export default function CameraMetrics({
|
||||
return (
|
||||
<div className="size-full mt-4 flex flex-col overflow-y-auto">
|
||||
<div className="mb-5">Cameras</div>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
{config &&
|
||||
Object.values(config.cameras).map((camera) => {
|
||||
if (camera.enabled) {
|
||||
return (
|
||||
<div key={camera.name} className="grid grid-cols-2 gap-2">
|
||||
<div key={camera.name} className="grid sm:grid-cols-2 gap-2">
|
||||
{Object.keys(cameraCpuSeries).includes(camera.name) ? (
|
||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||
<div className="mb-5 capitalize">
|
||||
{camera.name.replaceAll("_", " ")} CPU
|
||||
@ -166,6 +168,10 @@ export default function CameraMetrics({
|
||||
data={Object.values(cameraCpuSeries[camera.name] || {})}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<Skeleton className="size-full aspect-video" />
|
||||
)}
|
||||
{Object.keys(cameraFpsSeries).includes(camera.name) ? (
|
||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||
<div className="mb-5 capitalize">
|
||||
{camera.name.replaceAll("_", " ")} DPS
|
||||
@ -178,6 +184,9 @@ export default function CameraMetrics({
|
||||
data={Object.values(cameraFpsSeries[camera.name] || {})}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<Skeleton className="size-full aspect-video" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -61,6 +61,16 @@ export default function GeneralMetrics({
|
||||
}
|
||||
}, [initialStats, updatedStats, statsHistory, lastUpdated, setLastUpdated]);
|
||||
|
||||
const canGetGpuInfo = useMemo(
|
||||
() =>
|
||||
statsHistory.length > 0 &&
|
||||
Object.keys(statsHistory[0]?.gpu_usages ?? {}).filter(
|
||||
(key) =>
|
||||
key == "amd-vaapi" || key == "intel-vaapi" || key == "intel-qsv",
|
||||
).length > 0,
|
||||
[statsHistory],
|
||||
);
|
||||
|
||||
// timestamps
|
||||
|
||||
const updateTimes = useMemo(
|
||||
@ -274,7 +284,7 @@ export default function GeneralMetrics({
|
||||
Detectors
|
||||
</div>
|
||||
<div className="w-full mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
|
||||
{detInferenceTimeSeries.length != 0 ? (
|
||||
{statsHistory.length != 0 ? (
|
||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||
<div className="mb-5">Detector Inference Speed</div>
|
||||
{detInferenceTimeSeries.map((series) => (
|
||||
@ -336,13 +346,7 @@ export default function GeneralMetrics({
|
||||
<div className="text-muted-foreground text-sm font-medium">
|
||||
GPUs
|
||||
</div>
|
||||
{statsHistory.length > 0 &&
|
||||
Object.keys(statsHistory[0].gpu_usages ?? {}).filter(
|
||||
(key) =>
|
||||
key == "amd-vaapi" ||
|
||||
key == "intel-vaapi" ||
|
||||
key == "intel-qsv",
|
||||
).length > 0 && (
|
||||
{canGetGpuInfo && (
|
||||
<Button
|
||||
className="cursor-pointer"
|
||||
variant="secondary"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user