fix: disable global plugin invalid (#2757)
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 f665600..8053503 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 @@
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 f0434e4..7071d30 100644
--- a/web/src/pages/Plugin/List.tsx
+++ b/web/src/pages/Plugin/List.tsx
@@ -124,7 +124,7 @@
const disable = !formData.disable;
let plugins = {
...initialData,
- [name]: { ...monacoData, disable },
+ [name]: { ...monacoData, _meta: { disable } },
};
if (shouldDelete === true) {
plugins = omit(plugins, name);