From cf2e158e96c4915df3c4f181d94f2d415982b632 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 17 Nov 2021 11:56:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=B3=E6=B3=A8=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=B0=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiAutomationController.java | 5 ++++- .../controller/ApiDefinitionController.java | 5 +++++ .../api/controller/ApiTestCaseController.java | 5 +++++ .../api/service/ApiAutomationService.java | 2 +- .../api/service/ApiDefinitionService.java | 4 ++-- .../api/service/ApiTestCaseService.java | 2 +- .../controller/PerformanceTestController.java | 5 +++++ .../service/PerformanceTestService.java | 4 ++-- .../track/controller/IssuesController.java | 5 +++++ .../track/controller/TestCaseController.java | 6 ++++++ .../track/service/IssuesService.java | 4 ++-- .../track/service/TestCaseService.java | 4 ++-- .../automation/scenario/EditApiScenario.vue | 21 +++++++++++++------ .../components/case/ApiCaseItem.vue | 10 +++++++++ .../complete/EditCompleteHTTPApi.vue | 13 +++++++++++- .../performance/test/EditPerformanceTest.vue | 11 +++++++++- .../track/case/components/TestCaseEdit.vue | 12 +++++++++++ .../track/issue/IssueEditDetail.vue | 17 ++++++++++++++- .../track/plan/components/TestPlanEdit.vue | 4 ++-- .../review/components/TestCaseReviewEdit.vue | 4 ++-- 20 files changed, 119 insertions(+), 24 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index 6d4d1bdd37..19dfe50de3 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -368,6 +368,9 @@ public class ApiAutomationController { public List getFollows(@PathVariable String scenarioId) { return apiAutomationService.getFollows(scenarioId); } - + @PostMapping("/update/follows/{scenarioId}") + public void saveFollows(@PathVariable String scenarioId,@RequestBody List follows) { + apiAutomationService.saveFollows(scenarioId,follows); + } } diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index b6ac8bd99e..8088c0ea2d 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -342,4 +342,9 @@ public class ApiDefinitionController { return JSONToDocumentUtils.getDocument(body.getRaw(),body.getType()); } + @PostMapping("/update/follows/{definitionId}") + public void saveFollows(@PathVariable String definitionId,@RequestBody List follows) { + apiDefinitionService.saveFollows(definitionId,follows); + } + } diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java index cb280a370e..9580937882 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java @@ -209,4 +209,9 @@ public class ApiTestCaseController { public List getFollows(@PathVariable String testId) { return apiTestCaseService.getFollows(testId); } + + @PostMapping("/update/follows/{testId}") + public void saveFollows(@PathVariable String testId,@RequestBody List follows) { + apiTestCaseService.saveFollows(testId,follows); + } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 5b66dc50da..02a682e269 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -502,7 +502,7 @@ public class ApiAutomationService { return scenario; } - private void saveFollows(String scenarioId, List follows) { + public void saveFollows(String scenarioId, List follows) { ApiScenarioFollowExample example = new ApiScenarioFollowExample(); example.createCriteria().andScenarioIdEqualTo(scenarioId); apiScenarioFollowMapper.deleteByExample(example); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 9009eec070..bb0d25a380 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -512,11 +512,11 @@ public class ApiDefinitionService { List ids = new ArrayList<>(); ids.add(request.getId()); apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol()); - saveFollows(test.getId(), request.getFollows()); + //saveFollows(test.getId(), request.getFollows()); return test; } - private void saveFollows(String definitionId, List follows) { + public void saveFollows(String definitionId, List follows) { ApiDefinitionFollowExample example = new ApiDefinitionFollowExample(); example.createCriteria().andDefinitionIdEqualTo(definitionId); apiDefinitionFollowMapper.deleteByExample(example); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index cc90571afd..231e348c70 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -378,7 +378,7 @@ public class ApiTestCaseService { return test; } - private void saveFollows(String testId, List follows) { + public void saveFollows(String testId, List follows) { ApiTestCaseFollowExample example = new ApiTestCaseFollowExample(); example.createCriteria().andCaseIdEqualTo(testId); apiTestCaseFollowMapper.deleteByExample(example); diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index 5516cf477d..9bc6e70fa6 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -247,4 +247,9 @@ public class PerformanceTestController { public List getFollows(@PathVariable String testId) { return performanceTestService.getFollows(testId); } + + @PostMapping("test/update/follows/{testId}") + public void saveFollows(@PathVariable String testId,@RequestBody List follows) { + performanceTestService.saveFollows(testId,follows); + } } diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 2c5caa6c41..8b8b3541ed 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -308,13 +308,13 @@ public class PerformanceTestService { loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration()); loadTest.setTestResourcePoolId(request.getTestResourcePoolId()); loadTest.setStatus(PerformanceTestStatus.Saved.name()); - saveFollows(loadTest.getId(), request.getFollows()); + //saveFollows(loadTest.getId(), request.getFollows()); loadTestMapper.updateByPrimaryKeySelective(loadTest); return loadTest; } - private void saveFollows(String testId, List follows) { + public void saveFollows(String testId, List follows) { LoadTestFollowExample example = new LoadTestFollowExample(); example.createCriteria().andTestIdEqualTo(testId); loadTestFollowMapper.deleteByExample(example); diff --git a/backend/src/main/java/io/metersphere/track/controller/IssuesController.java b/backend/src/main/java/io/metersphere/track/controller/IssuesController.java index 455425ee8c..c61106324b 100644 --- a/backend/src/main/java/io/metersphere/track/controller/IssuesController.java +++ b/backend/src/main/java/io/metersphere/track/controller/IssuesController.java @@ -133,4 +133,9 @@ public class IssuesController { public List getFollows(@PathVariable String issueId) { return issuesService.getFollows(issueId); } + + @PostMapping("/up/follows/{issueId}") + public void saveFollows(@PathVariable String issueId,@RequestBody List follows) { + issuesService.saveFollows(issueId,follows); + } } diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 2d46f134b0..3911cc6bb3 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -352,4 +352,10 @@ public class TestCaseController { public List getFollows(@PathVariable String caseId) { return testCaseService.getFollows(caseId); } + + @PostMapping("/edit/follows/{caseId}") + @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT) + public void editTestFollows(@PathVariable String caseId,@RequestBody List follows) { + testCaseService.saveFollows(caseId,follows); + } } diff --git a/backend/src/main/java/io/metersphere/track/service/IssuesService.java b/backend/src/main/java/io/metersphere/track/service/IssuesService.java index e8b8c441db..7d3eef22f2 100644 --- a/backend/src/main/java/io/metersphere/track/service/IssuesService.java +++ b/backend/src/main/java/io/metersphere/track/service/IssuesService.java @@ -105,10 +105,10 @@ public class IssuesService { platformList.forEach(platform -> { platform.updateIssue(issuesRequest); }); - saveFollows(issuesRequest.getId(), issuesRequest.getFollows()); + //saveFollows(issuesRequest.getId(), issuesRequest.getFollows()); // todo 缺陷更新事件? } - private void saveFollows(String issueId, List follows) { + public void saveFollows(String issueId, List follows) { IssueFollowExample example = new IssueFollowExample(); example.createCriteria().andIssueIdEqualTo(issueId); issueFollowMapper.deleteByExample(example); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index c77cb959df..018c20f165 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -183,7 +183,7 @@ public class TestCaseService { return request; } - private void saveFollows(String caseId, List follows) { + public void saveFollows(String caseId, List follows) { TestCaseFollowExample example = new TestCaseFollowExample(); example.createCriteria().andCaseIdEqualTo(caseId); testCaseFollowMapper.deleteByExample(example); @@ -1429,7 +1429,7 @@ public class TestCaseService { } this.setNode(request); editTestCase(request); - saveFollows(request.getId(), request.getFollows()); + //saveFollows(request.getId(), request.getFollows()); return testCaseWithBLOBs; } diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 960566b8fb..17488a4617 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -1612,19 +1612,28 @@ export default { showHistory() { this.$refs.taskCenter.openScenarioHistory(this.currentScenario.id); }, - saveFollow() { - if (this.showFollow) { + saveFollow(){ + if(this.showFollow){ this.showFollow = false; for (let i = 0; i < this.currentScenario.follows.length; i++) { - if (this.currentScenario.follows[i] === this.currentUser().id) { - this.currentScenario.follows.splice(i, 1) + if(this.currentScenario.follows[i]===this.currentUser().id){ + this.currentScenario.follows.splice(i,1) break; } } - - } else { + if(this.currentScenario.id){ + this.$post("/api/automation/update/follows/"+this.currentScenario.id, this.currentScenario.follows,() => { + this.$message.success("cancel success") + }); + } + }else { this.showFollow = true; this.currentScenario.follows.push(this.currentUser().id) + if(this.currentScenario.id){ + this.$post("/api/automation/update/follows/"+this.currentScenario.id, this.currentScenario.follows,() => { + this.$message.success("cancel success") + }); + } } } } diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index c8b210aac1..dc0d7892f1 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -522,9 +522,19 @@ export default { break; } } + if( this.apiCase.id){ + this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => { + this.$message.success("cancel success") + }); + } }else { this.showFollow = true; this.apiCase.follows.push(this.currentUser().id) + if( this.apiCase.id){ + this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => { + this.$message.success("cancel success") + }); + } } } } diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 69279afe7c..aa26385fe9 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -427,6 +427,8 @@ }); }, saveFollow(){ + console.log("***********") + console.log(this.basisData.id) if(this.showFollow){ this.showFollow = false; for (let i = 0; i < this.httpForm.follows.length; i++) { @@ -435,10 +437,19 @@ break; } } - + if(this.basisData.id){ + this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => { + this.$message.success("cancel success") + }); + } }else { this.showFollow = true; this.httpForm.follows.push(this.currentUser().id) + if(this.basisData.id){ + this.$post("/api/definition/update/follows/"+this.basisData.id, this.httpForm.follows,() => { + this.$message.success("save success") + }); + } } } }, diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index 2101371115..fe67476a67 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -492,10 +492,19 @@ export default { break; } } - + if(this.testId){ + this.$post("/performance/test/update/follows/"+this.testId, this.test.follows,() => { + this.$message.success("cancel success") + }); + } }else { this.showFollow = true; this.test.follows.push(this.currentUser().id) + if(this.testId){ + this.$post("/performance/test/update/follows/"+this.testId, this.test.follows,() => { + this.$message.success("cancel success") + }); + } } } } diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 2ed2ce8a08..262a2a3601 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -837,10 +837,22 @@ break; } } + if(this.path === "/test/case/edit"){ + this.result.loading = true + this.$post('/test/case/edit/follows/'+this.currentTestCaseInfo.id, this.form.follows,() => { + this.result.loading = false + }); + } }else { this.showFollow = true; this.form.follows.push(this.currentUser().id) + if(this.path === "/test/case/edit"){ + this.result.loading = true + this.$post('/test/case/edit/follows/'+this.currentTestCaseInfo.id, this.form.follows,() => { + this.result.loading = false + }); + } } } } diff --git a/frontend/src/business/components/track/issue/IssueEditDetail.vue b/frontend/src/business/components/track/issue/IssueEditDetail.vue index b93b34d765..1051721880 100644 --- a/frontend/src/business/components/track/issue/IssueEditDetail.vue +++ b/frontend/src/business/components/track/issue/IssueEditDetail.vue @@ -102,6 +102,7 @@ export default { }, data() { return { + issueId:'', result: {}, relateFields: [], isFormAlive: true, @@ -124,7 +125,7 @@ export default { form: { title: '', description: '', - creator: null + creator: null, }, tapdUsers: [], zentaoUsers: [], @@ -173,6 +174,8 @@ export default { } } }) + }else { + this.form.follows = []; } }, currentUser: () => { @@ -215,6 +218,7 @@ export default { this.form.options = data.options ? JSON.parse(data.options) : []; } if (data.id) { + this.issueId = data.id this.url = 'issues/update'; } else { //copy @@ -300,6 +304,9 @@ export default { } }, saveFollow(){ + if(!this.form.follows){ + this.form.follows = []; + } if(this.showFollow){ this.showFollow = false; for (let i = 0; i < this.form.follows.length; i++) { @@ -308,10 +315,18 @@ export default { break; } } + if(this.url === "issues/update"){ + this.$post("issues/up/follows/"+this.issueId, this.form.follows,() => { + }); + } }else { this.showFollow = true; this.form.follows.push(this.currentUser().id) + if(this.url === "issues/update"){ + this.$post("issues/up/follows/"+this.issueId, this.form.follows,() => { + }); + } } } } diff --git a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue index 18c59b4bb8..e131e483d8 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue @@ -100,7 +100,7 @@ - + diff --git a/frontend/src/business/components/track/review/components/TestCaseReviewEdit.vue b/frontend/src/business/components/track/review/components/TestCaseReviewEdit.vue index 1205154104..c49ba09dc5 100644 --- a/frontend/src/business/components/track/review/components/TestCaseReviewEdit.vue +++ b/frontend/src/business/components/track/review/components/TestCaseReviewEdit.vue @@ -47,7 +47,7 @@ - - + -->