[ENG-1131] File path hidden filter (#1398)

hidden filter
This commit is contained in:
nikec
2023-09-28 20:52:35 +02:00
committed by GitHub
parent 191a7b80ce
commit a67fd9623d
3 changed files with 8 additions and 2 deletions

View File

@@ -122,6 +122,8 @@ struct FilePathFilterArgs {
path: Option<String>,
#[specta(optional)]
object: Option<ObjectFilterArgs>,
#[specta(optional)]
hidden: Option<bool>,
}
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),

View File

@@ -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 },

View File

@@ -173,7 +173,7 @@ export type FilePathCursor = { isDir: boolean; variant: FilePathCursorVariant }
export type FilePathCursorVariant = "none" | { name: CursorOrderItem<string> } | { sizeInBytes: SortOrder } | { dateCreated: CursorOrderItem<string> } | { dateModified: CursorOrderItem<string> } | { dateIndexed: CursorOrderItem<string> } | { object: FilePathObjectCursor }
export type FilePathFilterArgs = { locationId?: number | null; search?: string | null; extension?: string | null; createdAt?: OptionalRange<string>; path?: string | null; object?: ObjectFilterArgs | null }
export type FilePathFilterArgs = { locationId?: number | null; search?: string | null; extension?: string | null; createdAt?: OptionalRange<string>; path?: string | null; object?: ObjectFilterArgs | null; hidden?: boolean | null }
export type FilePathObjectCursor = { dateAccessed: CursorOrderItem<string> } | { kind: CursorOrderItem<number> }