From dfa63b43cbe3e75f7567c09b4be09317341a9027 Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Wed, 11 Oct 2023 20:13:49 +0530 Subject: [PATCH 1/3] showing url in editor --- .../components/shared/customDiffEditor.js | 2 +- .../pages/test_editor/TestEditor.css | 8 ++++++ .../test_editor/components/SampleApi.jsx | 28 ++++++++++++------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/customDiffEditor.js b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/customDiffEditor.js index 7ade628db8..037c4295ac 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/customDiffEditor.js +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/customDiffEditor.js @@ -77,7 +77,7 @@ const transform = { if(!isNaN(key)){ ret.push(parsedJson[key]) }else{ - ret.push({key: parsedJson[key]}) + ret.push({[key]: parsedJson[key]}) } }) return JSON.stringify(ret, null, 2) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css index 2acef9d4e2..fde152df85 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css @@ -58,4 +58,12 @@ .editor-header .Polaris-Text--root{ max-width: 30vw; +} + +.req-resp-tabs .Polaris-LegacyTabs__Title{ + padding: 0 !important; +} + +.req-resp-tabs .Polaris-Box{ + border: none !important; } \ No newline at end of file diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx index a14dbf993f..3b27255cf8 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx @@ -1,6 +1,5 @@ -import { Box, Button, Divider, Frame, HorizontalStack, LegacyTabs, Modal, VerticalStack} from "@shopify/polaris" -import { tokens } from "@shopify/polaris-tokens" -import { UpdateInventoryMajor, ChevronUpMinor } from "@shopify/polaris-icons" +import { Box, Button, Divider, Frame, HorizontalStack, LegacyTabs, Modal, Text, Tooltip} from "@shopify/polaris" +import {ChevronUpMinor } from "@shopify/polaris-icons" import { useEffect, useRef, useState } from "react"; @@ -122,12 +121,11 @@ const SampleApi = () => { const handleTabChange = (selectedTabIndex) => { setSelected(selectedTabIndex) - if (sampleData) { if (selectedTabIndex == 0) { - editorInstance.setValue(JSON.stringify(sampleData.requestJson["json"], null, 2)) + editorInstance.setValue(selectedApiEndpoint + '\n' + JSON.stringify(sampleData.requestJson["json"], null, 2)) } else { - editorInstance.setValue(JSON.stringify(sampleData.responseJson["json"], null, 2)) + editorInstance.setValue(selectedApiEndpoint + '\n' + JSON.stringify(sampleData.responseJson["json"], null, 2)) } } } @@ -167,7 +165,7 @@ const SampleApi = () => { setSampleData({ requestJson, responseJson }) if (editorInstance) { - editorInstance.setValue(JSON.stringify(requestJson["json"], null, 2)) + editorInstance.setValue(selectedApiEndpoint + '\n' + JSON.stringify(requestJson["json"], null, 2)) } setTimeout(()=> { setSampleDataList(sampleDataResponse.sampleDataList) @@ -254,9 +252,19 @@ const SampleApi = () => { return (
- - - +
+ +
+ + + +
From 3add0c7553bed8cf85675b349e1c3eece8be28ce Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Wed, 11 Oct 2023 23:11:02 +0530 Subject: [PATCH 2/3] improving first line --- .../dashboard/pages/test_editor/components/SampleApi.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx index 3b27255cf8..fa53d79827 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx @@ -122,10 +122,11 @@ const SampleApi = () => { const handleTabChange = (selectedTabIndex) => { setSelected(selectedTabIndex) if (sampleData) { + if (selectedTabIndex == 0) { - editorInstance.setValue(selectedApiEndpoint + '\n' + JSON.stringify(sampleData.requestJson["json"], null, 2)) + editorInstance.setValue(sampleData?.requestJson["firstLine"] + '\n\n' + JSON.stringify(sampleData.requestJson["json"], null, 2)) } else { - editorInstance.setValue(selectedApiEndpoint + '\n' + JSON.stringify(sampleData.responseJson["json"], null, 2)) + editorInstance.setValue(sampleData?.responseJson["firstLine"] + '\n\n' + JSON.stringify(sampleData.responseJson["json"], null, 2)) } } } @@ -165,7 +166,7 @@ const SampleApi = () => { setSampleData({ requestJson, responseJson }) if (editorInstance) { - editorInstance.setValue(selectedApiEndpoint + '\n' + JSON.stringify(requestJson["json"], null, 2)) + editorInstance.setValue(requestJson["firstLine"] + '\n\n' + JSON.stringify(requestJson["json"], null, 2)) } setTimeout(()=> { setSampleDataList(sampleDataResponse.sampleDataList) From 0c016d06edeaa51174ac31d1180b23dc66fcb2b5 Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Thu, 12 Oct 2023 11:18:34 +0530 Subject: [PATCH 3/3] fixed css --- .../web/src/apps/dashboard/pages/test_editor/TestEditor.css | 2 +- .../dashboard/pages/test_editor/components/SampleApi.jsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css index fde152df85..fadaf9e55b 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/TestEditor.css @@ -61,7 +61,7 @@ } .req-resp-tabs .Polaris-LegacyTabs__Title{ - padding: 0 !important; + padding: 8px 0 !important; } .req-resp-tabs .Polaris-Box{ diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx index fa53d79827..86c1c67e82 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx @@ -124,9 +124,9 @@ const SampleApi = () => { if (sampleData) { if (selectedTabIndex == 0) { - editorInstance.setValue(sampleData?.requestJson["firstLine"] + '\n\n' + JSON.stringify(sampleData.requestJson["json"], null, 2)) + editorInstance.setValue('\n' + sampleData?.requestJson["firstLine"] + '\n\n' + JSON.stringify(sampleData.requestJson["json"], null, 2)) } else { - editorInstance.setValue(sampleData?.responseJson["firstLine"] + '\n\n' + JSON.stringify(sampleData.responseJson["json"], null, 2)) + editorInstance.setValue('\n' + sampleData?.responseJson["firstLine"] + '\n\n' + JSON.stringify(sampleData.responseJson["json"], null, 2)) } } } @@ -166,7 +166,7 @@ const SampleApi = () => { setSampleData({ requestJson, responseJson }) if (editorInstance) { - editorInstance.setValue(requestJson["firstLine"] + '\n\n' + JSON.stringify(requestJson["json"], null, 2)) + editorInstance.setValue('\n' + requestJson["firstLine"] + '\n\n' + JSON.stringify(requestJson["json"], null, 2)) } setTimeout(()=> { setSampleDataList(sampleDataResponse.sampleDataList)