Skip to content

Commit 688afa2

Browse files
authored
fix: plugin configuration lost in editor (#2718)
1 parent 7b8d9c5 commit 688afa2

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

web/cypress/e2e/plugin/plugin-schema.cy.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,35 @@ describe('Plugin Schema Test', () => {
109109
// check if plugin list is empty
110110
cy.get(domSelector.empty).should('be.visible');
111111
});
112+
113+
it('click plugin Edit button the existing configuration should display', () => {
114+
cy.visit('/');
115+
cy.contains('Consumer').click();
116+
cy.get('.ant-empty-normal').should('be.visible');
117+
cy.contains('Create').click();
118+
119+
cy.get('#username').type('test');
120+
cy.contains('Next').click();
121+
cy.contains('.ant-card', 'client-control').within(() => {
122+
cy.contains('Enable').click({
123+
force: true,
124+
});
125+
});
126+
cy.focused('.ant-drawer-content').should('exist');
127+
cy.get('.view-zones').should('exist');
128+
cy.contains('max_body_size').should('be.visible');
129+
cy.window().then((window) => {
130+
window.monacoEditor.setValue(JSON.stringify({ max_body_size: 1024 }));
131+
cy.contains('button', 'Submit').click();
132+
});
133+
cy.wait(3000);
134+
cy.contains('.ant-card', 'client-control').within(() => {
135+
cy.contains('Enable').click({
136+
force: true,
137+
});
138+
});
139+
cy.focused('.ant-drawer-content').should('exist');
140+
cy.contains('1024').should('be.visible');
141+
});
112142
});
113143
});

web/src/components/Plugin/PluginDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ const PluginDetail: React.FC<Props> = ({
490490
// NOTE: for debug & test
491491
// @ts-ignore
492492
window.monacoEditor = editor;
493-
if (targetModel) editor.setValue(targetModelCode);
493+
if (targetModel && content === '{}') editor.setValue(targetModelCode);
494494
}}
495495
options={{
496496
scrollbar: {

0 commit comments

Comments
 (0)