You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ba...@apache.org on 2023/03/15 03:41:20 UTC

[apisix-dashboard] branch master updated: fix: disable global plugin invalid (#2757)

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

baoyuan 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 85fadb6ac fix: disable global plugin invalid (#2757)
85fadb6ac is described below

commit 85fadb6ac29c6cc7fc292af8d6e9f2ef581642be
Author: Baoyuan <ba...@gmail.com>
AuthorDate: Wed Mar 15 11:41:14 2023 +0800

    fix: disable global plugin invalid (#2757)
---
 .../plugin/create-delete-in-drawer-plugin.cy.js    | 47 ++++++++++++++++++++++
 web/src/pages/Plugin/List.tsx                      |  2 +-
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/web/cypress/e2e/plugin/create-delete-in-drawer-plugin.cy.js b/web/cypress/e2e/plugin/create-delete-in-drawer-plugin.cy.js
index f66560098..8053503c2 100644
--- a/web/cypress/e2e/plugin/create-delete-in-drawer-plugin.cy.js
+++ b/web/cypress/e2e/plugin/create-delete-in-drawer-plugin.cy.js
@@ -225,6 +225,53 @@ context('Delete Plugin List with the Drawer', () => {
     cy.get(selector.empty).should('be.visible');
   });
 
+  it('should disabled global plugin normally', () => {
+    cy.visit('/plugin/list');
+    cy.get(selector.refresh).click();
+    cy.contains('button', 'Enable').click();
+    cy.contains(data.basicAuthPlugin)
+      .parents(selector.pluginCardBordered)
+      .within(() => {
+        cy.get('button').click({
+          force: true,
+        });
+      });
+    cy.get(selector.drawer)
+      .should('be.visible')
+      .within(() => {
+        cy.get('#disable').should('have.attr', 'aria-checked', 'false');
+        cy.get(selector.disabledSwitcher).click();
+        cy.get(selector.checkedSwitcher).should('exist');
+      });
+    cy.contains('button', 'Submit').click({ force: true });
+    cy.wait(timeout);
+    cy.visit('/plugin/list');
+    cy.contains(data.basicAuthPlugin).siblings().contains('Configure').click();
+    cy.get(selector.drawer)
+      .should('be.visible')
+      .within(() => {
+        cy.get('#disable').should('have.attr', 'aria-checked', 'true');
+        cy.get(selector.disabledSwitcher).click();
+      });
+    cy.contains('button', 'Submit').click({ force: true });
+    cy.get(selector.drawer).should('not.exist');
+    cy.contains(data.basicAuthPlugin).should('be.visible');
+    cy.contains(data.basicAuthPlugin).siblings().contains('Configure').click();
+    cy.get(selector.drawer)
+      .should('be.visible')
+      .within(() => {
+        cy.get('#disable').should('have.attr', 'aria-checked', 'false');
+      });
+
+    cy.contains('button', 'Cancel').click({
+      force: true,
+    });
+    cy.contains(data.basicAuthPlugin).siblings().contains('Delete').click();
+    cy.contains('button', 'Confirm').click({
+      force: true,
+    });
+  });
+
   it('should be deleted one of the plugins instead of all', function () {
     cy.visit('/plugin/list');
     cy.get(selector.refresh).click();
diff --git a/web/src/pages/Plugin/List.tsx b/web/src/pages/Plugin/List.tsx
index f0434e455..7071d30c0 100644
--- a/web/src/pages/Plugin/List.tsx
+++ b/web/src/pages/Plugin/List.tsx
@@ -124,7 +124,7 @@ const Page: React.FC = () => {
         const disable = !formData.disable;
         let plugins = {
           ...initialData,
-          [name]: { ...monacoData, disable },
+          [name]: { ...monacoData, _meta: { disable } },
         };
         if (shouldDelete === true) {
           plugins = omit(plugins, name);