liuxiran commented on a change in pull request #1201:
URL: https://github.com/apache/apisix-dashboard/pull/1201#discussion_r552333954



##########
File path: web/src/pages/Route/components/DebugViews/DebugDrawView.tsx
##########
@@ -48,32 +50,55 @@ const DebugDrawView: React.FC<RouteModule.DebugDrawProps> = 
(props) => {
   const [responseCode, setResponseCode] = useState<string>();
   const [loading, setLoading] = useState(false);
   const [codeMirrorHeight, setCodeMirrorHeight] = useState<number | 
string>(50);
+  const bodyCodeMirrorRef = useRef<any>(null);
+  const [bodyType, setBodyType] = useState('none');
   const methodWithoutBody = ['GET', 'HEAD'];
+  const [bodyCodeMirrorMode, setBodyCodeMirrorMode] = 
useState(DEBUG_BODY_CODEMIRROR_MODE_SUPPORTED[0].mode)
 
   const resetForms = () => {
     queryForm.setFieldsValue(DEFAULT_DEBUG_PARAM_FORM_DATA);
     bodyForm.setFieldsValue(DEFAULT_DEBUG_PARAM_FORM_DATA);
     headerForm.setFieldsValue(DEFAULT_DEBUG_PARAM_FORM_DATA);
     authForm.setFieldsValue(DEFAULT_DEBUG_AUTH_FORM_DATA);
     setResponseCode(`${formatMessage({ id: 
'page.route.debug.showResultAfterSendRequest' })}`);
+    setBodyType('none');

Review comment:
       good catch~`enum` improved readability of the code :+1: 
   
   fixed, thanks
   

##########
File path: web/src/pages/Route/components/DebugViews/DebugDrawView.tsx
##########
@@ -233,7 +258,54 @@ const DebugDrawView: React.FC<RouteModule.DebugDrawProps> 
= (props) => {
             </TabPane>
             {showBodyTab && (
               <TabPane tab={formatMessage({ id: 
'page.route.TabPane.bodyParams' })} key="body">
-                <DebugParamsView form={bodyForm} />
+                <Radio.Group onChange={(e) => {setBodyType(e.target.value)}} 
value={bodyType}>
+                  <Radio value="none">None</Radio>
+                  {
+                    DEBUG_BODY_TYPE_SUPPORTED.map((type) => (
+                      <Radio value={type} key={type}>{type}</Radio>
+                    ))
+                  }
+                </Radio.Group>
+                {bodyType === 'raw input' && <Select

Review comment:
       fixed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to