fix(项目设置): 自定义代码片段测试时报错

--bug=1009212 --user=lyh 自定义代码片段测试时SQL报错
https://www.tapd.cn/55049933/s/1086695
This commit is contained in:
shiziyuan9527 2021-12-24 14:36:29 +08:00 committed by 刘瑞斌
parent e95839d8cc
commit 4807ccd91b
2 changed files with 23 additions and 1 deletions

View File

@ -116,6 +116,7 @@ public class CustomFunctionService {
}
public MsExecResponseDTO run(RunDefinitionRequest request) {
request.setDebug(true);
return apiDefinitionService.run(request, new LinkedList<>());
}
}

View File

@ -57,6 +57,27 @@ export default {
this.$emit('runRefresh', data);
}
},
onDebugMessage(e) {
if (e.data && e.data.startsWith("result_")) {
try {
let data = e.data.substring(7);
this.websocket.close();
this.$emit('runRefresh', JSON.parse(data));
} catch (e) {
this.websocket.close();
this.$emit('runRefresh', "");
}
}
},
debugSocket() {
let protocol = "ws://";
if (window.location.protocol === 'https:') {
protocol = "wss://";
}
const uri = protocol + window.location.host + "/ws/" + this.reportId;
this.websocket = new WebSocket(uri);
this.websocket.onmessage = this.onDebugMessage;
},
sort(stepArray) {
if (stepArray) {
for (let i in stepArray) {
@ -94,7 +115,7 @@ export default {
reqObj.reportId = this.reportId;
this.$post(url, reqObj, res => {
this.requestResult = res.data;
this.initWebSocket();
this.debugSocket();
}, () => {
this.$emit('errorRefresh', {});
})