fix: 处理回收站的用例生成关系图的情况

This commit is contained in:
chenjianxing 2021-10-22 13:47:51 +08:00 committed by jianxing
parent 51210f25d1
commit 153bff333b
7 changed files with 22 additions and 17 deletions

View File

@ -29,6 +29,7 @@ public class RelationshipGraphData {
private Integer category; // 分组 private Integer category; // 分组
private Integer x; private Integer x;
private Integer y; private Integer y;
private Boolean visited = false;
} }
@Getter @Getter

View File

@ -302,7 +302,7 @@ public class TestCaseController {
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class, @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class,
event = NoticeConstants.Event.DELETE, mailTemplate = "track/TestCaseDelete", subject = "测试用例通知") event = NoticeConstants.Event.DELETE, mailTemplate = "track/TestCaseDelete", subject = "测试用例通知")
public void deleteToGcBatch(@RequestBody TestCaseBatchRequest request) { public void deleteToGcBatch(@RequestBody TestCaseBatchRequest request) {
testCaseService.deleteToGcBatch(request); testCaseService.deleteToGcBatch(request.getIds());
} }
@PostMapping("/reduction") @PostMapping("/reduction")

View File

@ -259,7 +259,7 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
List<String> testCaseIdList = this.selectCaseIdByNodeIds(nodeIds); List<String> testCaseIdList = this.selectCaseIdByNodeIds(nodeIds);
TestCaseBatchRequest request = new TestCaseBatchRequest(); TestCaseBatchRequest request = new TestCaseBatchRequest();
request.setIds(testCaseIdList); request.setIds(testCaseIdList);
testCaseService.deleteToGcBatch(request); testCaseService.deleteToGcBatch(request.getIds());
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample(); TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
testCaseNodeExample.createCriteria().andIdIn(nodeIds); testCaseNodeExample.createCriteria().andIdIn(nodeIds);

View File

@ -1477,11 +1477,7 @@ public class TestCaseService {
}); });
} }
List<String> ids = request.getIds(); List<String> ids = request.getIds();
if (CollectionUtils.isNotEmpty(ids)) { deleteToGcBatch(ids);
TestCaseBatchRequest deleteRequest = new TestCaseBatchRequest();
deleteRequest.setIds(ids);
deleteTestCaseBath(deleteRequest);
}
} }
private void changeOrder(TestCaseMinderEditRequest.TestCaseMinderEditItem item, String projectId) { private void changeOrder(TestCaseMinderEditRequest.TestCaseMinderEditItem item, String projectId) {
@ -1823,9 +1819,9 @@ public class TestCaseService {
} }
} }
public void deleteToGcBatch(TestCaseBatchRequest request) { public void deleteToGcBatch(List<String> ids) {
if (CollectionUtils.isNotEmpty(request.getIds())) { if (CollectionUtils.isNotEmpty(ids)) {
for (String id : request.getIds()) { for (String id : ids) {
this.deleteTestCaseToGc(id); this.deleteTestCaseToGc(id);
} }
} }
@ -1987,6 +1983,9 @@ public class TestCaseService {
} else { } else {
testCase = caseMap.get(relationshipEdge.getSourceId()); testCase = caseMap.get(relationshipEdge.getSourceId());
} }
if (testCase == null) {
continue; // 用例可能在回收站
}
relationshipEdgeDTO.setTargetName(testCase.getName()); relationshipEdgeDTO.setTargetName(testCase.getName());
relationshipEdgeDTO.setCreator(testCase.getCreateUser()); relationshipEdgeDTO.setCreator(testCase.getCreateUser());
relationshipEdgeDTO.setTargetNum(testCase.getNum()); relationshipEdgeDTO.setTargetNum(testCase.getNum());

@ -1 +1 @@
Subproject commit a86e39275aae2a3e2e8aae705da5a4dddbd0089d Subproject commit a04a44ab83630eb73abeb0c22ff5e26833a3aa2f

View File

@ -112,13 +112,15 @@ export default {
computed: { computed: {
isCustomNum() { isCustomNum() {
let template = this.$store.state.testCaseTemplate; let template = this.$store.state.testCaseTemplate;
template.customFields.forEach(item => { if (template && template.customFields) {
if (item.name === '用例状态') { template.customFields.forEach(item => {
for (let i = 0; i < item.options.length; i++) { if (item.name === '用例状态') {
this.statusMap.set(item.options[i].value, item.options[i].text); for (let i = 0; i < item.options.length; i++) {
this.statusMap.set(item.options[i].value, item.options[i].text);
}
} }
} });
}); }
return this.$store.state.currentProjectIsCustomNum; return this.$store.state.currentProjectIsCustomNum;
}, },
}, },

View File

@ -327,6 +327,9 @@ export default {
}); });
}, },
btnDisable(row) { btnDisable(row) {
if (this.issueTemplate.platform == "metersphere" && row.platform == 'Local') {
return false;
}
if (this.issueTemplate.platform !== row.platform) { if (this.issueTemplate.platform !== row.platform) {
return true; return true;
} }