mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-17 08:35:21 +03:00
Add reindex progress to mobile bottom bar status alert
This commit is contained in:
parent
40c6fda19d
commit
382399dd66
@ -3,7 +3,7 @@ import { IoIosWarning } from "react-icons/io";
|
|||||||
import { Drawer, DrawerContent, DrawerTrigger } from "../ui/drawer";
|
import { Drawer, DrawerContent, DrawerTrigger } from "../ui/drawer";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { FrigateStats } from "@/types/stats";
|
import { FrigateStats } from "@/types/stats";
|
||||||
import { useFrigateStats } from "@/api/ws";
|
import { useEmbeddingsReindexProgress, useFrigateStats } from "@/api/ws";
|
||||||
import { useContext, useEffect, useMemo } from "react";
|
import { useContext, useEffect, useMemo } from "react";
|
||||||
import useStats from "@/hooks/use-stats";
|
import useStats from "@/hooks/use-stats";
|
||||||
import GeneralSettings from "../menu/GeneralSettings";
|
import GeneralSettings from "../menu/GeneralSettings";
|
||||||
@ -74,6 +74,23 @@ function StatusAlertNav({ className }: StatusAlertNavProps) {
|
|||||||
});
|
});
|
||||||
}, [potentialProblems, addMessage, clearMessages]);
|
}, [potentialProblems, addMessage, clearMessages]);
|
||||||
|
|
||||||
|
const { payload: reindexState } = useEmbeddingsReindexProgress();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (reindexState) {
|
||||||
|
if (reindexState.status == "indexing") {
|
||||||
|
clearMessages("embeddings-reindex");
|
||||||
|
addMessage(
|
||||||
|
"embeddings-reindex",
|
||||||
|
`Reindexing embeddings (${Math.floor((reindexState.processed_objects / reindexState.total_objects) * 100)}% complete)`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (reindexState.status === "completed") {
|
||||||
|
clearMessages("embeddings-reindex");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [reindexState, addMessage, clearMessages]);
|
||||||
|
|
||||||
if (!messages || Object.keys(messages).length === 0) {
|
if (!messages || Object.keys(messages).length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user