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