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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2daab27  fix: can not manual input in upstream (#1124)
2daab27 is described below

commit 2daab27bab1334408e6fff93b7fe77418d664e31
Author: litesun <su...@apache.org>
AuthorDate: Fri Dec 25 23:40:35 2020 +0800

    fix: can not manual input in upstream (#1124)
    
    * fix: can not manual input
    
    * feat: update upstream
    
    Co-authored-by: 琚致远 <juzhiy...@apache.org>
---
 web/cypress/integration/route/create-and-delete-route.spec.js | 5 +----
 web/src/components/Upstream/UpstreamForm.tsx                  | 6 ++----
 web/src/components/Upstream/constant.ts                       | 1 +
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/web/cypress/integration/route/create-and-delete-route.spec.js 
b/web/cypress/integration/route/create-and-delete-route.spec.js
index 7b57428..c8bd6d9 100644
--- a/web/cypress/integration/route/create-and-delete-route.spec.js
+++ b/web/cypress/integration/route/create-and-delete-route.spec.js
@@ -56,10 +56,7 @@ context('Create and Delete Route', () => {
 
     // go to step2
     cy.contains('Next').click();
-    cy.wait(400);
-    cy.get('#nodes_0_host').type('12.12.12.12', {
-      timeout: 5000
-    });
+    cy.get('#nodes_0_host').type('12.12.12.12')
 
     // go to step3
     cy.contains('Next').click();
diff --git a/web/src/components/Upstream/UpstreamForm.tsx 
b/web/src/components/Upstream/UpstreamForm.tsx
index 7afc30e..fcbedaa 100644
--- a/web/src/components/Upstream/UpstreamForm.tsx
+++ b/web/src/components/Upstream/UpstreamForm.tsx
@@ -566,9 +566,9 @@ const UpstreamForm: React.FC<Props> = forwardRef(
       >
         {showSelector && (
           <Form.Item label="选择上游" name="upstream_id" shouldUpdate={(prev, 
next) => {
+            setReadonly(Boolean(next.upstream_id));
             if (prev.upstream_id !== next.upstream_id) {
               const id = next.upstream_id;
-              setReadonly(Boolean(id));
               if (id) {
                 form.setFieldsValue(list.find((item) => item.id === id));
                 form.setFieldsValue({
@@ -609,9 +609,7 @@ const UpstreamForm: React.FC<Props> = forwardRef(
             return null;
           }}
         </Form.Item>
-
-        <NodeList />
-
+        {NodeList()}
         <Form.Item
           label={formatMessage({ id: 'upstream.step.pass-host' })}
           name="pass_host"
diff --git a/web/src/components/Upstream/constant.ts 
b/web/src/components/Upstream/constant.ts
index 8f7c0bf..927f77f 100644
--- a/web/src/components/Upstream/constant.ts
+++ b/web/src/components/Upstream/constant.ts
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 export const DEFAULT_UPSTREAM = {
+  upstream_id: '',
   nodes: [{ host: '', port: 80, weight: 1 }],
   type: 'roundrobin',
   timeout: {

Reply via email to