mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-17 16:44:29 +03:00
add submitted filter to dialog
This commit is contained in:
parent
ec8d4387c7
commit
1c6c340c4d
@ -119,6 +119,7 @@ export default function SearchFilterDialog({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<SnapshotClipFilterContent
|
<SnapshotClipFilterContent
|
||||||
|
config={config}
|
||||||
hasSnapshot={
|
hasSnapshot={
|
||||||
currentFilter.has_snapshot !== undefined
|
currentFilter.has_snapshot !== undefined
|
||||||
? currentFilter.has_snapshot === 1
|
? currentFilter.has_snapshot === 1
|
||||||
@ -129,12 +130,19 @@ export default function SearchFilterDialog({
|
|||||||
? currentFilter.has_clip === 1
|
? currentFilter.has_clip === 1
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
setSnapshotClip={(snapshot, clip) =>
|
submittedToFrigatePlus={
|
||||||
|
currentFilter.is_submitted !== undefined
|
||||||
|
? currentFilter.is_submitted === 1
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
setSnapshotClip={(snapshot, clip, submitted) =>
|
||||||
setCurrentFilter({
|
setCurrentFilter({
|
||||||
...currentFilter,
|
...currentFilter,
|
||||||
has_snapshot:
|
has_snapshot:
|
||||||
snapshot !== undefined ? (snapshot ? 1 : 0) : undefined,
|
snapshot !== undefined ? (snapshot ? 1 : 0) : undefined,
|
||||||
has_clip: clip !== undefined ? (clip ? 1 : 0) : undefined,
|
has_clip: clip !== undefined ? (clip ? 1 : 0) : undefined,
|
||||||
|
is_submitted:
|
||||||
|
submitted !== undefined ? (submitted ? 1 : 0) : undefined,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -508,17 +516,22 @@ export function ScoreFilterContent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SnapshotClipContentProps = {
|
type SnapshotClipContentProps = {
|
||||||
|
config?: FrigateConfig;
|
||||||
hasSnapshot: boolean | undefined;
|
hasSnapshot: boolean | undefined;
|
||||||
hasClip: boolean | undefined;
|
hasClip: boolean | undefined;
|
||||||
|
submittedToFrigatePlus: boolean | undefined;
|
||||||
setSnapshotClip: (
|
setSnapshotClip: (
|
||||||
snapshot: boolean | undefined,
|
snapshot: boolean | undefined,
|
||||||
clip: boolean | undefined,
|
clip: boolean | undefined,
|
||||||
|
submittedToFrigate: boolean | undefined,
|
||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function SnapshotClipFilterContent({
|
export function SnapshotClipFilterContent({
|
||||||
|
config,
|
||||||
hasSnapshot,
|
hasSnapshot,
|
||||||
hasClip,
|
hasClip,
|
||||||
|
submittedToFrigatePlus,
|
||||||
setSnapshotClip,
|
setSnapshotClip,
|
||||||
}: SnapshotClipContentProps) {
|
}: SnapshotClipContentProps) {
|
||||||
const [isSnapshotFilterActive, setIsSnapshotFilterActive] = useState(
|
const [isSnapshotFilterActive, setIsSnapshotFilterActive] = useState(
|
||||||
@ -527,6 +540,11 @@ function SnapshotClipFilterContent({
|
|||||||
const [isClipFilterActive, setIsClipFilterActive] = useState(
|
const [isClipFilterActive, setIsClipFilterActive] = useState(
|
||||||
hasClip !== undefined,
|
hasClip !== undefined,
|
||||||
);
|
);
|
||||||
|
const [isFrigatePlusFilterActive, setIsFrigatePlusFilterActive] = useState(
|
||||||
|
submittedToFrigatePlus !== undefined &&
|
||||||
|
isSnapshotFilterActive &&
|
||||||
|
hasSnapshot === true,
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsSnapshotFilterActive(hasSnapshot !== undefined);
|
setIsSnapshotFilterActive(hasSnapshot !== undefined);
|
||||||
@ -536,6 +554,14 @@ function SnapshotClipFilterContent({
|
|||||||
setIsClipFilterActive(hasClip !== undefined);
|
setIsClipFilterActive(hasClip !== undefined);
|
||||||
}, [hasClip]);
|
}, [hasClip]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsFrigatePlusFilterActive(
|
||||||
|
submittedToFrigatePlus !== undefined &&
|
||||||
|
isSnapshotFilterActive &&
|
||||||
|
hasSnapshot === true,
|
||||||
|
);
|
||||||
|
}, [submittedToFrigatePlus, isSnapshotFilterActive, hasSnapshot]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="overflow-x-hidden">
|
<div className="overflow-x-hidden">
|
||||||
<DropdownMenuSeparator className="mb-3" />
|
<DropdownMenuSeparator className="mb-3" />
|
||||||
@ -551,9 +577,9 @@ function SnapshotClipFilterContent({
|
|||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
setIsSnapshotFilterActive(checked as boolean);
|
setIsSnapshotFilterActive(checked as boolean);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
setSnapshotClip(true, hasClip);
|
setSnapshotClip(true, hasClip, submittedToFrigatePlus);
|
||||||
} else {
|
} else {
|
||||||
setSnapshotClip(undefined, hasClip);
|
setSnapshotClip(undefined, hasClip, undefined);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -570,8 +596,10 @@ function SnapshotClipFilterContent({
|
|||||||
hasSnapshot === undefined ? undefined : hasSnapshot ? "yes" : "no"
|
hasSnapshot === undefined ? undefined : hasSnapshot ? "yes" : "no"
|
||||||
}
|
}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
if (value === "yes") setSnapshotClip(true, hasClip);
|
if (value === "yes")
|
||||||
else if (value === "no") setSnapshotClip(false, hasClip);
|
setSnapshotClip(true, hasClip, submittedToFrigatePlus);
|
||||||
|
else if (value === "no")
|
||||||
|
setSnapshotClip(false, hasClip, undefined);
|
||||||
}}
|
}}
|
||||||
disabled={!isSnapshotFilterActive}
|
disabled={!isSnapshotFilterActive}
|
||||||
>
|
>
|
||||||
@ -592,6 +620,66 @@ function SnapshotClipFilterContent({
|
|||||||
</ToggleGroup>
|
</ToggleGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{config?.plus?.enabled && (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<Checkbox
|
||||||
|
id="plus-filter"
|
||||||
|
className="size-5 text-white accent-white data-[state=checked]:bg-selected data-[state=checked]:text-white"
|
||||||
|
checked={isFrigatePlusFilterActive}
|
||||||
|
disabled={!isSnapshotFilterActive || hasSnapshot !== true}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
setIsFrigatePlusFilterActive(checked as boolean);
|
||||||
|
if (checked) {
|
||||||
|
setSnapshotClip(hasSnapshot, hasClip, true);
|
||||||
|
} else {
|
||||||
|
setSnapshotClip(hasSnapshot, hasClip, undefined);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
htmlFor="plus-filter"
|
||||||
|
className="cursor-pointer text-sm font-medium leading-none"
|
||||||
|
>
|
||||||
|
Submitted to Frigate+
|
||||||
|
</Label>
|
||||||
|
</div>
|
||||||
|
<ToggleGroup
|
||||||
|
type="single"
|
||||||
|
value={
|
||||||
|
submittedToFrigatePlus === undefined
|
||||||
|
? undefined
|
||||||
|
: submittedToFrigatePlus
|
||||||
|
? "yes"
|
||||||
|
: "no"
|
||||||
|
}
|
||||||
|
onValueChange={(value) => {
|
||||||
|
if (value === "yes")
|
||||||
|
setSnapshotClip(hasSnapshot, hasClip, true);
|
||||||
|
else if (value === "no")
|
||||||
|
setSnapshotClip(hasSnapshot, hasClip, false);
|
||||||
|
else setSnapshotClip(hasSnapshot, hasClip, undefined);
|
||||||
|
}}
|
||||||
|
disabled={!isFrigatePlusFilterActive}
|
||||||
|
>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value="yes"
|
||||||
|
aria-label="Yes"
|
||||||
|
className="data-[state=on]:bg-selected data-[state=on]:text-white data-[state=on]:hover:bg-selected data-[state=on]:hover:text-white"
|
||||||
|
>
|
||||||
|
Yes
|
||||||
|
</ToggleGroupItem>
|
||||||
|
<ToggleGroupItem
|
||||||
|
value="no"
|
||||||
|
aria-label="No"
|
||||||
|
className="data-[state=on]:bg-selected data-[state=on]:text-white data-[state=on]:hover:bg-selected data-[state=on]:hover:text-white"
|
||||||
|
>
|
||||||
|
No
|
||||||
|
</ToggleGroupItem>
|
||||||
|
</ToggleGroup>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@ -601,9 +689,13 @@ function SnapshotClipFilterContent({
|
|||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
setIsClipFilterActive(checked as boolean);
|
setIsClipFilterActive(checked as boolean);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
setSnapshotClip(hasSnapshot, true);
|
setSnapshotClip(hasSnapshot, true, submittedToFrigatePlus);
|
||||||
} else {
|
} else {
|
||||||
setSnapshotClip(hasSnapshot, undefined);
|
setSnapshotClip(
|
||||||
|
hasSnapshot,
|
||||||
|
undefined,
|
||||||
|
submittedToFrigatePlus,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -618,8 +710,10 @@ function SnapshotClipFilterContent({
|
|||||||
type="single"
|
type="single"
|
||||||
value={hasClip === undefined ? undefined : hasClip ? "yes" : "no"}
|
value={hasClip === undefined ? undefined : hasClip ? "yes" : "no"}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
if (value === "yes") setSnapshotClip(hasSnapshot, true);
|
if (value === "yes")
|
||||||
else if (value === "no") setSnapshotClip(hasSnapshot, false);
|
setSnapshotClip(hasSnapshot, true, submittedToFrigatePlus);
|
||||||
|
else if (value === "no")
|
||||||
|
setSnapshotClip(hasSnapshot, false, submittedToFrigatePlus);
|
||||||
}}
|
}}
|
||||||
disabled={!isClipFilterActive}
|
disabled={!isClipFilterActive}
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user