track recent
This commit is contained in:
parent
c24dd94e0b
commit
f797c8cf67
|
@ -53,7 +53,7 @@ public class TestCaseController {
|
|||
return testCaseService.getTestCaseNames(request);
|
||||
}
|
||||
|
||||
@PostMapping("/get/{testCaseId}")
|
||||
@GetMapping("/get/{testCaseId}")
|
||||
public List<TestCaseWithBLOBs> getTestCase(@PathVariable String testCaseId){
|
||||
return testCaseService.getTestCase(testCaseId);
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import io.metersphere.base.domain.TestPlan;
|
|||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.testcase.PlanCaseRelevanceRequest;
|
||||
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
|
||||
import io.metersphere.controller.request.testcase.QueryTestPlanRequest;
|
||||
import io.metersphere.dto.TestPlanDTO;
|
||||
import io.metersphere.service.TestCaseService;
|
||||
import io.metersphere.service.TestPlanService;
|
||||
import io.metersphere.user.SessionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -30,6 +32,14 @@ public class TestPlanController {
|
|||
return PageUtils.setPageInfo(page, testPlanService.listTestPlan(request));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("recent/{count}")
|
||||
public List<TestPlan> recentTestPlans(@PathVariable int count) {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
PageHelper.startPage(1, count, true);
|
||||
return testPlanService.recentTestPlans(currentWorkspaceId);
|
||||
}
|
||||
|
||||
@PostMapping("/get/{testPlanId}")
|
||||
public List<TestPlan> getTestPlan(@PathVariable String testPlanId){
|
||||
return testPlanService.getTestPlan(testPlanId);
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.service;
|
|||
|
||||
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.base.mapper.TestCaseMapper;
|
||||
import io.metersphere.base.mapper.TestPlanMapper;
|
||||
import io.metersphere.base.mapper.TestPlanTestCaseMapper;
|
||||
|
@ -36,6 +37,9 @@ public class TestCaseService {
|
|||
@Resource
|
||||
TestPlanTestCaseMapper testPlanTestCaseMapper;
|
||||
|
||||
@Resource
|
||||
ProjectMapper projectMapper;
|
||||
|
||||
public void addTestCase(TestCaseWithBLOBs testCase) {
|
||||
testCase.setId(UUID.randomUUID().toString());
|
||||
testCase.setCreateTime(System.currentTimeMillis());
|
||||
|
@ -111,6 +115,20 @@ public class TestCaseService {
|
|||
|
||||
|
||||
public List<TestCase> recentTestPlans(QueryTestCaseRequest request) {
|
||||
return null;
|
||||
|
||||
if (StringUtils.isBlank(request.getWorkspaceId())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId());
|
||||
|
||||
List<String> projectIds = projectMapper.selectByExample(projectExample).stream()
|
||||
.map(Project::getId).collect(Collectors.toList());
|
||||
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
testCaseExample.createCriteria().andProjectIdIn(projectIds);
|
||||
testCaseExample.setOrderByClause("update_time desc");
|
||||
return testCaseMapper.selectByExample(testCaseExample);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,4 +101,14 @@ public class TestPlanService {
|
|||
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
public List<TestPlan> recentTestPlans(String currentWorkspaceId) {
|
||||
if (StringUtils.isBlank(currentWorkspaceId)) {
|
||||
return null;
|
||||
}
|
||||
TestPlanExample testPlanTestCaseExample = new TestPlanExample();
|
||||
testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
|
||||
testPlanTestCaseExample.setOrderByClause("update_time desc");
|
||||
return testPlanMapper.selectByExample(testPlanTestCaseExample);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,10 +204,15 @@ const router = new VueRouter({
|
|||
component: TrackHome,
|
||||
},
|
||||
{
|
||||
path: 'case/:caseId',
|
||||
path: 'case/:projectId',
|
||||
name: 'testCase',
|
||||
component: TestCase,
|
||||
},
|
||||
{
|
||||
path: 'case/edit/:caseId',
|
||||
name: 'testCaseEdit',
|
||||
component: TestCase,
|
||||
},
|
||||
{
|
||||
path: "plan/:projectId",
|
||||
name: "testPlan",
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
</el-submenu>
|
||||
</el-menu>
|
||||
<node-tree class="node_tree"
|
||||
@nodeSelectEvent="getCaseByNodeIds"
|
||||
@refresh="getCaseByNodeIds"
|
||||
@nodeSelectEvent="refreshTable"
|
||||
@refresh="refreshTable"
|
||||
ref="nodeTree"></node-tree>
|
||||
</el-aside>
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
</el-container>
|
||||
|
||||
<test-case-edit
|
||||
@refresh="getCaseByNodeIds"
|
||||
@refresh="refreshTable"
|
||||
ref="testCaseEditDialog"></test-case-edit>
|
||||
|
||||
</div>
|
||||
|
@ -73,13 +73,22 @@
|
|||
}
|
||||
},
|
||||
created: function () {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
this.caseId = this.$route.params.caseId;
|
||||
this.getProjects();
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
if (from.name.indexOf("Project") >= 0){
|
||||
let path = to.path;
|
||||
if (path.indexOf("/track/case/all") >= 0){
|
||||
this.getProjects();
|
||||
this.refresh();
|
||||
}
|
||||
if (path.indexOf("/track/case/edit") >= 0){
|
||||
let caseId = this.$route.params.caseId;
|
||||
this.$get('/test/case/get/' + caseId, response => {
|
||||
console.log(response.data);
|
||||
this.openTestCaseEditDialog(response.data[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -120,10 +129,10 @@
|
|||
changeProject(project) {
|
||||
this.currentProject = project;
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
|
||||
this.$refs.testCaseList.initTableData()
|
||||
this.$refs.testCaseList.initTableData();
|
||||
this.$refs.nodeTree.getNodeTree();
|
||||
},
|
||||
getCaseByNodeIds(data) {
|
||||
refreshTable(data) {
|
||||
this.$refs.testCaseList.initTableData(data);
|
||||
},
|
||||
openTestCaseEditDialog(data) {
|
||||
|
@ -154,6 +163,10 @@
|
|||
this.$post('/user/ws/member/list/all', {workspaceId:workspaceId}, response => {
|
||||
this.$refs.testCaseEditDialog.maintainerOptions = response.data;
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.$refs.testCaseList.initTableData();
|
||||
this.$refs.nodeTree.getNodeTree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
<i class="el-icon-time"/>
|
||||
{{$t('load_test.recent')}}
|
||||
</div>
|
||||
<el-menu-item :key="t.id" v-for="t in recentTestPlans" :index="'/performance/test/edit/' + t.id">
|
||||
<el-menu-item :key="t.id" v-for="t in recentTestCases"
|
||||
:index="'/track/case/edit/' + t.id">
|
||||
{{ t.name }}
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
|
@ -20,14 +21,14 @@
|
|||
const roles = rolesString.split(',');
|
||||
|
||||
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
|
||||
this.$get('/performance/recent/5', (response) => {
|
||||
this.recentTestPlans = response.data;
|
||||
this.$get('/test/case/recent/5', (response) => {
|
||||
this.recentTestCases = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
recentTestPlans: []
|
||||
recentTestCases: []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
<el-submenu v-if="isCurrentWorkspaceUser"
|
||||
index="7" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']">
|
||||
<template v-slot:title>{{$t('test_track.test_plan')}}</template>
|
||||
<recent-test-plan/>
|
||||
<el-divider/>
|
||||
<el-menu-item :index="'/track/plan/all'">
|
||||
<font-awesome-icon :icon="['fa', 'list-ul']"/>
|
||||
|
@ -58,10 +59,11 @@
|
|||
import {checkoutCurrentWorkspace} from "../../../../common/utils";
|
||||
import TrackRecentProject from "../../track/project/TrackRecentProject";
|
||||
import RecentTestCase from "../case/components/RecentTestCase";
|
||||
import RecentTestPlan from "../plan/components/RecentTestPlan";
|
||||
|
||||
export default {
|
||||
name: "MsMenus",
|
||||
components: {RecentTestCase, TrackRecentProject },
|
||||
components: {RecentTestCase, TrackRecentProject, RecentTestPlan},
|
||||
data() {
|
||||
return {
|
||||
isCurrentWorkspaceUser: false,
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<template>
|
||||
<el-menu router menu-trigger="click" :default-active="$route.path">
|
||||
<div class="recent-text">
|
||||
<i class="el-icon-time"/>
|
||||
{{$t('load_test.recent')}}
|
||||
</div>
|
||||
<el-menu-item :key="t.id" v-for="t in recentTestPlans"
|
||||
:index="'/track/plan/view/' + t.id">
|
||||
{{ t.name }}
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../../common/constants";
|
||||
|
||||
export default {
|
||||
name: "RecentTestPlan",
|
||||
mounted() {
|
||||
const rolesString = localStorage.getItem("roles");
|
||||
const roles = rolesString.split(',');
|
||||
|
||||
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
|
||||
this.$get('/test/plan/recent/5', (response) => {
|
||||
this.recentTestPlans = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
recentTestPlans: []
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.recent-text {
|
||||
padding-left: 10%;
|
||||
color: #777777;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue