Skip to content

Commit

Permalink
fix: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Sep 24, 2024
1 parent fbb78a0 commit 63d3b8d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions apps/renterd/contexts/filesDirectory/dataset.tsx
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -30,7 +30,7 @@ export function useDataset() {
? fileNamePrefixFilter.slice(1)
: fileNamePrefixFilter
}
const p: ObjectListParams = {
const p: ObjectsParams = {
prefix,
bucket: pathParams.bucket,
sortBy: sortField,
Expand All @@ -51,7 +51,7 @@ export function useDataset() {
limit,
])

const response = useObjectList({
const response = useObjects({
disabled: !activeBucketName,
params,
config: {
Expand Down
8 changes: 4 additions & 4 deletions apps/renterd/contexts/filesFlat/dataset.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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,
Expand All @@ -48,7 +48,7 @@ export function useDataset({ sortDirection, sortField }: Props) {
limit,
])

const response = useObjectList({
const response = useObjects({
disabled: !activeBucketName,
params,
config: {
Expand Down
4 changes: 2 additions & 2 deletions apps/renterd/contexts/filesManager/uploads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion libs/renterd-js/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions libs/renterd-react/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,7 @@ export function useBucketDelete(
)
}

export function useObjectList(
args: HookArgsSwr<ObjectsParams, ObjectsResponse>
) {
export function useObjects(args: HookArgsSwr<ObjectsParams, ObjectsResponse>) {
return useGetSwr({ ...args, route: busObjectsPrefixRoute })
}

Expand Down
1 change: 0 additions & 1 deletion libs/renterd-react/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
workerObjectsKeyRoute,
workerRhpScanRoute,
workerStateRoute,
busObjectsRoute,
Host,
} from '@siafoundation/renterd-types'

Expand Down
4 changes: 2 additions & 2 deletions libs/renterd-types/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,15 @@ export type BucketDeletePayload = void
export type BucketDeleteResponse = void

export type ObjectsParams = {
bucket: string
bucket?: string
prefix?: string
delimiter?: string
limit?: number
marker?: string
sortBy?: 'name' | 'health' | 'size'
sortDir?: 'asc' | 'desc'
substring?: string
slabEncryptionKey: string
slabEncryptionKey?: string
}
export type ObjectsPayload = void
export type ObjectsResponse = {
Expand Down

0 comments on commit 63d3b8d

Please sign in to comment.