Merge branch 'v1.8' into master
This commit is contained in:
commit
13386da0af
|
@ -447,7 +447,7 @@ export default {
|
||||||
|
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
if (this.$refs.scenarioTable) {
|
if (this.$refs.scenarioTable) {
|
||||||
this.$refs.scenarioTable.doLayout();
|
setTimeout(this.$refs.scenarioTable.doLayout, 200)
|
||||||
}
|
}
|
||||||
this.checkTableRowIsSelect();
|
this.checkTableRowIsSelect();
|
||||||
})
|
})
|
||||||
|
|
|
@ -767,7 +767,7 @@
|
||||||
},
|
},
|
||||||
runDebug() {
|
runDebug() {
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
let sign = this.$refs.envPopover.checkEnv();
|
let sign = this.$refs.envPopover.checkEnv(this.scenarioDefinition);
|
||||||
if (!sign) {
|
if (!sign) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ export default {
|
||||||
setProjectEnvMap(map) {
|
setProjectEnvMap(map) {
|
||||||
this.$emit("setProjectEnvMap", map);
|
this.$emit("setProjectEnvMap", map);
|
||||||
},
|
},
|
||||||
checkEnv() {
|
checkEnv(data) {
|
||||||
return this.$refs.envSelect.checkEnv();
|
return this.$refs.envSelect.checkEnv(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<script>
|
<script>
|
||||||
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||||
import ApiEnvironmentConfig from "@/business/components/api/definition/components/environment/ApiEnvironmentConfig";
|
import ApiEnvironmentConfig from "@/business/components/api/definition/components/environment/ApiEnvironmentConfig";
|
||||||
|
import {ELEMENTS} from "./Setting";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EnvironmentSelect",
|
name: "EnvironmentSelect",
|
||||||
|
@ -46,7 +47,8 @@ export default {
|
||||||
result: {},
|
result: {},
|
||||||
projects: [],
|
projects: [],
|
||||||
environments: [],
|
environments: [],
|
||||||
dialogVisible: false
|
dialogVisible: false,
|
||||||
|
isFullUrl: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -102,8 +104,125 @@ export default {
|
||||||
this.$emit('setProjectEnvMap', map);
|
this.$emit('setProjectEnvMap', map);
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
},
|
},
|
||||||
checkEnv() {
|
getApiInfo(request) {
|
||||||
|
if (request.id && request.referenced === 'REF') {
|
||||||
|
let requestResult = request.requestResult;
|
||||||
|
let url = request.refType && request.refType === 'CASE' ? "/api/testcase/get/" : "/api/definition/get/";
|
||||||
|
let enable = request.enable;
|
||||||
|
this.$get(url + request.id, response => {
|
||||||
|
if (response.data) {
|
||||||
|
Object.assign(request, JSON.parse(response.data.request));
|
||||||
|
request.name = response.data.name;
|
||||||
|
request.enable = enable;
|
||||||
|
if (response.data.path && response.data.path != null) {
|
||||||
|
request.path = response.data.path;
|
||||||
|
request.url = response.data.url;
|
||||||
|
this.setUrl(request.path);
|
||||||
|
}
|
||||||
|
if (response.data.method && response.data.method != null) {
|
||||||
|
request.method = response.data.method;
|
||||||
|
}
|
||||||
|
request.requestResult = requestResult;
|
||||||
|
request.id = response.data.id;
|
||||||
|
request.disabled = true;
|
||||||
|
request.root = true;
|
||||||
|
if (!request.projectId) {
|
||||||
|
request.projectId = response.data.projectId;
|
||||||
|
}
|
||||||
|
this.reload();
|
||||||
|
this.sort();
|
||||||
|
} else {
|
||||||
|
request.referenced = "Deleted";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getScenario(scenario) {
|
||||||
|
this.result = this.$get("/api/automation/getApiScenario/" + scenario.id, response => {
|
||||||
|
if (response.data) {
|
||||||
|
scenario.loaded = true;
|
||||||
|
let obj = {};
|
||||||
|
if (response.data.scenarioDefinition) {
|
||||||
|
obj = JSON.parse(response.data.scenarioDefinition);
|
||||||
|
scenario.hashTree = obj.hashTree;
|
||||||
|
}
|
||||||
|
//scenario.disabled = true;
|
||||||
|
scenario.name = response.data.name;
|
||||||
|
if (!scenario.projectId) {
|
||||||
|
scenario.projectId = response.data.projectId;
|
||||||
|
}
|
||||||
|
scenario.headers = obj.headers;
|
||||||
|
scenario.variables = obj.variables;
|
||||||
|
scenario.environmentMap = obj.environmentMap;
|
||||||
|
this.$emit('refReload');
|
||||||
|
} else {
|
||||||
|
scenario.referenced = "Deleted";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
recursiveSorting(arr) {
|
||||||
|
for (let i in arr) {
|
||||||
|
if (arr[i].referenced === 'REF') {
|
||||||
|
// 分场景和接口
|
||||||
|
if (arr[i].type === "HTTPSamplerProxy") {
|
||||||
|
// 获取源头内容
|
||||||
|
this.getApiInfo(arr[i]);
|
||||||
|
// 校验是否是全路径
|
||||||
|
if (!arr[i].url || (!arr[i].url.startsWith("http://") && !arr[i].url.startsWith("https://"))) {
|
||||||
|
this.isFullUrl = false;
|
||||||
|
}
|
||||||
|
} else if (arr[i].type === "scenario") {
|
||||||
|
this.getScenario(arr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (arr[i].type === "HTTPSamplerProxy") {
|
||||||
|
// 校验是否是全路径
|
||||||
|
if (arr[i].enable) {
|
||||||
|
if (!arr[i].url || (!arr[i].url.startsWith("http://") && !arr[i].url.startsWith("https://"))) {
|
||||||
|
this.isFullUrl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||||
|
this.recursiveSorting(arr[i].hashTree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkFullUrl(scenarioDefinition) {
|
||||||
|
for (let i in scenarioDefinition) {
|
||||||
|
// 设置项目ID
|
||||||
|
let request = scenarioDefinition[i];
|
||||||
|
if (request.referenced === 'REF') {
|
||||||
|
if (request.type === "HTTPSamplerProxy") {
|
||||||
|
this.getApiInfo(request);
|
||||||
|
// 校验是否是全路径
|
||||||
|
if (!request.url || (!request.url.startsWith("http://") && !request.url.startsWith("https://"))) {
|
||||||
|
this.isFullUrl = false;
|
||||||
|
}
|
||||||
|
} else if (request.type === "scenario") {
|
||||||
|
this.getScenario(request);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (request.type === "HTTPSamplerProxy") {
|
||||||
|
// 校验是否是全路径
|
||||||
|
|
||||||
|
if (request.enable) {
|
||||||
|
if (!request.url || (!request.url.startsWith("http://") && !request.url.startsWith("https://"))) {
|
||||||
|
this.isFullUrl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scenarioDefinition[i].hashTree != undefined && scenarioDefinition[i].hashTree.length > 0) {
|
||||||
|
this.recursiveSorting(scenarioDefinition[i].hashTree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkEnv(data) {
|
||||||
let sign = true;
|
let sign = true;
|
||||||
|
this.isFullUrl = true;
|
||||||
if (this.data.length > 0) {
|
if (this.data.length > 0) {
|
||||||
this.data.forEach(dt => {
|
this.data.forEach(dt => {
|
||||||
if (!dt.selectEnv) {
|
if (!dt.selectEnv) {
|
||||||
|
@ -121,8 +240,13 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
// this.checkFullUrl(data);
|
||||||
|
// sign = this.isFullUrl;
|
||||||
sign = false;
|
sign = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 校验是否全是全路径
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sign) {
|
if (!sign) {
|
||||||
|
|
|
@ -354,7 +354,7 @@ export default {
|
||||||
|
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
if (this.$refs.caseTable) {
|
if (this.$refs.caseTable) {
|
||||||
this.$refs.caseTable.doLayout();
|
setTimeout(this.$refs.caseTable.doLayout, 200)
|
||||||
}
|
}
|
||||||
this.checkTableRowIsSelect();
|
this.checkTableRowIsSelect();
|
||||||
})
|
})
|
||||||
|
|
|
@ -463,7 +463,7 @@ export default {
|
||||||
// nexttick:表格加载完成之后触发。判断是否需要勾选行
|
// nexttick:表格加载完成之后触发。判断是否需要勾选行
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
if (this.$refs.apiDefinitionTable) {
|
if (this.$refs.apiDefinitionTable) {
|
||||||
this.$refs.apiDefinitionTable.doLayout();
|
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
|
||||||
}
|
}
|
||||||
this.checkTableRowIsSelect();
|
this.checkTableRowIsSelect();
|
||||||
})
|
})
|
||||||
|
|
|
@ -397,7 +397,7 @@ export default {
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.table) {
|
if (this.$refs.table) {
|
||||||
this.$refs.table.doLayout();
|
setTimeout(this.$refs.table.doLayout, 200)
|
||||||
}
|
}
|
||||||
this.checkTableRowIsSelect();
|
this.checkTableRowIsSelect();
|
||||||
})
|
})
|
||||||
|
|
|
@ -473,7 +473,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.selectRows.clear();
|
this.selectRows.clear();
|
||||||
if (this.$refs.table) {
|
if (this.$refs.table) {
|
||||||
this.$refs.table.doLayout();
|
setTimeout(this.$refs.table.doLayout, 200)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit afb50f22464b832e4f458f3f7947e6d8f982707e
|
Subproject commit a37e6bb56ffaa7ecc4ee128640e9415304ad41b6
|
Loading…
Reference in New Issue