From a26504e3ca50ccd032d7e1fd9a8d3cfe34bda929 Mon Sep 17 00:00:00 2001 From: "use-tusk[bot]" <144006087+use-tusk[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:25:06 +0000 Subject: [PATCH] feat(request-log): add view button to request log --- .../requestsV2/requestContentView.tsx | 27 +++++++++++++++++++ .../templates/requestsV2/requestDrawerV2.tsx | 19 +++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100755 web/components/templates/requestsV2/requestContentView.tsx diff --git a/web/components/templates/requestsV2/requestContentView.tsx b/web/components/templates/requestsV2/requestContentView.tsx new file mode 100755 index 0000000000..5a4b5d9b3b --- /dev/null +++ b/web/components/templates/requestsV2/requestContentView.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { NormalizedRequest } from './builder/abstractRequestBuilder'; + +interface RequestContentViewProps { + request: NormalizedRequest; +} + +const RequestContentView: React.FC = ({ request }) => { + return ( +
+
+

Request

+
+
{JSON.stringify(request.requestBody, null, 2)}
+
+
+
+

Response

+
+
{JSON.stringify(request.responseBody, null, 2)}
+
+
+
+ ); +}; + +export default RequestContentView; diff --git a/web/components/templates/requestsV2/requestDrawerV2.tsx b/web/components/templates/requestsV2/requestDrawerV2.tsx index 2c7e5f7357..2503be44e1 100644 --- a/web/components/templates/requestsV2/requestDrawerV2.tsx +++ b/web/components/templates/requestsV2/requestDrawerV2.tsx @@ -1,4 +1,4 @@ -import { BeakerIcon, ClipboardDocumentIcon } from "@heroicons/react/24/outline"; +import { BeakerIcon, ClipboardDocumentIcon, EyeIcon } from "@heroicons/react/24/outline"; import { Tooltip } from "@mui/material"; import { useRouter } from "next/router"; import useNotification from "../../shared/notification/useNotification"; @@ -7,6 +7,8 @@ import { NormalizedRequest } from "./builder/abstractRequestBuilder"; import { ArrowDownIcon, ArrowUpIcon } from "@heroicons/react/20/solid"; import { clsx } from "../../shared/clsx"; import RequestRow from "./requestRow"; +import RequestContentView from "./requestContentView"; +import { useState } from "react"; interface RequestDrawerV2Props { open: boolean; @@ -33,6 +35,7 @@ const RequestDrawerV2 = (props: RequestDrawerV2Props) => { const { setNotification } = useNotification(); const router = useRouter(); + const [isContentView, setIsContentView] = useState(false); const setOpenHandler = (drawerOpen: boolean) => { // if the drawerOpen boolean is true, open the drawer @@ -85,6 +88,14 @@ const RequestDrawerV2 = (props: RequestDrawerV2Props) => { + + + {(hasPrevious || hasNext) && (
@@ -118,7 +129,11 @@ const RequestDrawerV2 = (props: RequestDrawerV2Props) => { } > {request ? ( - + isContentView ? ( + + ) : ( + + ) ) : (

Loading...

)}