From 0ba9281421013a1cf887d9e3cc3ee0ec43343285 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Mon, 21 Aug 2023 12:40:22 -0400 Subject: [PATCH] feat: renterd health partial slab --- .changeset/cyan-dots-cover.md | 5 ++ .changeset/wise-phones-bathe.md | 5 ++ .../FilesHealthColumnContents.tsx | 61 ++++++++++++++----- libs/react-renterd/src/siaTypes.ts | 5 ++ 4 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 .changeset/cyan-dots-cover.md create mode 100644 .changeset/wise-phones-bathe.md diff --git a/.changeset/cyan-dots-cover.md b/.changeset/cyan-dots-cover.md new file mode 100644 index 000000000..84fe4a0b4 --- /dev/null +++ b/.changeset/cyan-dots-cover.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/react-renterd': minor +--- + +useObject now includes partialSlab. diff --git a/.changeset/wise-phones-bathe.md b/.changeset/wise-phones-bathe.md new file mode 100644 index 000000000..d396231bc --- /dev/null +++ b/.changeset/wise-phones-bathe.md @@ -0,0 +1,5 @@ +--- +'renterd': minor +--- + +File health tooltip now includes redundancy info and supports partial slabs. diff --git a/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx b/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx index d9610ef6e..48bc84a46 100644 --- a/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx +++ b/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx @@ -66,27 +66,44 @@ export function FilesHealthColumnContents({ 'contractSetShards' ) + const { partialSlab } = obj.data.object + return ( 15 ? 'h-[300px]' : ''} displayHealth={displayHealth} label={label} + minShards={partialSlab ? partialSlab.minShards : slabs[0]?.minShards} + totalShards={ + partialSlab ? partialSlab.totalShards : slabs[0]?.shards.length + } > - {slabs.map((slab) => ( -
- - Slab {slab.key.replace('key:', '').slice(0, 4)}: - - - {slab.contractSetShards}/{slab.shards.length} - -
- ))} + {partialSlab ? ( + + partial slab + + ) : ( + slabs.map((slab) => ( +
+ + Slab {slab.key.replace('key:', '').slice(0, 4)}: + + + {slab.contractSetShards}/{slab.shards.length} + +
+ )) + )}
) } @@ -96,11 +113,15 @@ function Layout({ displayHealth, label, children, + minShards, + totalShards, }: { className?: string children: React.ReactNode displayHealth: number label: string + minShards?: number + totalShards?: number }) { return (
{label} {(displayHealth * 100).toFixed(0)}%
+ {minShards && totalShards ? ( +
+ + redundancy + + + {minShards} of {totalShards} + +
+ ) : null}
diff --git a/libs/react-renterd/src/siaTypes.ts b/libs/react-renterd/src/siaTypes.ts index 12118b972..bf6aa69cc 100644 --- a/libs/react-renterd/src/siaTypes.ts +++ b/libs/react-renterd/src/siaTypes.ts @@ -147,6 +147,11 @@ export interface Obj { health: number key: EncryptionKey slabs?: SlabSlice[] + partialSlab?: { + minShards: number + totalShards: number + data?: string + } } export interface AddObjectRequest {