mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-16 18:43:02 +03:00
report null instead of 0 for a stream with no cached bandwidth sample
This commit is contained in:
@@ -204,9 +204,12 @@ export function CombinedStorageGraph({
|
||||
|
||||
const getStreamSplit = useCallback(
|
||||
(row: StorageRow, field: keyof StreamStorage) => {
|
||||
const sub = row.streams?.sub;
|
||||
const mainValue = row.streams?.main?.[field];
|
||||
const subValue = row.streams?.sub?.[field];
|
||||
|
||||
if (!sub) {
|
||||
// omit the split entirely when either side is unknown, rather than
|
||||
// showing a zero that would read as "this stream costs nothing"
|
||||
if (mainValue == null || subValue == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -216,13 +219,13 @@ export function CombinedStorageGraph({
|
||||
<span className="text-muted-foreground">
|
||||
{t("quality.main", { ns: "components/player" })}
|
||||
</span>{" "}
|
||||
{getUnitSize(row.streams?.main?.[field] ?? 0)}
|
||||
{getUnitSize(mainValue)}
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">
|
||||
{t("quality.sub", { ns: "components/player" })}
|
||||
</span>{" "}
|
||||
{getUnitSize(sub[field])}
|
||||
{getUnitSize(subValue)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -103,7 +103,7 @@ export type StorageStats = {
|
||||
|
||||
export type StreamStorage = {
|
||||
usage: number;
|
||||
bandwidth: number;
|
||||
bandwidth: number | null;
|
||||
};
|
||||
|
||||
export type CameraStorage = {
|
||||
|
||||
Reference in New Issue
Block a user