From 8cb60e4634cb0ecae75f663461e8f2e536b84f0c Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 24 Oct 2022 19:47:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=8F=AA=E8=AF=BB=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=9F=A5=E8=AF=A2=E7=94=A8=E4=BE=8B=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestCaseController.java | 2 +- .../controller/TestPlanController.java | 8 +++++++ test-track/frontend/src/api/issue.js | 4 ++++ .../frontend/src/api/remote/plan/test-plan.js | 4 ++++ .../business/common/minder/TestPlanMinder.vue | 3 ++- .../functional/FunctionalTestCaseList.vue | 24 +++++++------------ 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java index 779bbb7725..9e4259fa2b 100644 --- a/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java +++ b/test-track/backend/src/main/java/io/metersphere/controller/TestCaseController.java @@ -370,7 +370,7 @@ public class TestCaseController { } @PostMapping("/edit/follows/{caseId}") - @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT) + @RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ_EDIT) public void editTestFollows(@PathVariable String caseId, @RequestBody List follows) { testCaseService.saveFollows(caseId, follows); } diff --git a/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java b/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java index 9426da3efc..8d22ea917d 100644 --- a/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java +++ b/test-track/backend/src/main/java/io/metersphere/controller/TestPlanController.java @@ -123,6 +123,14 @@ public class TestPlanController { return testPlanService.editTestPlanWithRequest(testPlanDTO); } + @PostMapping("/fresh/{planId}") + public TestPlan freshRecentPlan(@PathVariable String planId) { + AddTestPlanRequest request = new AddTestPlanRequest(); + request.setId(planId); + request.setUpdateTime(System.currentTimeMillis()); + return testPlanService.editTestPlanWithRequest(request); + } + @PostMapping("/edit/status/{planId}") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT) @MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#planId)", content = "#msClass.getLogDetails(#planId)", msClass = TestPlanService.class) diff --git a/test-track/frontend/src/api/issue.js b/test-track/frontend/src/api/issue.js index f06233162a..f571b4e66e 100644 --- a/test-track/frontend/src/api/issue.js +++ b/test-track/frontend/src/api/issue.js @@ -82,6 +82,10 @@ export function getIssuesByCaseId(refType, caseId, page) { } } +export function getOriginIssuesByCaseId(refType, caseId) { + return get('issues/get/case/' + refType + '/' + caseId); +} + export function getIssuesById(id) { return id ? get('/issues/get/' + id) : {}; } diff --git a/test-track/frontend/src/api/remote/plan/test-plan.js b/test-track/frontend/src/api/remote/plan/test-plan.js index ba72d5d5d8..afa8e54759 100644 --- a/test-track/frontend/src/api/remote/plan/test-plan.js +++ b/test-track/frontend/src/api/remote/plan/test-plan.js @@ -20,6 +20,10 @@ export function testPlanEditStatus(id) { return post(BASE_URL + `edit/status/${id}`, {}); } +export function testPlanFresh(planId) { + return post(BASE_URL + `fresh/${planId}`, {}); +} + export function testPlanAdd(param) { return post(BASE_URL + 'add', param); } diff --git a/test-track/frontend/src/business/common/minder/TestPlanMinder.vue b/test-track/frontend/src/business/common/minder/TestPlanMinder.vue index eaa3fd708d..9d10c4a72e 100644 --- a/test-track/frontend/src/business/common/minder/TestPlanMinder.vue +++ b/test-track/frontend/src/business/common/minder/TestPlanMinder.vue @@ -49,6 +49,7 @@ import {addIssueHotBox} from "./minderUtils"; import MsModuleMinder from "@/business/common/minder/MsModuleMinder"; import {useStore} from "@/store"; import {testPlanCaseMinderEdit} from "@/api/remote/plan/test-plan-case"; +import {hasPermission} from "@/business/utils/sdk-utils"; export default { name: "TestPlanMinder", @@ -87,7 +88,7 @@ export default { return getCurrentWorkspaceId(); }, disableMinder() { - if (this.planStatus === 'Archived') { + if (this.planStatus === 'Archived' || !hasPermission('PROJECT_TRACK_PLAN:READ+RUN')) { return true } else { return false diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue index e5b52cace2..b80731f34b 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -299,8 +299,7 @@ import {getTestTemplate} from "@/api/custom-field-template"; import { editTestPlanTestCaseOrder, testPlanAutoCheck, - testPlanEdit, - testPlanEditStatus, + testPlanEditStatus, testPlanFresh, testPlanGet } from "@/api/remote/plan/test-plan"; import {SYSTEM_FIELD_NAME_MAP} from "metersphere-frontend/src/utils/table-constants"; @@ -313,6 +312,7 @@ import { testPlanTestCaseDelete, testPlanTestCaseEdit } from "@/api/remote/plan/test-plan-test-case"; +import {getIssuesByCaseId, getOriginIssuesByCaseId} from "@/api/issue"; export default { name: "FunctionalTestCaseList", @@ -517,11 +517,11 @@ export default { methods: { loadIssue(row) { if (row.issuesSize && !row.hasLoadIssue) { - // todo - // this.$get("/issues/get/case/PLAN_FUNCTIONAL/" + row.id).then(response => { - // this.$set(row, "issuesContent", response.data.data); - // this.$set(row, "hasLoadIssue", true); - // }); + getOriginIssuesByCaseId('PLAN_FUNCTIONAL', row.id) + .then(r => { + this.$set(row, "issuesContent", r.data); + this.$set(row, "hasLoadIssue", true); + }); } }, handleOpenFailureTestCase(row) { @@ -681,12 +681,6 @@ export default { this.getTestPlanById(); this.initTableData(); }, - refreshTestPlanRecent() { - let param = {}; - param.id = this.planId; - param.updateTime = Date.now(); - testPlanEdit(param); - }, search() { this.initTableData(); this.$emit('search'); @@ -765,8 +759,8 @@ export default { testPlanGet(this.planId) .then(response => { this.testPlan = response.data; - this.refreshTestPlanRecent(); - }) + testPlanFresh(this.planId); + }); } }, batchEdit(form) {