fix(测试跟踪): 测试计划只读权限查询用例失败

This commit is contained in:
chenjianxing 2022-10-24 19:47:22 +08:00 committed by jianxing
parent a57e4c9b8f
commit fabb7a9e20
6 changed files with 28 additions and 17 deletions

View File

@ -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<String> follows) {
testCaseService.saveFollows(caseId, follows);
}

View File

@ -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)

View File

@ -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) : {};
}

View File

@ -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);
}

View File

@ -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

View File

@ -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) {