mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 23:25:25 +03:00
Always show eents when searching
This commit is contained in:
parent
d57c958a6c
commit
bf2d444116
@ -60,10 +60,6 @@ export default function Search() {
|
|||||||
}, [search]);
|
}, [search]);
|
||||||
|
|
||||||
const searchQuery = useMemo(() => {
|
const searchQuery = useMemo(() => {
|
||||||
if (searchTerm.length == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (similaritySearch) {
|
if (similaritySearch) {
|
||||||
return [
|
return [
|
||||||
"events/search",
|
"events/search",
|
||||||
@ -80,6 +76,7 @@ export default function Search() {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (searchTerm) {
|
||||||
return [
|
return [
|
||||||
"events/search",
|
"events/search",
|
||||||
{
|
{
|
||||||
@ -93,6 +90,20 @@ export default function Search() {
|
|||||||
include_thumbnails: 0,
|
include_thumbnails: 0,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
"events",
|
||||||
|
{
|
||||||
|
cameras: searchSearchParams["cameras"],
|
||||||
|
labels: searchSearchParams["labels"],
|
||||||
|
zones: searchSearchParams["zones"],
|
||||||
|
before: searchSearchParams["before"],
|
||||||
|
after: searchSearchParams["after"],
|
||||||
|
search_type: searchSearchParams["search_type"],
|
||||||
|
include_thumbnails: 0,
|
||||||
|
},
|
||||||
|
];
|
||||||
}, [searchTerm, searchSearchParams, similaritySearch]);
|
}, [searchTerm, searchSearchParams, similaritySearch]);
|
||||||
|
|
||||||
const { data: searchResults, isLoading } =
|
const { data: searchResults, isLoading } =
|
||||||
|
|||||||
@ -96,6 +96,11 @@ export default function SearchView({
|
|||||||
return Math.round(confidence * 100);
|
return Math.round(confidence * 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasExistingSearch = useMemo(
|
||||||
|
() => searchResults != undefined || searchFilter != undefined,
|
||||||
|
[searchResults, searchFilter],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex size-full flex-col pt-2 md:py-2">
|
<div className="flex size-full flex-col pt-2 md:py-2">
|
||||||
<Toaster closeButton={true} />
|
<Toaster closeButton={true} />
|
||||||
@ -108,7 +113,12 @@ export default function SearchView({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="relative mb-2 flex h-11 items-center justify-between pl-2 pr-2 md:pl-3">
|
<div className="relative mb-2 flex h-11 items-center justify-between pl-2 pr-2 md:pl-3">
|
||||||
<div className="relative mr-3 w-full md:w-1/3">
|
<div
|
||||||
|
className={cn(
|
||||||
|
"relative w-full",
|
||||||
|
hasExistingSearch ? "mr-3 md:w-1/3" : "md:ml-[25%] md:w-1/2",
|
||||||
|
)}
|
||||||
|
>
|
||||||
<Input
|
<Input
|
||||||
className="text-md w-full bg-muted pr-10"
|
className="text-md w-full bg-muted pr-10"
|
||||||
placeholder={
|
placeholder={
|
||||||
@ -125,10 +135,12 @@ export default function SearchView({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{hasExistingSearch && (
|
||||||
<SearchFilterGroup
|
<SearchFilterGroup
|
||||||
filter={searchFilter}
|
filter={searchFilter}
|
||||||
onUpdateFilter={onUpdateFilter}
|
onUpdateFilter={onUpdateFilter}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="no-scrollbar flex flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4">
|
<div className="no-scrollbar flex flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4">
|
||||||
@ -186,6 +198,7 @@ export default function SearchView({
|
|||||||
scrollLock={false}
|
scrollLock={false}
|
||||||
onClick={onSelectSearch}
|
onClick={onSelectSearch}
|
||||||
/>
|
/>
|
||||||
|
{searchTerm && (
|
||||||
<div className={cn("absolute right-2 top-2 z-40")}>
|
<div className={cn("absolute right-2 top-2 z-40")}>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
@ -214,6 +227,7 @@ export default function SearchView({
|
|||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={`review-item-ring pointer-events-none absolute inset-0 z-10 size-full rounded-lg outline outline-[3px] -outline-offset-[2.8px] ${selected ? `shadow-severity_alert outline-severity_alert` : "outline-transparent duration-500"}`}
|
className={`review-item-ring pointer-events-none absolute inset-0 z-10 size-full rounded-lg outline outline-[3px] -outline-offset-[2.8px] ${selected ? `shadow-severity_alert outline-severity_alert` : "outline-transparent duration-500"}`}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user