From d127f07d1bb312da8cee890acfaa6f3c254215b7 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Thu, 19 Dec 2024 09:17:54 -0500 Subject: [PATCH] fix(renterd): files copy metadata --- .changeset/silver-pants-deliver.md | 5 +++++ .changeset/thick-geckos-laugh.md | 5 +++++ .../Columns/FilesHealthColumn/FilesHealthColumnContents.tsx | 4 ++-- .../Files/FileContextMenu/CopyMetadataMenuItem.tsx | 5 +---- libs/renterd-types/src/bus.ts | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 .changeset/silver-pants-deliver.md create mode 100644 .changeset/thick-geckos-laugh.md diff --git a/.changeset/silver-pants-deliver.md b/.changeset/silver-pants-deliver.md new file mode 100644 index 000000000..710d20478 --- /dev/null +++ b/.changeset/silver-pants-deliver.md @@ -0,0 +1,5 @@ +--- +'renterd': patch +--- + +Fixed an issue with the copy file metadata action in the file context menu. diff --git a/.changeset/thick-geckos-laugh.md b/.changeset/thick-geckos-laugh.md new file mode 100644 index 000000000..e6f1e15fb --- /dev/null +++ b/.changeset/thick-geckos-laugh.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/renterd-types': minor +--- + +The object response has been updated in v2. diff --git a/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx b/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx index 1f91f3e99..539aeffd8 100644 --- a/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx +++ b/apps/renterd/components/Files/Columns/FilesHealthColumn/FilesHealthColumnContents.tsx @@ -47,7 +47,7 @@ export function FilesHealthColumnContents({ ) } - if (!obj.data?.object) { + if (!obj.data) { return ( Error fetching slab metadata. @@ -56,7 +56,7 @@ export function FilesHealthColumnContents({ } const slabs = sortBy( - obj.data.object.slabs?.map((s) => ({ + obj.data.slabs?.map((s) => ({ ...s.slab, // id is for use as a unique React key. // slab key is not necessarily unique. e.g. an object uploaded with tiny diff --git a/apps/renterd/components/Files/FileContextMenu/CopyMetadataMenuItem.tsx b/apps/renterd/components/Files/FileContextMenu/CopyMetadataMenuItem.tsx index f51564f97..ec4d33c2b 100644 --- a/apps/renterd/components/Files/FileContextMenu/CopyMetadataMenuItem.tsx +++ b/apps/renterd/components/Files/FileContextMenu/CopyMetadataMenuItem.tsx @@ -28,10 +28,7 @@ export function CopyMetadataMenuItem({ path }: Props) { disabled={!obj.data} onSelect={() => { if (obj.data) { - copyToClipboard( - JSON.stringify(obj.data.object, null, 2), - 'object metadata' - ) + copyToClipboard(JSON.stringify(obj.data, null, 2), 'object metadata') } }} > diff --git a/libs/renterd-types/src/bus.ts b/libs/renterd-types/src/bus.ts index 9614b7578..74d9eb644 100644 --- a/libs/renterd-types/src/bus.ts +++ b/libs/renterd-types/src/bus.ts @@ -417,7 +417,7 @@ export type ObjectsResponse = { export type ObjectParams = { key: string; bucket: string } export type ObjectPayload = void -export type ObjectResponse = { object: Obj } +export type ObjectResponse = Obj export type ObjectAddParams = { key: string; bucket: string } export type ObjectAddPayload = {