You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ma...@apache.org on 2021/09/02 10:41:02 UTC

[apisix-dashboard] branch master updated: fix websocket (#2115)

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

majunjie 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 a5e07a2  fix websocket (#2115)
a5e07a2 is described below

commit a5e07a2321a9b8a87c617c962d8ddf0bd9d315ee
Author: litesun <su...@apache.org>
AuthorDate: Thu Sep 2 18:40:53 2021 +0800

    fix websocket (#2115)
---
 .../create-edit-route-with-redirect-plugin.spec.js |  8 ++++----
 web/src/pages/Route/components/Step1/MetaView.tsx  | 23 +++++++++++-----------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/web/cypress/integration/route/create-edit-route-with-redirect-plugin.spec.js b/web/cypress/integration/route/create-edit-route-with-redirect-plugin.spec.js
index bcfbb42..67c2710 100644
--- a/web/cypress/integration/route/create-edit-route-with-redirect-plugin.spec.js
+++ b/web/cypress/integration/route/create-edit-route-with-redirect-plugin.spec.js
@@ -61,8 +61,8 @@ context('Create Edit and Delete Route with redirect plugin', () => {
     cy.get(selector.customRedirectLabel).should('be.visible');
     cy.get(selector.customRedirectUrI).should('be.visible');
     cy.get(selector.customRedirectCode).should('be.visible');
-    cy.get(selector.webSocketSelector).should('not.exist');
-    cy.get(selector.enable_websocket_button).should('not.exist');
+    cy.get(selector.webSocketSelector).should('exist');
+    cy.get(selector.enable_websocket_button).should('exist');
 
     // step 2 and step 3 should not be visible
     cy.contains(data.step2Title).should('not.exist');
@@ -91,8 +91,8 @@ context('Create Edit and Delete Route with redirect plugin', () => {
     // should not shown set upstream notice
     cy.contains(data.setUpstreamNotice).should('not.exist');
     cy.get(selector.name).clear().type(newName);
-    cy.get(selector.webSocketSelector).should('not.exist');
-    cy.get(selector.enable_websocket_button).should('not.exist');
+    cy.get(selector.webSocketSelector).should('exist');
+    cy.get(selector.enable_websocket_button).should('exist');
 
     cy.contains('Next').click();
     cy.contains('Submit').click();
diff --git a/web/src/pages/Route/components/Step1/MetaView.tsx b/web/src/pages/Route/components/Step1/MetaView.tsx
index 43cf7e3..df786c5 100644
--- a/web/src/pages/Route/components/Step1/MetaView.tsx
+++ b/web/src/pages/Route/components/Step1/MetaView.tsx
@@ -185,18 +185,17 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({
     </Form.Item>
   );
 
-  const WebSocket: React.FC = () =>
-    form.getFieldValue('redirectOption') === 'disabled' ? (
-      <Form.Item label="WebSocket">
-        <Row>
-          <Col>
-            <Form.Item noStyle valuePropName="checked" name="enable_websocket">
-              <Switch disabled={disabled} />
-            </Form.Item>
-          </Col>
-        </Row>
-      </Form.Item>
-    ) : null;
+  const WebSocket: React.FC = () => (
+    <Form.Item label="WebSocket">
+      <Row>
+        <Col>
+          <Form.Item noStyle valuePropName="checked" name="enable_websocket">
+            <Switch disabled={disabled} />
+          </Form.Item>
+        </Col>
+      </Row>
+    </Form.Item>
+  );
 
   const Redirect: React.FC = () => {
     const list = [