From 62c6bc244f75e489d177377fbab3da953e650c12 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Fri, 9 Feb 2024 12:09:52 -0500 Subject: [PATCH] feat: renterd sort files by size --- .changeset/healthy-cars-cover.md | 5 +++++ .changeset/pretty-hats-count.md | 5 +++++ apps/renterd/contexts/files/types.ts | 7 ++++++- libs/react-renterd/src/bus.ts | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .changeset/healthy-cars-cover.md create mode 100644 .changeset/pretty-hats-count.md diff --git a/.changeset/healthy-cars-cover.md b/.changeset/healthy-cars-cover.md new file mode 100644 index 000000000..3295614fd --- /dev/null +++ b/.changeset/healthy-cars-cover.md @@ -0,0 +1,5 @@ +--- +'renterd': minor +--- + +Files can now be sorted by size. Closes https://github.com/SiaFoundation/renterd/issues/860 diff --git a/.changeset/pretty-hats-count.md b/.changeset/pretty-hats-count.md new file mode 100644 index 000000000..65ce998eb --- /dev/null +++ b/.changeset/pretty-hats-count.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/react-renterd': minor +--- + +useObjectDirectory now supports sortBy size. diff --git a/apps/renterd/contexts/files/types.ts b/apps/renterd/contexts/files/types.ts index 3c1543947..8383b9bce 100644 --- a/apps/renterd/contexts/files/types.ts +++ b/apps/renterd/contexts/files/types.ts @@ -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' @@ -49,4 +49,9 @@ export const sortOptions: { id: SortField; label: string; category: string }[] = label: 'health', category: 'general', }, + { + id: 'size', + label: 'size', + category: 'general', + }, ] diff --git a/libs/react-renterd/src/bus.ts b/libs/react-renterd/src/bus.ts index f167ab91f..4e614a4a9 100644 --- a/libs/react-renterd/src/bus.ts +++ b/libs/react-renterd/src/bus.ts @@ -551,7 +551,7 @@ export type ObjectDirectoryParams = { limit?: number prefix?: string offset?: number - sortBy?: 'name' | 'health' + sortBy?: 'name' | 'health' | 'size' sortDir?: 'asc' | 'desc' }