refactor(测试跟踪): 测试计划显示默认环境加过滤条件

https://www.tapd.cn/55049933/prong/stories/view/1155049933001010410

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-11-08 16:28:13 +08:00 committed by xiaomeinvG
parent f7aa399ff9
commit 71279ea0bb
3 changed files with 10 additions and 5 deletions

View File

@ -670,7 +670,7 @@ public class TestPlanApiCaseService {
String caseId = testPlanApiCase.getApiCaseId(); String caseId = testPlanApiCase.getApiCaseId();
String envId = testPlanApiCase.getEnvironmentId(); String envId = testPlanApiCase.getEnvironmentId();
String projectId = projectCaseIdMap.get(caseId); String projectId = projectCaseIdMap.get(caseId);
if (StringUtils.isNotBlank(projectId)) { if (StringUtils.isNotBlank(projectId) && StringUtils.isNotBlank(envId)) {
if (envMap.containsKey(projectId)) { if (envMap.containsKey(projectId)) {
List<String> list = envMap.get(projectId); List<String> list = envMap.get(projectId);
if (!list.contains(envId)) { if (!list.contains(envId)) {
@ -682,6 +682,7 @@ public class TestPlanApiCaseService {
envMap.put(projectId, envs); envMap.put(projectId, envs);
} }
} }
}); });
return envMap; return envMap;
} }

View File

@ -1499,9 +1499,13 @@ public class TestPlanService {
.flatMap(Collection::stream) .flatMap(Collection::stream)
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
envMap.put(projectId, result); if (CollectionUtils.isNotEmpty(result)){
envMap.put(projectId, result);
}
} else { } else {
envMap.put(projectId, scenarioEnv.get(projectId)); if (CollectionUtils.isNotEmpty(scenarioEnv.get(projectId))){
envMap.put(projectId, scenarioEnv.get(projectId));
}
} }
} }

View File

@ -162,12 +162,12 @@
<el-dropdown @command="handleCommand" style="margin-left: 5px"> <el-dropdown @command="handleCommand" style="margin-left: 5px">
<el-button type="primary"> <el-button type="primary">
{{ {{
$t("commons.run") $t("api_test.run")
}}<i class="el-icon-arrow-down el-icon--right"></i> }}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="run">{{ <el-dropdown-item command="run">{{
$t("commons.run") $t("api_test.run")
}} }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item command="runAndSave">{{ <el-dropdown-item command="runAndSave">{{