From ad3d8f434f4acbf40e7e1f9e58485e266296c7c4 Mon Sep 17 00:00:00 2001 From: kristoferlund Date: Wed, 2 Aug 2023 08:08:57 +0200 Subject: [PATCH 1/7] Don't stringify before copy --- .../frontend/src/pages/Reports/components/CopyToClipboard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/Reports/components/CopyToClipboard.tsx b/packages/frontend/src/pages/Reports/components/CopyToClipboard.tsx index f7fc05858..6e0ef6349 100644 --- a/packages/frontend/src/pages/Reports/components/CopyToClipboard.tsx +++ b/packages/frontend/src/pages/Reports/components/CopyToClipboard.tsx @@ -12,7 +12,7 @@ const CopyToClipboard: React.FC = ({ text }) => { const handleCopy = (): void => { const copy = async (): Promise => { try { - await navigator.clipboard.writeText(JSON.stringify(text)); + await navigator.clipboard.writeText(text); toast.success('Copied to clipboard'); } catch (err) { console.error('Failed to copy text: ', err); From 4fc6d412fec812c0e5068878a144f937d251f2f4 Mon Sep 17 00:00:00 2001 From: kristoferlund Date: Wed, 2 Aug 2023 08:15:56 +0200 Subject: [PATCH 2/7] Don't parse empty result set --- packages/frontend/src/pages/Reports/ReportsRunPage.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/pages/Reports/ReportsRunPage.tsx b/packages/frontend/src/pages/Reports/ReportsRunPage.tsx index f73a97c80..930e683fa 100644 --- a/packages/frontend/src/pages/Reports/ReportsRunPage.tsx +++ b/packages/frontend/src/pages/Reports/ReportsRunPage.tsx @@ -48,9 +48,13 @@ const ReportsRunPage = (): JSX.Element | null => { if (!response?.rows) return ; - const json = JSON.stringify(response.rows); - const parser = new Parser(); - const csv = parser.parse(response.rows); + let json = ''; + let csv = ''; + if (response.rows.length > 0) { + json = JSON.stringify(response.rows); + const parser = new Parser(); + csv = parser.parse(response.rows); + } return ( From eba17d0ef3fddfdb5881a982b44da6c8cd3eabfd Mon Sep 17 00:00:00 2001 From: kristoferlund Date: Wed, 2 Aug 2023 08:19:32 +0200 Subject: [PATCH 3/7] Report summary as
 instead of 

---
 .../frontend/src/pages/Reports/components/RevealMore.tsx | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/packages/frontend/src/pages/Reports/components/RevealMore.tsx b/packages/frontend/src/pages/Reports/components/RevealMore.tsx
index d7de2303a..1b3a48c8a 100644
--- a/packages/frontend/src/pages/Reports/components/RevealMore.tsx
+++ b/packages/frontend/src/pages/Reports/components/RevealMore.tsx
@@ -20,14 +20,7 @@ const RevealMore: React.FC = ({ content }) => {
       
- - {rows.map((row) => ( - <> - {row} -
- - ))} -
+
{rows.map((row) => `${row}\n`)}
{rows.length > 10 && (