Skip to content

Commit

Permalink
feat: renterd sort files by size
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Feb 9, 2024
1 parent 3b6bb1d commit 62c6bc2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-cars-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Files can now be sorted by size. Closes https://github.com/SiaFoundation/renterd/issues/860
5 changes: 5 additions & 0 deletions .changeset/pretty-hats-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/react-renterd': minor
---

useObjectDirectory now supports sortBy size.
7 changes: 6 additions & 1 deletion apps/renterd/contexts/files/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const columnsDefaultVisible: TableColumnId[] = [
'health',
]

export type SortField = 'name' | 'health'
export type SortField = 'name' | 'health' | 'size'

export const defaultSortField: SortField = 'name'

Expand All @@ -49,4 +49,9 @@ export const sortOptions: { id: SortField; label: string; category: string }[] =
label: 'health',
category: 'general',
},
{
id: 'size',
label: 'size',
category: 'general',
},
]
2 changes: 1 addition & 1 deletion libs/react-renterd/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ export type ObjectDirectoryParams = {
limit?: number
prefix?: string
offset?: number
sortBy?: 'name' | 'health'
sortBy?: 'name' | 'health' | 'size'
sortDir?: 'asc' | 'desc'
}

Expand Down

0 comments on commit 62c6bc2

Please sign in to comment.