mirror of
https://github.com/Noooste/garage-ui.git
synced 2026-08-31 09:18:29 +00:00
feat(backend,frontend): implement prefix and recursive substring search for bucket objects (#89)
* feat(search): implement recursive substring search for bucket objects * fix: update key formatting to remove trailing slashes in ObjectsTable * feat(search): implement debounced search functionality and improve UI text clarity * test(objects): add test for handling search error response
This commit is contained in:
@@ -10,6 +10,7 @@ export function BucketObjects() {
|
||||
|
||||
const [currentPath, setCurrentPath] = useState(searchParams.get('prefix') ?? '');
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [deepSearch, setDeepSearch] = useState(false);
|
||||
const [initialPageToken, setInitialPageToken] = useState<string | undefined>(
|
||||
searchParams.get('page') ?? undefined,
|
||||
);
|
||||
@@ -27,6 +28,7 @@ export function BucketObjects() {
|
||||
|
||||
const {
|
||||
objects,
|
||||
debouncedSearch,
|
||||
isLoading,
|
||||
isRefreshing,
|
||||
isNavigating,
|
||||
@@ -40,10 +42,13 @@ export function BucketObjects() {
|
||||
deleteMultipleObjects,
|
||||
createDirectory,
|
||||
fetchObjects,
|
||||
} = useBucketObjects(bucketName, currentPath);
|
||||
} = useBucketObjects(bucketName, currentPath, searchQuery, deepSearch);
|
||||
|
||||
const handleNavigateToFolder = (path: string) => {
|
||||
setCurrentPath(path);
|
||||
// Navigating to a folder should show that folder's contents, not a stale
|
||||
// filter carried over from the folder we came from.
|
||||
setSearchQuery('');
|
||||
const next = new URLSearchParams();
|
||||
if (path) next.set('prefix', path);
|
||||
setSearchParams(next);
|
||||
@@ -97,11 +102,14 @@ export function BucketObjects() {
|
||||
objects={objects}
|
||||
currentPath={currentPath}
|
||||
searchQuery={searchQuery}
|
||||
filterQuery={debouncedSearch}
|
||||
deepSearch={deepSearch}
|
||||
isLoading={isLoading}
|
||||
isTruncated={isTruncated}
|
||||
nextContinuationToken={nextContinuationToken}
|
||||
itemsPerPage={itemsPerPage}
|
||||
onSearchChange={setSearchQuery}
|
||||
onDeepSearchChange={setDeepSearch}
|
||||
onNavigateToFolder={handleNavigateToFolder}
|
||||
onBackToBuckets={handleBackToBuckets}
|
||||
onUploadFiles={uploadFiles}
|
||||
|
||||
Reference in New Issue
Block a user