This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a commit to branch feat/release-2.15 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
commit 0ba733b9813189783b305cbf6660cce9dc798278 Author: Baoyuan <baoyuan....@gmail.com> AuthorDate: Fri Jan 20 16:16:31 2023 +0800 fix: plugin configuration lost in editor (#2718) --- web/cypress/e2e/plugin/plugin-schema.cy.js | 30 ++++++++++++++++++++++++++++++ web/src/components/Plugin/PluginDetail.tsx | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/web/cypress/e2e/plugin/plugin-schema.cy.js b/web/cypress/e2e/plugin/plugin-schema.cy.js index 161941384..41bebe3c2 100644 --- a/web/cypress/e2e/plugin/plugin-schema.cy.js +++ b/web/cypress/e2e/plugin/plugin-schema.cy.js @@ -109,5 +109,35 @@ describe('Plugin Schema Test', () => { // check if plugin list is empty cy.get(domSelector.empty).should('be.visible'); }); + + it('click plugin Edit button the existing configuration should display', () => { + cy.visit('/'); + cy.contains('Consumer').click(); + cy.get('.ant-empty-normal').should('be.visible'); + cy.contains('Create').click(); + + cy.get('#username').type('test'); + cy.contains('Next').click(); + cy.contains('.ant-card', 'client-control').within(() => { + cy.contains('Enable').click({ + force: true, + }); + }); + cy.focused('.ant-drawer-content').should('exist'); + cy.get('.view-zones').should('exist'); + cy.contains('max_body_size').should('be.visible'); + cy.window().then((window) => { + window.monacoEditor.setValue(JSON.stringify({ max_body_size: 1024 })); + cy.contains('button', 'Submit').click(); + }); + cy.wait(3000); + cy.contains('.ant-card', 'client-control').within(() => { + cy.contains('Enable').click({ + force: true, + }); + }); + cy.focused('.ant-drawer-content').should('exist'); + cy.contains('1024').should('be.visible'); + }); }); }); diff --git a/web/src/components/Plugin/PluginDetail.tsx b/web/src/components/Plugin/PluginDetail.tsx index 8fc98acd7..195931927 100644 --- a/web/src/components/Plugin/PluginDetail.tsx +++ b/web/src/components/Plugin/PluginDetail.tsx @@ -488,7 +488,7 @@ const PluginDetail: React.FC<Props> = ({ // NOTE: for debug & test // @ts-ignore window.monacoEditor = editor; - if (targetModel) editor.setValue(targetModelCode); + if (targetModel && content === '{}') editor.setValue(targetModelCode); }} options={{ scrollbar: {