forked from Github/frigate
Add ability to filter search by time range (#13946)
* Add ability to filter by time range * Cleanup * Handle input with tags * fix input for time_range filter * fix before and after filters * clean up * Ensure the default value works as expected * Handle time range in am/pm based on browser * Fix arrow * Fix text * Handle midnight case * fix width * Fix bg * Fix bg * Fix mobile spacing * y spacing * remove left padding --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,23 @@
|
||||
const SEARCH_FILTERS = [
|
||||
"cameras",
|
||||
"date",
|
||||
"time",
|
||||
"general",
|
||||
"zone",
|
||||
"sub",
|
||||
"source",
|
||||
] as const;
|
||||
export type SearchFilters = (typeof SEARCH_FILTERS)[number];
|
||||
export const DEFAULT_SEARCH_FILTERS: SearchFilters[] = [
|
||||
"cameras",
|
||||
"date",
|
||||
"time",
|
||||
"general",
|
||||
"zone",
|
||||
"sub",
|
||||
"source",
|
||||
];
|
||||
|
||||
export type SearchSource = "similarity" | "thumbnail" | "description";
|
||||
|
||||
export type SearchResult = {
|
||||
@@ -32,14 +52,18 @@ export type SearchFilter = {
|
||||
query?: string;
|
||||
cameras?: string[];
|
||||
labels?: string[];
|
||||
subLabels?: string[];
|
||||
sub_labels?: string[];
|
||||
zones?: string[];
|
||||
before?: number;
|
||||
after?: number;
|
||||
time_range?: string;
|
||||
search_type?: SearchSource[];
|
||||
event_id?: string;
|
||||
};
|
||||
|
||||
export const DEFAULT_TIME_RANGE_AFTER = "00:00";
|
||||
export const DEFAULT_TIME_RANGE_BEFORE = "23:59";
|
||||
|
||||
export type SearchQueryParams = {
|
||||
cameras?: string[];
|
||||
labels?: string[];
|
||||
@@ -53,6 +77,7 @@ export type SearchQueryParams = {
|
||||
include_thumbnails?: number;
|
||||
query?: string;
|
||||
page?: number;
|
||||
time_range?: string;
|
||||
};
|
||||
|
||||
export type SearchQuery = [string, SearchQueryParams] | null;
|
||||
|
||||
Reference in New Issue
Block a user