From 12e8490350bb26d566ae5e8f7b7af9d82db7ce7d Mon Sep 17 00:00:00 2001 From: JustinKol <144163838+JustinKol@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:01:05 -0400 Subject: [PATCH] Copy json results button (#1631) * copy json button * fixed formating issue * moved icon to float right * fixed formatting --- .../Tabs/QueryTab/QueryResultSection.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx b/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx index 19d05d397..3240851d5 100644 --- a/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx +++ b/src/Explorer/Tabs/QueryTab/QueryResultSection.tsx @@ -9,6 +9,7 @@ import { SelectionMode, Stack, Text, + IconButton, TooltipHost, } from "@fluentui/react"; import { HttpHeaders, NormalizedEventKey } from "Common/Constants"; @@ -24,6 +25,8 @@ import QueryEditorNext from "../../../../images/Query-Editor-Next.svg"; import RunQuery from "../../../../images/RunQuery.png"; import InfoColor from "../../../../images/info_color.svg"; import { QueryResults } from "../../../Contracts/ViewModels"; +import copy from "clipboard-copy"; +import CopilotCopy from "../../../../images/CopilotCopy.svg"; interface QueryResultProps { isMongoDB: boolean; @@ -352,6 +355,10 @@ export const QueryResultSection: React.FC = ({ return items; }; + const onClickCopyResults = (): void => { + copy(queryResultsString); + }; + return ( {isMongoDB && queryEditorContent.length === 0 && ( @@ -429,6 +436,17 @@ export const QueryResultSection: React.FC = ({ )} + {queryResults && queryResultsString?.length > 0 && !error && (