refactor(接口自动化): 列表触发执行场景前进行环境检查
This commit is contained in:
parent
386d124c86
commit
d12027005f
|
@ -364,6 +364,11 @@ public class ApiAutomationController {
|
|||
return apiAutomationService.checkScenarioEnv(request);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/checkScenarioEnv/{scenarioId}")
|
||||
public boolean checkScenarioEnvByScenarioId(@PathVariable String scenarioId) {
|
||||
return apiAutomationService.checkScenarioEnv(scenarioId);
|
||||
}
|
||||
|
||||
@GetMapping("/follow/{scenarioId}")
|
||||
public List<String> getFollows(@PathVariable String scenarioId) {
|
||||
return apiAutomationService.getFollows(scenarioId);
|
||||
|
|
|
@ -3033,6 +3033,12 @@ public class ApiAutomationService {
|
|||
return this.checkScenarioEnv(request, null);
|
||||
}
|
||||
|
||||
public boolean checkScenarioEnv(String scenarioId) {
|
||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(scenarioId);
|
||||
this.setScenarioEnv(apiScenarioWithBLOBs);
|
||||
return this.checkScenarioEnv(apiScenarioWithBLOBs, null);
|
||||
}
|
||||
|
||||
public List<String> getFollows(String scenarioId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if (StringUtils.isBlank(scenarioId)) {
|
||||
|
|
|
@ -1005,9 +1005,17 @@ export default {
|
|||
}
|
||||
this.environmentType = this.currentScenario.environmentType;
|
||||
this.envGroupId = this.currentScenario.environmentGroupId;
|
||||
|
||||
this.$get("/api/automation/checkScenarioEnv/" + this.currentScenario.id, res => {
|
||||
let data = res.data;
|
||||
if (!data) {
|
||||
this.$warning("请为场景选择环境!");
|
||||
return false;
|
||||
}
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
this.runVisible = true;
|
||||
this.$set(row, "isStop", true);
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -177,7 +177,7 @@ export default {
|
|||
this.reload();
|
||||
},
|
||||
checkEnv(val) {
|
||||
this.$post("/api/automation/checkScenarioEnv", {scenarioDefinition: JSON.stringify(this.scenario), projectId: this.projectId}, res => {
|
||||
this.$get("/api/automation/checkScenarioEnv/" + this.scenario.id, res => {
|
||||
if (this.scenario.environmentEnable && !res.data) {
|
||||
this.scenario.environmentEnable = false;
|
||||
this.$warning("当前场景没有环境,需要先设置自身环境");
|
||||
|
|
Loading…
Reference in New Issue