fix(接口测试): 解决接口导入问题
--user=郭雨琦 --bug=1015712 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015712 --bug=1015679 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015679
This commit is contained in:
parent
5a560037b7
commit
a1c7897138
|
@ -606,7 +606,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
}*/
|
||||
//直接导出完整路径
|
||||
if (apiDefinition.getModulePath() != null) {
|
||||
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
|
||||
String[] split = new String[0];
|
||||
String modulePath = apiDefinition.getModulePath();
|
||||
String substring = modulePath.substring(0, 1);
|
||||
|
@ -620,6 +620,8 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
split = new String[]{modulePath};
|
||||
}
|
||||
swaggerApiInfo.setTags(Arrays.asList(split));
|
||||
} else {
|
||||
swaggerApiInfo.setTags(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 设置请求体
|
||||
|
@ -1018,6 +1020,9 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
|
||||
private String getModulePath(List<String> tagTree, StringBuilder modulePath) {
|
||||
if (CollectionUtils.isEmpty(tagTree)) {
|
||||
return "/未规划接口";
|
||||
}
|
||||
for (String s : tagTree) {
|
||||
if (s.contains("/")) {
|
||||
String[] split = s.split("/");
|
||||
|
|
|
@ -902,12 +902,15 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
|
|||
int finalI = i;
|
||||
//在选择的模块下建模块,查看选择的模块下有没有同名的模块
|
||||
List<ApiScenarioModule> moduleList = pidChildrenMap.get(parentModule.getId());
|
||||
List<ApiScenarioModule> collect1 = moduleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList());
|
||||
if (collect1.isEmpty()) {
|
||||
List<ApiScenarioModule> filterModuleList = null;
|
||||
if (!CollectionUtils.isEmpty(moduleList)) {
|
||||
filterModuleList = moduleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(filterModuleList)) {
|
||||
return createModule(tagTree, i, parentModule, moduleMap, pidChildrenMap, idPathMap);
|
||||
} else {
|
||||
returnModule = collect1.get(0);
|
||||
parentModule = collect1.get(0);
|
||||
returnModule = filterModuleList.get(0);
|
||||
parentModule = filterModuleList.get(0);
|
||||
}
|
||||
}
|
||||
return returnModule;
|
||||
|
|
|
@ -655,7 +655,7 @@
|
|||
inner join project on api_test_case.project_id = project.id
|
||||
inner JOIN api_definition a ON api_test_case.api_definition_id = a.id
|
||||
<include refid="criCondition"/>
|
||||
and a.latest is not null
|
||||
and a.latest = 1
|
||||
</select>
|
||||
|
||||
<select id="getRequest" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
|
||||
|
|
|
@ -238,6 +238,7 @@ export default {
|
|||
this.$post("/api/automation/module/delete", nodeIds, () => {
|
||||
this.list();
|
||||
this.refresh();
|
||||
this.removeModuleId(nodeIds);
|
||||
}, (error) => {
|
||||
this.list();
|
||||
});
|
||||
|
@ -281,6 +282,11 @@ export default {
|
|||
enableTrash() {
|
||||
this.condition.trashEnable = true;
|
||||
this.$emit('enableTrash', this.condition.trashEnable);
|
||||
},
|
||||
removeModuleId(nodeIds) {
|
||||
if (localStorage.getItem('scenarioModule') && localStorage.getItem('scenarioModule') === nodeIds[0]) {
|
||||
localStorage.setItem('scenarioModule', undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,17 +251,18 @@ export default {
|
|||
add(param) {
|
||||
param.projectId = this.projectId;
|
||||
param.protocol = this.condition.protocol;
|
||||
this.$post("/api/module/add", param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.list();
|
||||
}, (error) => {
|
||||
this.list();
|
||||
});
|
||||
this.$post("/api/module/add", param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.list();
|
||||
}, (error) => {
|
||||
this.list();
|
||||
});
|
||||
},
|
||||
remove(nodeIds) {
|
||||
this.$post("/api/module/delete", nodeIds, () => {
|
||||
this.list();
|
||||
this.refresh();
|
||||
this.removeModuleId(nodeIds);
|
||||
}, (error) => {
|
||||
this.list();
|
||||
});
|
||||
|
@ -303,6 +304,27 @@ export default {
|
|||
this.list();
|
||||
this.$emit('refreshTable');
|
||||
},
|
||||
removeModuleId(nodeIds) {
|
||||
if (localStorage.getItem('tcp') || localStorage.getItem('http') || localStorage.getItem('sql') || localStorage.getItem('dubbo')) {
|
||||
if (this.condition.protocol === 'TCP') {
|
||||
if (localStorage.getItem('tcp') === nodeIds[0]) {
|
||||
localStorage.setItem('tcp', undefined);
|
||||
}
|
||||
} else if (this.condition.protocol === 'HTTP') {
|
||||
if (localStorage.getItem('http') === nodeIds[0]) {
|
||||
localStorage.setItem('http', undefined);
|
||||
}
|
||||
} else if (this.condition.protocol === 'SQL') {
|
||||
if (localStorage.getItem('sql') === nodeIds[0]) {
|
||||
localStorage.setItem('sql', undefined);
|
||||
}
|
||||
} else if (this.condition.protocol === 'DUBBO') {
|
||||
if (localStorage.getItem('dubbo') === nodeIds[0]) {
|
||||
localStorage.setItem('dubbo', undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue