mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-29 15:19:00 +03:00
Miscellaneous fixes (0.17 Beta) (#21443)
* Use thread lock for JinaV2 call as it sets multiple internal fields while being called * fix audio label translation in explore filter * Show event in all cases, even without non-none match * improve i18n key fallback when translation files aren't loaded just display a valid time now instead of "invalid time" --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
co-authored by
Josh Hawkins
parent
3655b9269d
commit
e2a1208c90
@@ -251,11 +251,30 @@ function GeneralFilterButton({
|
||||
updateLabelFilter,
|
||||
}: GeneralFilterButtonProps) {
|
||||
const { t } = useTranslation(["components/filter"]);
|
||||
const { data: config } = useSWR<FrigateConfig>("config", {
|
||||
revalidateOnFocus: false,
|
||||
});
|
||||
const [open, setOpen] = useState(false);
|
||||
const [currentLabels, setCurrentLabels] = useState<string[] | undefined>(
|
||||
selectedLabels,
|
||||
);
|
||||
|
||||
const allAudioListenLabels = useMemo<Set<string>>(() => {
|
||||
if (!config) {
|
||||
return new Set<string>();
|
||||
}
|
||||
|
||||
const labels = new Set<string>();
|
||||
Object.values(config.cameras).forEach((camera) => {
|
||||
if (camera?.audio?.enabled) {
|
||||
camera.audio.listen.forEach((label) => {
|
||||
labels.add(label);
|
||||
});
|
||||
}
|
||||
});
|
||||
return labels;
|
||||
}, [config]);
|
||||
|
||||
const buttonText = useMemo(() => {
|
||||
if (isMobile) {
|
||||
return t("labels.all.short");
|
||||
@@ -266,13 +285,17 @@ function GeneralFilterButton({
|
||||
}
|
||||
|
||||
if (selectedLabels.length == 1) {
|
||||
return getTranslatedLabel(selectedLabels[0]);
|
||||
const label = selectedLabels[0];
|
||||
return getTranslatedLabel(
|
||||
label,
|
||||
allAudioListenLabels.has(label) ? "audio" : "object",
|
||||
);
|
||||
}
|
||||
|
||||
return t("labels.count", {
|
||||
count: selectedLabels.length,
|
||||
});
|
||||
}, [selectedLabels, t]);
|
||||
}, [selectedLabels, allAudioListenLabels, t]);
|
||||
|
||||
// ui
|
||||
|
||||
|
||||
Reference in New Issue
Block a user