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 688afa209 fix: plugin configuration lost in editor (#2718)
688afa209 is described below
commit 688afa2099b1782bb401083085b2384f27c9cc6a
Author: Baoyuan <[email protected]>
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 0e0fc8f96..69c7a268f 100644
--- a/web/src/components/Plugin/PluginDetail.tsx
+++ b/web/src/components/Plugin/PluginDetail.tsx
@@ -490,7 +490,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: {