From a67fd9623d9b7ff66cfa241c0fd10e86eb120b5a Mon Sep 17 00:00:00 2001 From: nikec <43032218+niikeec@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:52:35 +0200 Subject: [PATCH] [ENG-1131] File path hidden filter (#1398) hidden filter --- core/src/api/search.rs | 3 +++ interface/app/$libraryId/location/$id.tsx | 5 ++++- packages/client/src/core.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/api/search.rs b/core/src/api/search.rs index 48a309490..4f65f4631 100644 --- a/core/src/api/search.rs +++ b/core/src/api/search.rs @@ -122,6 +122,8 @@ struct FilePathFilterArgs { path: Option, #[specta(optional)] object: Option, + #[specta(optional)] + hidden: Option, } impl FilePathFilterArgs { @@ -172,6 +174,7 @@ impl FilePathFilterArgs { self.extension.map(Some).map(extension::equals), self.created_at.from.map(|v| date_created::gte(v.into())), self.created_at.to.map(|v| date_created::lte(v.into())), + self.hidden.map(Some).map(hidden::equals), directory_materialized_path_str .map(Some) .map(materialized_path::equals), diff --git a/interface/app/$libraryId/location/$id.tsx b/interface/app/$libraryId/location/$id.tsx index 9691b7baf..bde3da5c5 100644 --- a/interface/app/$libraryId/location/$id.tsx +++ b/interface/app/$libraryId/location/$id.tsx @@ -150,7 +150,10 @@ const useItems = ({ : { path: path ?? '' }) }; - const count = useLibraryQuery(['search.pathsCount', { filter }]); + const count = useLibraryQuery([ + 'search.pathsCount', + { filter: { ...filter, hidden: explorerSettings.showHiddenFiles ? undefined : false } } + ]); const query = usePathsInfiniteQuery({ arg: { filter, take }, diff --git a/packages/client/src/core.ts b/packages/client/src/core.ts index b9d26fd15..929af1f2a 100644 --- a/packages/client/src/core.ts +++ b/packages/client/src/core.ts @@ -173,7 +173,7 @@ export type FilePathCursor = { isDir: boolean; variant: FilePathCursorVariant } export type FilePathCursorVariant = "none" | { name: CursorOrderItem } | { sizeInBytes: SortOrder } | { dateCreated: CursorOrderItem } | { dateModified: CursorOrderItem } | { dateIndexed: CursorOrderItem } | { object: FilePathObjectCursor } -export type FilePathFilterArgs = { locationId?: number | null; search?: string | null; extension?: string | null; createdAt?: OptionalRange; path?: string | null; object?: ObjectFilterArgs | null } +export type FilePathFilterArgs = { locationId?: number | null; search?: string | null; extension?: string | null; createdAt?: OptionalRange; path?: string | null; object?: ObjectFilterArgs | null; hidden?: boolean | null } export type FilePathObjectCursor = { dateAccessed: CursorOrderItem } | { kind: CursorOrderItem }