From 2805ce55163adfa49b1f0acad0cc33d7b33a541a Mon Sep 17 00:00:00 2001 From: buqiyuan <1743369777@qq.com> Date: Fri, 15 Jul 2022 14:21:15 +0800 Subject: [PATCH] fix: eo-editor view not reflesh --- .../editor/eo-editor/eo-editor.component.scss | 1 + .../editor/eo-editor/eo-editor.component.ts | 3 +++ .../app/pages/api/test/api-test.component.html | 18 ++++++++++-------- .../app/pages/api/test/api-test.component.ts | 9 +++++++-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.scss b/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.scss index 9a5a101de..f02f48ec1 100644 --- a/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.scss +++ b/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.scss @@ -5,6 +5,7 @@ width: 100%; display: flex; align-items: center; + padding-left: 10px; nz-select { width: 90px; } diff --git a/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.ts b/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.ts index 9e5d7cf08..4b1649c5d 100644 --- a/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.ts +++ b/src/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component.ts @@ -138,6 +138,9 @@ export class EoEditorComponent implements AfterViewInit, OnInit, OnChanges { this.codeChange.emit(this.code); }, 0); } + rerenderAce() { + this.aceRef.directiveRef.ace().renderer.updateFull(true); + } formatCode(code, type) { if (type === 'json') { return beautifier.js(code, { diff --git a/src/workbench/browser/src/app/pages/api/test/api-test.component.html b/src/workbench/browser/src/app/pages/api/test/api-test.component.html index 0c98f90a8..491c0560d 100644 --- a/src/workbench/browser/src/app/pages/api/test/api-test.component.html +++ b/src/workbench/browser/src/app/pages/api/test/api-test.component.html @@ -30,7 +30,7 @@
- + @@ -68,7 +68,7 @@ REST - {{ + {{ apiData.restParams | apiParamsNum }} @@ -76,17 +76,19 @@ - Pre-request Script + Pre-request Script + - + - After-response Script + After-response Script + - + diff --git a/src/workbench/browser/src/app/pages/api/test/api-test.component.ts b/src/workbench/browser/src/app/pages/api/test/api-test.component.ts index 81fd65902..0f8b6a4fa 100644 --- a/src/workbench/browser/src/app/pages/api/test/api-test.component.ts +++ b/src/workbench/browser/src/app/pages/api/test/api-test.component.ts @@ -56,6 +56,7 @@ export class ApiTestComponent implements OnInit, OnDestroy { afterScriptCompletions = afterScriptCompletions; beforeScript = ''; afterScript = ''; + nzSelectedIndex = 1; status: 'start' | 'testing' | 'tested' = 'start'; waitSeconds = 0; tabIndexRes = 0; @@ -106,8 +107,7 @@ export class ApiTestComponent implements OnInit, OnDestroy { console.log('restoreHistory', result); //restore request this.apiData = result.testData; - this.beforeScript = result.response?.beforeScript; - this.afterScript = result.response?.afterScript; + this.setScriptsByHistory(result.response); this.changeUri(); //restore response this.tabIndexRes = 0; @@ -121,6 +121,10 @@ export class ApiTestComponent implements OnInit, OnDestroy { } }); } + setScriptsByHistory(response) { + this.beforeScript = response?.beforeScript || ''; + this.afterScript = response?.afterScript || ''; + } loadTestHistory(id) { if (!id) { this.beforeScript = ''; @@ -278,6 +282,7 @@ export class ApiTestComponent implements OnInit, OnDestroy { const tabData = this.apiTab.tabCache[this.apiTab.tabID]; this.apiData = tabData.apiData; this.testResult = tabData.testResult; + this.setScriptsByHistory(tabData.testResult); return; } if (!id) {