diff --git a/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx b/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx index e68dd67a4..3b4153d9b 100644 --- a/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx +++ b/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx @@ -1,6 +1,6 @@ import { CommandGroup, CommandItemSearch } from '../../../CmdRoot/Item' import { Page } from '../../../CmdRoot/types' -import { useObjectList } from '@siafoundation/renterd-react' +import { useObjects } from '@siafoundation/renterd-react' import { isDirectory } from '../../../../lib/paths' import { Text } from '@siafoundation/design-system' import { Document16, FolderIcon } from '@siafoundation/react-icons' @@ -31,7 +31,7 @@ export function FilesSearchCmd({ useFilesManager() const onSearchPage = currentPage?.namespace === filesSearchPage.namespace const searchBucket = activeBucket || 'default' - const results = useObjectList({ + const results = useObjects({ disabled: !onSearchPage, params: { bucket: searchBucket, diff --git a/apps/renterd/contexts/filesDirectory/dataset.tsx b/apps/renterd/contexts/filesDirectory/dataset.tsx index 928761f04..9fdf32e7d 100644 --- a/apps/renterd/contexts/filesDirectory/dataset.tsx +++ b/apps/renterd/contexts/filesDirectory/dataset.tsx @@ -1,11 +1,11 @@ -import { useObjectList } from '@siafoundation/renterd-react' +import { useObjects } from '@siafoundation/renterd-react' import { useDataset as useDatasetGeneric } from '../filesManager/dataset' import { bucketAndKeyParamsFromPath } from '../../lib/paths' import { useRouter } from 'next/router' import { useMemo } from 'react' import { useFilesManager } from '../filesManager' import { defaultDatasetRefreshInterval } from '../../config/swr' -import { ObjectListParams } from '@siafoundation/renterd-types' +import { ObjectsParams } from '@siafoundation/renterd-types' const defaultLimit = 50 @@ -30,7 +30,7 @@ export function useDataset() { ? fileNamePrefixFilter.slice(1) : fileNamePrefixFilter } - const p: ObjectListParams = { + const p: ObjectsParams = { prefix, bucket: pathParams.bucket, sortBy: sortField, @@ -51,7 +51,7 @@ export function useDataset() { limit, ]) - const response = useObjectList({ + const response = useObjects({ disabled: !activeBucketName, params, config: { diff --git a/apps/renterd/contexts/filesFlat/dataset.tsx b/apps/renterd/contexts/filesFlat/dataset.tsx index 212eb8d72..60e86adfb 100644 --- a/apps/renterd/contexts/filesFlat/dataset.tsx +++ b/apps/renterd/contexts/filesFlat/dataset.tsx @@ -1,11 +1,11 @@ -import { useObjectList } from '@siafoundation/renterd-react' +import { useObjects } from '@siafoundation/renterd-react' import { SortField } from '../filesManager/types' import { useDataset as useDatasetGeneric } from '../filesManager/dataset' import { useRouter } from 'next/router' import { useMemo } from 'react' import { useFilesManager } from '../filesManager' import { defaultDatasetRefreshInterval } from '../../config/swr' -import { ObjectListParams } from '@siafoundation/renterd-types' +import { ObjectsParams } from '@siafoundation/renterd-types' type Props = { sortDirection: 'asc' | 'desc' @@ -27,7 +27,7 @@ export function useDataset({ sortDirection, sortField }: Props) { ? fileNamePrefixFilter.slice(1) : fileNamePrefixFilter } - const p: ObjectListParams = { + const p: ObjectsParams = { prefix, bucket: activeBucketName, sortBy: sortField, @@ -48,7 +48,7 @@ export function useDataset({ sortDirection, sortField }: Props) { limit, ]) - const response = useObjectList({ + const response = useObjects({ disabled: !activeBucketName, params, config: { diff --git a/apps/renterd/contexts/filesManager/uploads.tsx b/apps/renterd/contexts/filesManager/uploads.tsx index 4fbc8643c..33deb0215 100644 --- a/apps/renterd/contexts/filesManager/uploads.tsx +++ b/apps/renterd/contexts/filesManager/uploads.tsx @@ -8,7 +8,7 @@ import { useMultipartUploadPart, useSettingsUpload, } from '@siafoundation/renterd-react' -import { Bucket, busListObjectsRoute } from '@siafoundation/renterd-types' +import { Bucket, busObjectsRoute } from '@siafoundation/renterd-types' import { MiBToBytes, minutesInMilliseconds } from '@siafoundation/units' import { throttle } from '@technically/lodash' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' @@ -133,7 +133,7 @@ export function useUploads({ activeDirectoryPath }: Props) { }, 1000) ) multipartUpload.setOnComplete(async () => { - await ref.current.mutate((key) => key.startsWith(busListObjectsRoute)) + await ref.current.mutate((key) => key.startsWith(busObjectsRoute)) ref.current.removeUpload(uploadId) setTimeout(() => { ref.current.checkAndStartUploads() diff --git a/libs/renterd-js/src/bus.ts b/libs/renterd-js/src/bus.ts index 79c656f9e..d26ab6562 100644 --- a/libs/renterd-js/src/bus.ts +++ b/libs/renterd-js/src/bus.ts @@ -471,7 +471,7 @@ export function Bus({ api, password }: { api: string; password?: string }) { BucketDeletePayload, BucketDeleteResponse >(axios, 'delete', busBucketNameRoute), - objectList: buildRequestHandler< + objects: buildRequestHandler< ObjectsParams, ObjectsPayload, ObjectsResponse diff --git a/libs/renterd-react/src/bus.ts b/libs/renterd-react/src/bus.ts index 6ef8a11c8..52bb41290 100644 --- a/libs/renterd-react/src/bus.ts +++ b/libs/renterd-react/src/bus.ts @@ -702,9 +702,7 @@ export function useBucketDelete( ) } -export function useObjectList( - args: HookArgsSwr -) { +export function useObjects(args: HookArgsSwr) { return useGetSwr({ ...args, route: busObjectsPrefixRoute }) } diff --git a/libs/renterd-react/src/worker.ts b/libs/renterd-react/src/worker.ts index b23ed40c5..f9c26fc50 100644 --- a/libs/renterd-react/src/worker.ts +++ b/libs/renterd-react/src/worker.ts @@ -32,7 +32,6 @@ import { workerObjectsKeyRoute, workerRhpScanRoute, workerStateRoute, - busObjectsRoute, Host, } from '@siafoundation/renterd-types' diff --git a/libs/renterd-types/src/bus.ts b/libs/renterd-types/src/bus.ts index f059317b6..911449fe3 100644 --- a/libs/renterd-types/src/bus.ts +++ b/libs/renterd-types/src/bus.ts @@ -399,7 +399,7 @@ export type BucketDeletePayload = void export type BucketDeleteResponse = void export type ObjectsParams = { - bucket: string + bucket?: string prefix?: string delimiter?: string limit?: number @@ -407,7 +407,7 @@ export type ObjectsParams = { sortBy?: 'name' | 'health' | 'size' sortDir?: 'asc' | 'desc' substring?: string - slabEncryptionKey: string + slabEncryptionKey?: string } export type ObjectsPayload = void export type ObjectsResponse = {