fix(场景自动化): 修复循环控制器不能添加引用场景问题

This commit is contained in:
fit2-zhao 2021-03-10 11:25:22 +08:00
parent b9d43558bc
commit f511b38e91
2 changed files with 7 additions and 6 deletions

View File

@ -224,6 +224,7 @@
import MsComponentConfig from "./component/ComponentConfig";
import {handleCtrlSEvent} from "../../../../../common/js/utils";
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
let jsonPath = require('jsonpath');
export default {
name: "EditApiScenario",
@ -400,7 +401,7 @@
},
{
title: this.$t('api_test.automation.scenario_import'),
show:this.showButton("scenario"),
show: this.showButton("scenario"),
titleColor: "#606266",
titleBgColor: "#F4F4F5",
icon: "movie",
@ -557,7 +558,7 @@
this.scenarioDefinition[i].countController.proceed = true;
}
if (!this.scenarioDefinition[i].projectId) {
this.scenarioDefinition.projectId = getCurrentProjectID();
this.scenarioDefinition[i].projectId = getCurrentProjectID();
}
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
@ -677,7 +678,7 @@
}
const index = hashTree.findIndex(d => d.resourceId === row.resourceId);
if (index != -1) {
hashTree.splice(index+1, 0, obj);
hashTree.splice(index + 1, 0, obj);
} else {
hashTree.push(obj);
}
@ -1019,7 +1020,7 @@
//
this.$nextTick(() => {
this.projectIds.clear();
this.scenarioDefinition.forEach(data=>{
this.scenarioDefinition.forEach(data => {
let arr = jsonPath.query(data, "$..projectId");
arr.forEach(a => this.projectIds.add(a));
})

View File

@ -6,8 +6,8 @@ export const ELEMENTS = new Map([
['JDBCSampler', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['TCPSampler', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['OT_IMPORT', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['IfController', ["IfController","scenario", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['LoopController', ["IfController", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['IfController', ["IfController", "scenario", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['LoopController', ["IfController", "scenario", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
['ConstantTimer', []],
['JSR223Processor', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['JSR223PreProcessor', []],