fix(接口测试): 修复dubbo协议和sql协议显示资源池错误的缺陷

--bug=1033318 --user=王孝刚 【接口测试】github#27787,dubbo接口TEST的时候,资源池跟项目设置使用的资源池不一致,一直是Local https://www.tapd.cn/55049933/s/1445299
--bug=1033062 --user=王孝刚 【接口测试】场景详情-设置显示系统模块-调试按钮显示换行 https://www.tapd.cn/55049933/s/1445371
This commit is contained in:
wxg0103 2023-12-19 13:54:52 +08:00 committed by 刘瑞斌
parent 37783397fb
commit 88ccf74d67
2 changed files with 25 additions and 10 deletions

View File

@ -3,15 +3,13 @@ package io.metersphere.service.definition;
import io.metersphere.api.dto.ApiReportEnvConfigDTO; import io.metersphere.api.dto.ApiReportEnvConfigDTO;
import io.metersphere.api.dto.MsgDTO; import io.metersphere.api.dto.MsgDTO;
import io.metersphere.api.dto.RequestResultExpandDTO; import io.metersphere.api.dto.RequestResultExpandDTO;
import io.metersphere.base.domain.ApiDefinitionEnv; import io.metersphere.base.domain.*;
import io.metersphere.base.domain.ApiDefinitionEnvExample;
import io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs;
import io.metersphere.base.domain.ApiTestEnvironmentExample;
import io.metersphere.base.mapper.ApiDefinitionEnvMapper; import io.metersphere.base.mapper.ApiDefinitionEnvMapper;
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper; import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ApiTestEnvironmentMapper; import io.metersphere.base.mapper.ApiTestEnvironmentMapper;
import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSON;
import io.metersphere.dto.RequestResult; import io.metersphere.dto.RequestResult;
import io.metersphere.service.BaseTestResourcePoolService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,6 +31,8 @@ public class ApiDefinitionEnvService {
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper; private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
@Resource @Resource
private ApiDefinitionService apiDefinitionService; private ApiDefinitionService apiDefinitionService;
@Resource
private BaseTestResourcePoolService baseTestResourcePoolService;
public void insert(ApiDefinitionEnv env) { public void insert(ApiDefinitionEnv env) {
env.setId(UUID.randomUUID().toString()); env.setId(UUID.randomUUID().toString());
@ -93,12 +93,21 @@ public class ApiDefinitionEnvService {
if (StringUtils.isNotBlank(dto.getToReport())) { if (StringUtils.isNotBlank(dto.getToReport())) {
ApiDefinitionExecResultWithBLOBs result = apiDefinitionExecResultMapper.selectByPrimaryKey(dto.getToReport()); ApiDefinitionExecResultWithBLOBs result = apiDefinitionExecResultMapper.selectByPrimaryKey(dto.getToReport());
if (result != null && StringUtils.isNotEmpty(result.getEnvConfig())) { if (result != null && StringUtils.isNotEmpty(result.getEnvConfig())) {
ApiReportEnvConfigDTO envConfig = apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig()); if (StringUtils.equals("null",result.getEnvConfig())) {
if (envConfig != null) { if (StringUtils.isNotBlank(result.getActuator())) {
Map map = JSON.parseObject(dto.getContent().substring(7), Map.class); Map map = JSON.parseObject(dto.getContent().substring(7), Map.class);
map.put("envName", envConfig.getEnvName()); TestResourcePool resourcePool = baseTestResourcePoolService.getResourcePool(result.getActuator());
map.put("poolName", envConfig.getResourcePoolName()); map.put("poolName", resourcePool.getName());
dto.setContent("result_" + JSON.toJSONString(map)); dto.setContent("result_" + JSON.toJSONString(map));
}
} else {
ApiReportEnvConfigDTO envConfig = apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig());
if (envConfig != null) {
Map map = JSON.parseObject(dto.getContent().substring(7), Map.class);
map.put("envName", envConfig.getEnvName());
map.put("poolName", envConfig.getResourcePoolName());
dto.setContent("result_" + JSON.toJSONString(map));
}
} }
} }
} }

View File

@ -2962,6 +2962,12 @@ export default {
vertical-align: center; vertical-align: center;
} }
:deep(.el-dropdown .el-button-group) {
display: flex;
}
:deep(.ms-main-container) { :deep(.ms-main-container) {
padding: 5px 5px 5px 10px; padding: 5px 5px 5px 10px;
} }