feat(editor): codeBlockService.getCodeDsl支持增加是否强制刷新参数

This commit is contained in:
parisma 2022-09-13 17:22:59 +08:00 committed by jia000
parent 8a9971ab7b
commit fc749b7375

View File

@ -70,10 +70,11 @@ class CodeBlock extends BaseService {
/** /**
* dsl数据源dsl中的methods字段读取 * dsl数据源dsl中的methods字段读取
* @param {boolean} forceRefresh dsl拉取刷新
* @returns {CodeBlockDSL | null} * @returns {CodeBlockDSL | null}
*/ */
public async getCodeDsl(): Promise<CodeBlockDSL | null> { public async getCodeDsl(forceRefresh = false): Promise<CodeBlockDSL | null> {
if (!this.state.codeDsl) { if (!this.state.codeDsl || forceRefresh) {
this.state.codeDsl = await editorService.getCodeDsl(); this.state.codeDsl = await editorService.getCodeDsl();
} }
return this.state.codeDsl; return this.state.codeDsl;
@ -288,6 +289,12 @@ class CodeBlock extends BaseService {
public destroy() { public destroy() {
this.state.isShowCodeEditor = false; this.state.isShowCodeEditor = false;
this.state.codeDsl = null; this.state.codeDsl = null;
this.state.id = '';
this.state.editable = true;
this.state.mode = EditorMode.EDITOR;
this.state.combineIds = [];
this.state.compRelation = {};
this.state.undeletableList = [];
} }
} }