fix: TAPD缺陷修复

修复场景导入步骤时表格显示不美观的问题、接口定义CASE案例显示字母不全的问题、场景批量添加测试计划数量不对的问题
This commit is contained in:
song-tianyang 2021-04-26 16:15:51 +08:00 committed by 刘瑞斌
parent 57c1d6398d
commit d938b12d5b
11 changed files with 85 additions and 21 deletions

View File

@ -2,10 +2,7 @@ package io.metersphere.api.controller;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.ApiScenarioEnvRequest; import io.metersphere.api.dto.*;
import io.metersphere.api.dto.ApiTestImportRequest;
import io.metersphere.api.dto.JmxInfoDTO;
import io.metersphere.api.dto.ScenarioEnv;
import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.automation.*;
import io.metersphere.api.dto.automation.parse.ScenarioImport; import io.metersphere.api.dto.automation.parse.ScenarioImport;
import io.metersphere.api.dto.definition.RunDefinitionRequest; import io.metersphere.api.dto.definition.RunDefinitionRequest;
@ -124,6 +121,11 @@ public class ApiAutomationController {
return apiAutomationService.getApiScenarioProjectId(id); return apiAutomationService.getApiScenarioProjectId(id);
} }
@PostMapping("/getApiScenarioProjectIdByConditions")
public List<ScenarioIdProjectInfo> getApiScenarioProjectIdByConditions(@RequestBody ApiScenarioBatchRequest request) {
return apiAutomationService.getApiScenarioProjectIdByConditions(request);
}
@PostMapping("/getApiScenarios") @PostMapping("/getApiScenarios")
public List<ApiScenarioWithBLOBs> getApiScenarios(@RequestBody List<String> ids) { public List<ApiScenarioWithBLOBs> getApiScenarios(@RequestBody List<String> ids) {
return apiAutomationService.getApiScenarios(ids); return apiAutomationService.getApiScenarios(ids);

View File

@ -0,0 +1,15 @@
package io.metersphere.api.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.HashSet;
import java.util.Set;
@Getter
@Setter
public class ScenarioIdProjectInfo {
private Set<String> projectIds = new HashSet<>();
private String id;
}

View File

@ -8,10 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.metersphere.api.dto.APIReportBatchRequest; import io.metersphere.api.dto.*;
import io.metersphere.api.dto.ApiTestImportRequest;
import io.metersphere.api.dto.JmxInfoDTO;
import io.metersphere.api.dto.ScenarioEnv;
import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.automation.*;
import io.metersphere.api.dto.automation.parse.ScenarioImport; import io.metersphere.api.dto.automation.parse.ScenarioImport;
import io.metersphere.api.dto.automation.parse.ScenarioImportParserFactory; import io.metersphere.api.dto.automation.parse.ScenarioImportParserFactory;
@ -1605,4 +1602,37 @@ public class ApiAutomationService {
scenarioEnv.getProjectIds().add(scenario.getProjectId()); scenarioEnv.getProjectIds().add(scenario.getProjectId());
return scenarioEnv; return scenarioEnv;
} }
public List<ScenarioIdProjectInfo> getApiScenarioProjectIdByConditions(ApiScenarioBatchRequest request) {
List<ScenarioIdProjectInfo> returnList = new ArrayList<>();
if (request.getIds() == null) {
request.setIds(new ArrayList<>(0));
}
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
if (!request.getIds().isEmpty()) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(request.getIds());
List<ApiScenarioWithBLOBs> scenarioList = apiScenarioMapper.selectByExampleWithBLOBs(example);
for (ApiScenarioWithBLOBs scenario : scenarioList) {
ScenarioEnv scenarioEnv = new ScenarioEnv();
if (scenario == null) {
continue;
}
String definition = scenario.getScenarioDefinition();
if (StringUtils.isBlank(definition)) {
continue;
}
scenarioEnv = getApiScenarioEnv(definition);
scenarioEnv.getProjectIds().add(scenario.getProjectId());
ScenarioIdProjectInfo info = new ScenarioIdProjectInfo();
info.setProjectIds(scenarioEnv.getProjectIds());
info.setId(scenario.getId());
returnList.add(info);
}
}
return returnList;
}
} }

View File

@ -148,7 +148,8 @@
<!--测试计划--> <!--测试计划-->
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" <el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false"
:title="$t('test_track.plan_view.test_result')" :modal="false" size="90%"> :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
<ms-test-plan-list @addTestPlan="addTestPlan(arguments)" @cancel="cancel" ref="testPlanList" :row="selectRows"/> <ms-test-plan-list @addTestPlan="addTestPlan(arguments)" @cancel="cancel" ref="testPlanList"
:scenario-condition="condition" :row="selectRows"/>
</el-drawer> </el-drawer>
</div> </div>
</el-card> </el-card>

View File

@ -378,6 +378,7 @@ export default {
this.genProtocalFilter(this.condition.protocol); this.genProtocalFilter(this.condition.protocol);
this.$nextTick(function () { this.$nextTick(function () {
if (this.$refs.apitable) { if (this.$refs.apitable) {
this.$refs.apitable.doLayout();
this.$refs.apitable.checkTableRowIsSelect(); this.$refs.apitable.checkTableRowIsSelect();
} }
}); });

View File

@ -291,6 +291,7 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
if (this.$refs.table) { if (this.$refs.table) {
this.$refs.table.doLayout();
this.$refs.table.checkTableRowIsSelect(); this.$refs.table.checkTableRowIsSelect();
} }
}); });

View File

@ -164,7 +164,8 @@ export default {
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination, EnvPopover MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination, EnvPopover
}, },
props: { props: {
row: Set row: Set,
scenarioCondition: {},
}, },
data() { data() {
return { return {
@ -236,13 +237,25 @@ export default {
setScenarioSelectRows(rows) { setScenarioSelectRows(rows) {
this.projectIds.clear(); this.projectIds.clear();
this.map.clear(); this.map.clear();
if (this.scenarioCondition != null) {
let params = {};
params.condition = this.scenarioCondition;
this.$post('/api/automation/getApiScenarioProjectIdByConditions', params, res => {
let data = res.data;
data.forEach(scenario => {
scenario.projectIds.forEach(d => this.projectIds.add(d));
this.map.set(scenario.id, scenario.projectIds);
});
});
} else {
rows.forEach(row => { rows.forEach(row => {
this.result = this.$get('/api/automation/getApiScenarioProjectId/' + row.id, res => { this.result = this.$get('/api/automation/getApiScenarioProjectId/' + row.id, res => {
let data = res.data; let data = res.data;
data.projectIds.forEach(d => this.projectIds.add(d)); data.projectIds.forEach(d => this.projectIds.add(d));
this.map.set(row.id, data.projectIds); this.map.set(row.id, data.projectIds);
}) });
}) });
}
}, },
initTableData() { initTableData() {
if (this.planId) { if (this.planId) {

View File

@ -366,7 +366,7 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
if (this.$refs.caseTable) { if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200); this.$refs.caseTable.doLayout();
this.$refs.caseTable.checkTableRowIsSelect(); this.$refs.caseTable.checkTableRowIsSelect();
} }
}) })

View File

@ -441,7 +441,7 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
if (this.$refs.apiDefinitionTable) { if (this.$refs.apiDefinitionTable) {
this.$refs.apiDefinitionTable.checkTableRowIsSelect(); this.$refs.apiDefinitionTable.checkTableRowIsSelect();
setTimeout(this.$refs.apiDefinitionTable.doLayout(), 200); this.$refs.apiDefinitionTable.doLayout();
} }
}) })
}); });

View File

@ -10,8 +10,9 @@
circle circle
style="color:white;padding: 0px 0.1px;width: 28px;height: 28px;" style="color:white;padding: 0px 0.1px;width: 28px;height: 28px;"
size="mini"> size="mini">
<span style=" font-size: 11px; transform: scale(0.8);">{{ tip }}</span> <div style="transform: scale(0.8)">
<span style="margin-left: -4px;line-height: 27px;">{{ tip }}</span>
</div>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<ms-tip-button v-else <ms-tip-button v-else

View File

@ -201,7 +201,7 @@ export default {
} }
}, },
doLayout() { doLayout() {
this.$refs.table.doLayout(); setTimeout(this.$refs.table.doLayout(), 200);
}, },
filter(filters) { filter(filters) {
_filter(filters, this.condition); _filter(filters, this.condition);