This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git


The following commit(s) were added to refs/heads/next by this push:
     new 2e560cf  feat: change refirect (#239)
2e560cf is described below

commit 2e560cfd47478cd87044b7f70b234c95756fbcba
Author: litesun <31329157+lite...@users.noreply.github.com>
AuthorDate: Thu Jun 4 13:33:56 2020 +0800

    feat: change refirect (#239)
    
    * feat: limit upload file
    
    * feat: intercept default upload api request
    
    * feat: limit upload file type
    
    * fix: show file when parse SSL file  fail
    
    * feat: add search feature
    
    * feat: format code
    
    * fix: remove list item not work
    
    * feat: remove relatedRouting
    
    * feat: add routes step1 page
    
    * feat: update route
    
    * feat: format code
    
    * feat: update
    
    * feat: update
    
    * feat: add checkbox rule
    
    * feat: handle Modal close event
    
    * feat: format code
    
    * feat: add page skip
    
    * feat: format code
    
    * merge
    
    * feat: clean code
    
    * fix: step4 error
    
    * feat: add edit modal
    
    * feat: add form validation
    
    * fix: step4 lose data
    
    * fix: step4 edit
    
    * add: WebSocket switch
    
    * feat: https methods list Validation
    
    * fix: timeout
    
    * clean code
    
    * add: redirect
    
    * fix: force https
    
    * add: redirect
    
    * fix: wrong redirectURI  typing
    
    * Update RequestConfigView.tsx
    
    * Update RequestConfigView.tsx
    
    * feat: change refirect
    
    Co-authored-by: 琚致远 <juzhiy...@apache.org>
---
 .../Routes/components/Step1/RequestConfigView.tsx  | 48 +++++++++-------------
 src/pages/Routes/constants.ts                      |  2 +-
 src/pages/Routes/typing.d.ts                       |  1 -
 3 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/src/pages/Routes/components/Step1/RequestConfigView.tsx 
b/src/pages/Routes/components/Step1/RequestConfigView.tsx
index 07135f1..7c74f4a 100644
--- a/src/pages/Routes/components/Step1/RequestConfigView.tsx
+++ b/src/pages/Routes/components/Step1/RequestConfigView.tsx
@@ -138,37 +138,27 @@ const RequestConfigView: React.FC<Props> = ({ data, 
disabled, onChange }) => {
       >
         <Checkbox.Group options={HTTP_METHOD_OPTION_LIST} disabled={disabled} 
/>
       </Form.Item>
-      <Form.Item label="redirect" name="redirect" valuePropName="checked">
+      <Form.Item label="强制 HTTPS" valuePropName="checked" name="forceHttps">
         <Switch disabled={disabled} />
       </Form.Item>
-      {step1Data.redirect && (
-        <>
-          <Form.Item label="强制 HTTPS" valuePropName="checked" 
name="forceHttps">
-            <Switch disabled={disabled || 
step1Data.protocols.includes('https')} />
-          </Form.Item>
-          {!step1Data.forceHttps && (
-            <Form.Item label="自定义参数" required>
-              <Row gutter={10}>
-                <Col>
-                  <Form.Item name="redirectURI" rules={[{ required: true, 
message: '请输入 URI' }]}>
-                    <Input placeholder="请输入 URI" disabled={disabled} />
-                  </Form.Item>
-                </Col>
-                <Col span={6}>
-                  <Form.Item
-                    name="redirectCode"
-                    rules={[{ required: true, message: '请选择状态码' }]}
-                  >
-                    <Select disabled={disabled}>
-                      <Select.Option value="301">301</Select.Option>
-                      <Select.Option value="302">302</Select.Option>
-                    </Select>
-                  </Form.Item>
-                </Col>
-              </Row>
-            </Form.Item>
-          )}
-        </>
+      {!step1Data.forceHttps && (
+        <Form.Item label="自定义重定向">
+          <Row gutter={10}>
+            <Col>
+              <Form.Item name="redirectURI">
+                <Input placeholder="请输入 URI" disabled={disabled} />
+              </Form.Item>
+            </Col>
+            <Col span={6}>
+              <Form.Item name="redirectCode">
+                <Select disabled={disabled}>
+                  <Select.Option value="301">301</Select.Option>
+                  <Select.Option value="302">302</Select.Option>
+                </Select>
+              </Form.Item>
+            </Col>
+          </Row>
+        </Form.Item>
       )}
     </PanelSection>
   );
diff --git a/src/pages/Routes/constants.ts b/src/pages/Routes/constants.ts
index b943542..f784d1b 100644
--- a/src/pages/Routes/constants.ts
+++ b/src/pages/Routes/constants.ts
@@ -31,8 +31,8 @@ export const DEFAULT_STEP_1_DATA: RouteModule.Step1Data = {
   websocket: false,
   hosts: [''],
   paths: [],
-  redirect: false,
   forceHttps: false,
+  redirectCode: 301,
   methods: HTTP_METHOD_OPTION_LIST,
   advancedMatchingRules: [],
 };
diff --git a/src/pages/Routes/typing.d.ts b/src/pages/Routes/typing.d.ts
index 5f513ba..acc91f7 100644
--- a/src/pages/Routes/typing.d.ts
+++ b/src/pages/Routes/typing.d.ts
@@ -22,7 +22,6 @@ declare namespace RouteModule {
     hosts: string[];
     paths: string[];
     methods: HttpMethod[];
-    redirect: boolean;
     forceHttps: boolean;
     redirectURI?: string;
     redirectCode?: number;

Reply via email to