Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Captain.B 2020-04-09 15:05:15 +08:00
commit 27617e578a
10 changed files with 167 additions and 60 deletions

View File

@ -34,6 +34,12 @@ public class TestPlanController {
return PageUtils.setPageInfo(page, testPlanService.listTestPlan(request)); return PageUtils.setPageInfo(page, testPlanService.listTestPlan(request));
} }
@PostMapping("/list/all")
public List<TestPlan> listAll() {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
return testPlanService.listTestAllPlan(currentWorkspaceId);
}
@GetMapping("recent/{count}") @GetMapping("recent/{count}")
public List<TestPlan> recentTestPlans(@PathVariable int count) { public List<TestPlan> recentTestPlans(@PathVariable int count) {

View File

@ -116,4 +116,10 @@ public class TestPlanService {
testPlanTestCaseExample.setOrderByClause("update_time desc"); testPlanTestCaseExample.setOrderByClause("update_time desc");
return testPlanMapper.selectByExample(testPlanTestCaseExample); return testPlanMapper.selectByExample(testPlanTestCaseExample);
} }
public List<TestPlan> listTestAllPlan(String currentWorkspaceId) {
TestPlanExample testPlanExample = new TestPlanExample();
testPlanExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
return testPlanMapper.selectByExample(testPlanExample);
}
} }

View File

@ -137,6 +137,7 @@
let orgId = data.id; let orgId = data.id;
this.$post("/user/switch/source/org/" + orgId, {}, response => { this.$post("/user/switch/source/org/" + orgId, {}, response => {
localStorage.setItem(TokenKey, JSON.stringify(response.data)); localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.$router.push('/');
window.location.reload(); window.location.reload();
}) })
}, },
@ -148,6 +149,7 @@
this.$post("/user/switch/source/ws/" + workspaceId, {}, response => { this.$post("/user/switch/source/ws/" + workspaceId, {}, response => {
localStorage.setItem(TokenKey, JSON.stringify(response.data)); localStorage.setItem(TokenKey, JSON.stringify(response.data));
localStorage.setItem("workspace_id", workspaceId); localStorage.setItem("workspace_id", workspaceId);
this.$router.push('/');
window.location.reload(); window.location.reload();
}) })
} }

View File

@ -3,29 +3,19 @@
<el-container> <el-container>
<el-aside width="250px"> <el-aside width="250px">
<el-menu :unique-opened="true" mode="horizontal" active-text-color="write" <select-menu
class="project_menu"> :data="projects"
<el-submenu index="1" popper-class="submenu"> :current-data="currentProject"
<template v-slot:title> :title="$t('test_track.project')"
{{currentProject == null ? '' : currentProject.name}} @dataChange="changeProject">
</template> </select-menu>
<div style="height:400px;">
<el-scrollbar style="height:100%">
<label v-for="(item,index) in projects" :key="index">
<el-menu-item @click="changeProject(item)">
{{item.name}}
<i class="el-icon-check" v-if="currentProject && item.id === currentProject.id"></i>
</el-menu-item>
</label>
</el-scrollbar>
</div>
</el-submenu>
</el-menu>
<node-tree class="node_tree" <node-tree class="node_tree"
:current-project="currentProject" :current-project="currentProject"
@nodeSelectEvent="refreshTable" @nodeSelectEvent="refreshTable"
@refresh="refreshTable" @refresh="refreshTable"
ref="nodeTree"></node-tree> ref="nodeTree">
</node-tree>
</el-aside> </el-aside>
<el-main class="main-content"> <el-main class="main-content">
@ -34,10 +24,10 @@
:current-project="currentProject" :current-project="currentProject"
@openTestCaseEditDialog="openTestCaseEditDialog" @openTestCaseEditDialog="openTestCaseEditDialog"
@testCaseEdit="openTestCaseEditDialog" @testCaseEdit="openTestCaseEditDialog"
ref="testCaseList"></test-case-list> ref="testCaseList">
</test-case-list>
</el-main> </el-main>
</el-container> </el-container>
<test-case-edit <test-case-edit
@ -53,10 +43,11 @@
import TestCaseEdit from './components/TestCaseEdit'; import TestCaseEdit from './components/TestCaseEdit';
import {CURRENT_PROJECT, WORKSPACE_ID} from '../../../../common/js/constants'; import {CURRENT_PROJECT, WORKSPACE_ID} from '../../../../common/js/constants';
import TestCaseList from "./components/TestCaseList"; import TestCaseList from "./components/TestCaseList";
import SelectMenu from "../common/SelectMenu";
export default { export default {
name: "TestCase", name: "TestCase",
components: {TestCaseList, NodeTree, TestCaseEdit}, components: {TestCaseList, NodeTree, TestCaseEdit, SelectMenu},
comments: {}, comments: {},
data() { data() {
return { return {
@ -193,7 +184,6 @@
<style scoped> <style scoped>
.case_container { .case_container {
padding: 15px;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: white; background: white;
@ -208,7 +198,7 @@
} }
.node_tree { .node_tree {
margin: 10%; margin: 5%;
} }
.project_menu { .project_menu {

View File

@ -0,0 +1,53 @@
<template>
<el-menu :unique-opened="true" mode="horizontal" active-text-color="write"
class="project_menu">
<el-submenu index="1" popper-class="submenu">
<template v-slot:title>
<span class="menu-title">{{'[' + title + ']'}}</span>
<span> {{currentData == null ? '' : currentData.name}} </span>
</template>
<template v-slot:default>
<div style="height:400px;">
<el-scrollbar style="height:100%">
<label v-for="(item,index) in data" :key="index">
<el-menu-item @click="changeData(item)">
{{item.name}}
<i class="el-icon-check" v-if="currentData && item.id === currentData.id"></i>
</el-menu-item>
</label>
</el-scrollbar>
</div>
</template>
</el-submenu>
</el-menu>
</template>
<script>
export default {
name: "SelectMenu",
props: {
data: {
type: Array
},
currentData: {
type: Object
},
title: {
type: String
}
},
methods: {
changeData(data) {
this.$emit("dataChange", data);
}
}
}
</script>
<style scoped>
.menu-title {
color: darkgrey;
}
</style>

View File

@ -2,21 +2,30 @@
<div class="plan_container"> <div class="plan_container">
<el-container> <el-container>
<el-aside class="node-tree" width="250px"> <el-aside class="aside-container" width="250px">
<select-menu
:data="testPlans"
:current-data="currentPlan"
:title="$t('test_track.plan')"
@dataChange="changePlan">
</select-menu>
<plan-node-tree <plan-node-tree
:tree-nodes="treeNodes" class="node_tree"
:plan-id="planId" :plan-id="planId"
@nodeSelectEvent="getPlanCases" @nodeSelectEvent="getPlanCases"
ref="tree"></plan-node-tree> ref="tree">
</plan-node-tree>
</el-aside> </el-aside>
<el-main> <el-main>
<test-case-plan-list <test-plan-test-case-list
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog" @openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@editTestPlanTestCase="editTestPlanTestCase" @editTestPlanTestCase="editTestPlanTestCase"
@refresh="refresh" @refresh="refresh"
:plan-id="planId" :plan-id="planId"
ref="testCasePlanList"></test-case-plan-list> ref="testCasePlanList"></test-plan-test-case-list>
</el-main> </el-main>
</el-container> </el-container>
@ -30,7 +39,6 @@
@refresh="refresh"> @refresh="refresh">
</test-plan-test-case-edit> </test-plan-test-case-edit>
</div> </div>
</template> </template>
@ -38,16 +46,18 @@
<script> <script>
import PlanNodeTree from "./components/PlanNodeTree"; import PlanNodeTree from "./components/PlanNodeTree";
import TestCasePlanList from "./components/TestCasePlanList"; import TestPlanTestCaseList from "./components/TestPlanTestCaseList";
import TestCaseRelevance from "./components/TestCaseRelevance"; import TestCaseRelevance from "./components/TestCaseRelevance";
import TestPlanTestCaseEdit from "./components/TestPlanTestCaseEdit"; import TestPlanTestCaseEdit from "./components/TestPlanTestCaseEdit";
import SelectMenu from "../common/SelectMenu";
export default { export default {
name: "TestPlanView", name: "TestPlanView",
components: {PlanNodeTree, TestCasePlanList, TestCaseRelevance, TestPlanTestCaseEdit}, components: {PlanNodeTree, TestPlanTestCaseList, TestCaseRelevance, TestPlanTestCaseEdit, SelectMenu},
data() { data() {
return { return {
treeNodes: [] testPlans: [],
currentPlan: {}
} }
}, },
computed: { computed: {
@ -55,6 +65,14 @@
return this.$route.params.planId; return this.$route.params.planId;
} }
}, },
created() {
this.getTestPlans();
},
watch: {
planId() {
this.getTestPlans();
}
},
methods: { methods: {
refresh() { refresh() {
this.getPlanCases(); this.getPlanCases();
@ -71,7 +89,6 @@
Object.assign(item, testCase); Object.assign(item, testCase);
item.results = JSON.parse(item.results); item.results = JSON.parse(item.results);
item.steps = JSON.parse(item.steps); item.steps = JSON.parse(item.steps);
item.steptResults = []; item.steptResults = [];
for (let i = 0; i < item.steps.length; i++){ for (let i = 0; i < item.steps.length; i++){
if(item.results[i]){ if(item.results[i]){
@ -82,6 +99,20 @@
} }
this.$refs.testPlanTestCaseEdit.testCase = item; this.$refs.testPlanTestCaseEdit.testCase = item;
this.$refs.testPlanTestCaseEdit.dialog = true; this.$refs.testPlanTestCaseEdit.dialog = true;
},
getTestPlans() {
this.result = this.$post('/test/plan/list/all', {}, response => {
this.testPlans = response.data;
this.testPlans.forEach(plan => {
if (this.planId && plan.id === this.planId) {
this.currentPlan = plan;
}
});
});
},
changePlan(plan) {
this.currentPlan = plan;
this.$router.push('/track/plan/view/' + plan.id);
} }
} }
} }
@ -94,9 +125,12 @@
height: 600px; height: 600px;
} }
.node-tree { .aside-container {
margin-top: 2%;
margin-left: 15px; margin-left: 15px;
} }
.node_tree {
margin: 3%;
}
</style> </style>

View File

@ -139,7 +139,6 @@
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
loadingRequire: {project: true, testCase: true},
testId: null, testId: null,
} }
}, },
@ -148,14 +147,11 @@
this.initTableData(); this.initTableData();
}, },
methods: { methods: {
initTableData(nodeIds) { initTableData() {
let param = { let param = {
name: this.condition, name: this.condition,
}; };
param.nodeIds = nodeIds;
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => { this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
this.loadingRequire.testCase = false;
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;

View File

@ -10,7 +10,7 @@
</el-col> </el-col>
<el-col :span="2" :offset="8"> <el-col :span="2" :offset="8">
<el-button icon="el-icon-circle-plus-outline" size="small" round <el-button icon="el-icon-connection" size="small" round
@click="$emit('openTestCaseRelevanceDialog')" >{{$t('test_track.relevance_test_case')}}</el-button> @click="$emit('openTestCaseRelevanceDialog')" >{{$t('test_track.relevance_test_case')}}</el-button>
</el-col> </el-col>
@ -75,11 +75,25 @@
width="160" width="160"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span v-if="scope.row.status == 'Prepare'">{{$t('test_track.plan_status_prepare')}}</span> <el-tag v-if="scope.row.status == 'Prepare'"
<span v-if="scope.row.status == 'Pass'">{{$t('test_track.pass')}}</span> e ffect="info"
<span v-if="scope.row.status == 'Failure'">{{$t('test_track.failure')}}</span> size="mini">{{$t('test_track.plan_status_prepare')}}</el-tag>
<span v-if="scope.row.status == 'Blocking'">{{$t('test_track.blocking')}}</span> <el-tag v-if="scope.row.status == 'Pass'"
<span v-if="scope.row.status == 'Skip'">{{$t('test_track.skip')}}</span> type="success"
effect="dark"
size="mini">{{$t('test_track.pass')}}</el-tag>
<el-tag v-if="scope.row.status == 'Failure'"
type="danger"
effect="dark"
size="mini">{{$t('test_track.failure')}}</el-tag>
<el-tag v-if="scope.row.status == 'Blocking'"
type="warning"
effect="dark"
size="mini">{{$t('test_track.blocking')}}</el-tag>
<el-tag v-if="scope.row.status == 'Skip'"
type="info"
effect="dark"
size="mini">{{$t('test_track.skip')}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -95,7 +109,7 @@
:label="$t('commons.operating')"> :label="$t('commons.operating')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-button @click="handleEdit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/> <el-button @click="handleEdit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="handleDelete(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/> <el-button @click="handleDelete(scope.row)" type="danger" icon="el-icon-unlock" size="mini" circle/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -126,7 +140,7 @@
import PlanNodeTree from './PlanNodeTree'; import PlanNodeTree from './PlanNodeTree';
export default { export default {
name: "TestCaseList", name: "TestPlanTestCaseList",
components: {PlanNodeTree}, components: {PlanNodeTree},
data() { data() {
return { return {
@ -192,7 +206,7 @@
this.$emit('editTestPlanTestCase', testCase); this.$emit('editTestPlanTestCase', testCase);
}, },
handleDelete(testCase) { handleDelete(testCase) {
this.$alert(this.$t('load_test.delete_confirm') + testCase.name + "", '', { this.$alert(this.$t('test_track.confirm_cancel_relevance') + ' ' + testCase.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {

View File

@ -41,10 +41,10 @@ export default {
'api': 'Api', 'api': 'Api',
'performance': 'Performance', 'performance': 'Performance',
'input_content': 'Please enter content', 'input_content': 'Please enter content',
'create': 'create', 'create': 'Create',
'refresh': 'refresh', 'refresh': 'Refresh',
'remark': 'remark', 'remark': 'Remark',
'delete': 'delete', 'delete': 'Delete',
'not_filled': 'Not filled' 'not_filled': 'Not filled'
}, },
workspace: { workspace: {
@ -201,7 +201,7 @@ export default {
'input_method': 'Please select method', 'input_method': 'Please select method',
'input_prerequisite': 'Please select prerequisite', 'input_prerequisite': 'Please select prerequisite',
'search_module': 'Search module', 'search_module': 'Search module',
'rename': 'rename', 'rename': 'Rename',
'add_submodule': 'Add submodule', 'add_submodule': 'Add submodule',
'add_module': 'Add module', 'add_module': 'Add module',
'module_name': 'Module name', 'module_name': 'Module name',
@ -209,17 +209,17 @@ export default {
'plan_name': 'Test plan name', 'plan_name': 'Test plan name',
'plan_project': 'Related project', 'plan_project': 'Related project',
'plan_stage': 'Testing phase', 'plan_stage': 'Testing phase',
'plan_status': 'The current state', 'plan_status': 'Status',
'smoke_test': 'Smoke test', 'smoke_test': 'Smoke test',
'functional_test': 'Functional test', 'functional_test': 'Functional test',
'integration_testing': 'Integration testing', 'integration_testing': 'Integration testing',
'system_test': 'System test', 'system_test': 'System test',
'version_validation': 'Version validation', 'version_validation': 'Version validation',
'plan_principal': 'principal', 'plan_principal': 'Principal',
'input_plan_principal': 'Please select principal', 'input_plan_principal': 'Please select principal',
'input_plan_project': 'Please select project', 'input_plan_project': 'Please select project',
'input_plan_stage': 'Please select stage', 'input_plan_stage': 'Please select stage',
'plan_status_prepare': ' Not started', 'plan_status_prepare': 'Not started',
'plan_status_running': 'Starting', 'plan_status_running': 'Starting',
'plan_status_completed': 'Completed', 'plan_status_completed': 'Completed',
'delete_module_confirm': 'Confirm delete module: ', 'delete_module_confirm': 'Confirm delete module: ',
@ -235,7 +235,10 @@ export default {
'actual_result': 'Actual result', 'actual_result': 'Actual result',
'step_result': 'Step result', 'step_result': 'Step result',
'select_execute_result': 'Select execute result', 'select_execute_result': 'Select execute result',
'save': 'Save' 'save': 'Save',
'confirm_cancel_relevance': 'Confirm cancel relevance',
'plan': 'Plan',
'project': 'Project',
}, },
test_resource_pool: { test_resource_pool: {
'type': 'type', 'type': 'type',

View File

@ -235,7 +235,10 @@ export default {
'actual_result': '实际结果', 'actual_result': '实际结果',
'step_result': '步骤执行结果', 'step_result': '步骤执行结果',
'select_execute_result': '选择执行结果', 'select_execute_result': '选择执行结果',
'save': '保 存' 'save': '保 存',
'confirm_cancel_relevance': '确认取消关联',
'plan': '计划',
'project': '项目',
}, },
test_resource_pool: { test_resource_pool: {
'type': '类型', 'type': '类型',