Skip to content

Commit 85fadb6

Browse files
authored
fix: disable global plugin invalid (apache#2757)
1 parent df0452e commit 85fadb6

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

web/cypress/e2e/plugin/create-delete-in-drawer-plugin.cy.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,53 @@ context('Delete Plugin List with the Drawer', () => {
225225
cy.get(selector.empty).should('be.visible');
226226
});
227227

228+
it('should disabled global plugin normally', () => {
229+
cy.visit('/plugin/list');
230+
cy.get(selector.refresh).click();
231+
cy.contains('button', 'Enable').click();
232+
cy.contains(data.basicAuthPlugin)
233+
.parents(selector.pluginCardBordered)
234+
.within(() => {
235+
cy.get('button').click({
236+
force: true,
237+
});
238+
});
239+
cy.get(selector.drawer)
240+
.should('be.visible')
241+
.within(() => {
242+
cy.get('#disable').should('have.attr', 'aria-checked', 'false');
243+
cy.get(selector.disabledSwitcher).click();
244+
cy.get(selector.checkedSwitcher).should('exist');
245+
});
246+
cy.contains('button', 'Submit').click({ force: true });
247+
cy.wait(timeout);
248+
cy.visit('/plugin/list');
249+
cy.contains(data.basicAuthPlugin).siblings().contains('Configure').click();
250+
cy.get(selector.drawer)
251+
.should('be.visible')
252+
.within(() => {
253+
cy.get('#disable').should('have.attr', 'aria-checked', 'true');
254+
cy.get(selector.disabledSwitcher).click();
255+
});
256+
cy.contains('button', 'Submit').click({ force: true });
257+
cy.get(selector.drawer).should('not.exist');
258+
cy.contains(data.basicAuthPlugin).should('be.visible');
259+
cy.contains(data.basicAuthPlugin).siblings().contains('Configure').click();
260+
cy.get(selector.drawer)
261+
.should('be.visible')
262+
.within(() => {
263+
cy.get('#disable').should('have.attr', 'aria-checked', 'false');
264+
});
265+
266+
cy.contains('button', 'Cancel').click({
267+
force: true,
268+
});
269+
cy.contains(data.basicAuthPlugin).siblings().contains('Delete').click();
270+
cy.contains('button', 'Confirm').click({
271+
force: true,
272+
});
273+
});
274+
228275
it('should be deleted one of the plugins instead of all', function () {
229276
cy.visit('/plugin/list');
230277
cy.get(selector.refresh).click();

web/src/pages/Plugin/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const Page: React.FC = () => {
124124
const disable = !formData.disable;
125125
let plugins = {
126126
...initialData,
127-
[name]: { ...monacoData, disable },
127+
[name]: { ...monacoData, _meta: { disable } },
128128
};
129129
if (shouldDelete === true) {
130130
plugins = omit(plugins, name);

0 commit comments

Comments
 (0)