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

juzhiyuan pushed a commit to branch release/2.15
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/release/2.15 by this push:
     new edf22cbd8 fix: plugin configuration lost in editor (#2718) (#2745)
edf22cbd8 is described below

commit edf22cbd8a1ad3a89a88255a4f411c7947f806cf
Author: 琚致远 / Zhiyuan Ju <juzhiy...@apache.org>
AuthorDate: Wed Feb 22 17:27:18 2023 +0800

    fix: plugin configuration lost in editor (#2718) (#2745)
    
    Co-authored-by: Baoyuan <baoyuan....@gmail.com>
---
 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: {

Reply via email to