Show Frigate+ rate limits in the UI

Tell the user Frigate+ is rate limiting requests, and how long to wait
when the server said, instead of a generic failure:

- submitting a tracked object or false positive (explore and the review
  dialog), a frame from the player, or a frame from tracking details
- validating the API key in Frigate+ settings
- the Frigate+ model list in detection model settings and the setup
  wizard

The frame upload from the player also showed failures with a success
toast, and since axios rejects on error statuses it never reached that
branch at all, so failed uploads showed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
frigate-agents[bot]
2026-11-23 23:18:29 +00:00
co-authored by Claude Opus 5.5
parent 34658593a7
commit d4f6a9fd91
11 changed files with 212 additions and 47 deletions
@@ -22,6 +22,7 @@ import { baseUrl } from "@/api/baseUrl";
import { getTranslatedLabel } from "@/utils/i18n";
import useImageLoaded from "@/hooks/use-image-loaded";
import { useIsAdmin } from "@/hooks/use-is-admin";
import { usePlusRateLimit } from "@/hooks/use-plus-rate-limit";
export type FrigatePlusDialogProps = {
upload?: Event;
@@ -37,6 +38,7 @@ export function FrigatePlusDialog({
onEventUploaded,
}: FrigatePlusDialogProps) {
const { t, i18n } = useTranslation(["components/dialog"]);
const { getRateLimitMessage } = usePlusRateLimit();
type SubmissionState = "reviewing" | "uploading" | "submitted";
const [state, setState] = useState<SubmissionState>(
@@ -63,14 +65,15 @@ export function FrigatePlusDialog({
setState("submitted");
onEventUploaded();
} catch {
} catch (error) {
setState("reviewing");
toast.error(t("explore.plus.review.toast.error"), {
position: "top-center",
});
toast.error(
getRateLimitMessage(error) ?? t("explore.plus.review.toast.error"),
{ position: "top-center" },
);
}
},
[upload, onEventUploaded, t],
[upload, onEventUploaded, t, getRateLimitMessage],
);
const [imgRef, imgLoaded, onImgLoad] = useImageLoaded();