编辑测试修改
This commit is contained in:
parent
cde78be5cb
commit
d4f69fa4ca
|
@ -21,6 +21,9 @@
|
||||||
<if test="request.projectId != null">
|
<if test="request.projectId != null">
|
||||||
AND project.id = #{request.projectId}
|
AND project.id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.id != null">
|
||||||
|
AND load_test.id = #{request.id}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
<if test="request.recent">
|
<if test="request.recent">
|
||||||
order by load_test.update_time desc
|
order by load_test.update_time desc
|
||||||
|
|
|
@ -64,6 +64,11 @@ public class LoadTestController {
|
||||||
return loadTestService.edit(request, file);
|
return loadTestService.edit(request, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/{testId}")
|
||||||
|
public LoadTestDTO get(@PathVariable String testId) {
|
||||||
|
return loadTestService.get(testId);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public void delete(@RequestBody DeleteTestPlanRequest request) {
|
public void delete(@RequestBody DeleteTestPlanRequest request) {
|
||||||
loadTestService.delete(request);
|
loadTestService.delete(request);
|
||||||
|
|
|
@ -195,5 +195,15 @@ public class LoadTestService {
|
||||||
// 查询最近的测试计划
|
// 查询最近的测试计划
|
||||||
request.setRecent(true);
|
request.setRecent(true);
|
||||||
return extLoadTestMapper.list(request);
|
return extLoadTestMapper.list(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LoadTestDTO get(String testId) {
|
||||||
|
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||||
|
request.setId(testId);
|
||||||
|
List<LoadTestDTO> testDTOS = extLoadTestMapper.list(request);
|
||||||
|
if (!CollectionUtils.isEmpty(testDTOS)) {
|
||||||
|
return testDTOS.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import RouterSidebar from "./RouterSidebar";
|
||||||
import Setting from "../settings/Setting";
|
import Setting from "../settings/Setting";
|
||||||
import Workspace from "../settings/Workspace";
|
import Workspace from "../settings/Workspace";
|
||||||
import User from "../settings/User";
|
import User from "../settings/User";
|
||||||
import CreateTestPlan from "../testPlan/CreateTestPlan";
|
import EditTestPlan from "../testPlan/EditTestPlan";
|
||||||
import AllTestPlan from "../testPlan/AllTestPlan";
|
import AllTestPlan from "../testPlan/AllTestPlan";
|
||||||
import Organization from "../settings/Organization";
|
import Organization from "../settings/Organization";
|
||||||
import OrganizationMember from "../settings/OrganizationMember";
|
import OrganizationMember from "../settings/OrganizationMember";
|
||||||
|
@ -74,7 +74,14 @@ const router = new VueRouter({
|
||||||
path: "/createTest",
|
path: "/createTest",
|
||||||
name: "createTest",
|
name: "createTest",
|
||||||
components: {
|
components: {
|
||||||
content: CreateTestPlan
|
content: EditTestPlan
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/editTest/:testId",
|
||||||
|
name: "editTest",
|
||||||
|
components: {
|
||||||
|
content: EditTestPlan
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
content: (route) => {
|
content: (route) => {
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
total: 0,
|
total: 0,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
testId: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -140,8 +141,9 @@
|
||||||
},
|
},
|
||||||
handleEdit(testPlan) {
|
handleEdit(testPlan) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'createTest',
|
path: '/editTest/' + testPlan.id,
|
||||||
params: {
|
params: {
|
||||||
|
testId: testPlan.id,
|
||||||
testPlanObj: testPlan
|
testPlanObj: testPlan
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,48 +1,52 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-testplan-container" v-loading="result.loading">
|
<div class="edit-testplan-container" v-loading="result.loading">
|
||||||
<el-row>
|
<div class="main-content">
|
||||||
<el-col :span="10">
|
<el-card>
|
||||||
<el-input placeholder="请输入名称" v-model="testPlan.name" class="input-with-select">
|
<el-row>
|
||||||
<el-select v-model="testPlan.projectId" slot="prepend" placeholder="请选择项目">
|
<el-col :span="10">
|
||||||
<el-option
|
<el-input placeholder="请输入名称" v-model="testPlan.name" class="input-with-select">
|
||||||
v-for="item in projects"
|
<el-select v-model="testPlan.projectId" slot="prepend" placeholder="请选择项目">
|
||||||
:key="item.id"
|
<el-option
|
||||||
:label="item.name"
|
v-for="item in projects"
|
||||||
:value="item.id">
|
:key="item.id"
|
||||||
</el-option>
|
:label="item.name"
|
||||||
</el-select>
|
:value="item.id">
|
||||||
</el-input>
|
</el-option>
|
||||||
</el-col>
|
</el-select>
|
||||||
<el-button type="primary" plain @click="save">保存</el-button>
|
</el-input>
|
||||||
<el-button type="primary" plain @click="saveAndRun">保存并执行</el-button>
|
</el-col>
|
||||||
<el-button type="warning" plain @click="cancel">取消</el-button>
|
<el-button type="primary" plain @click="save">保存</el-button>
|
||||||
</el-row>
|
<el-button type="primary" plain @click="saveAndRun">保存并执行</el-button>
|
||||||
|
<el-button type="warning" plain @click="cancel">取消</el-button>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<el-tabs v-model="active" type="border-card" :stretch="true">
|
<el-tabs v-model="active" type="border-card" :stretch="true">
|
||||||
<el-tab-pane label="基础配置">
|
<el-tab-pane label="基础配置">
|
||||||
<test-plan-basic-config :test-plan="testPlan"/>
|
<ms-test-plan-basic-config :test-plan="testPlan"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="压力配置">
|
<el-tab-pane label="压力配置">
|
||||||
<test-plan-pressure-config :test-plan="testPlan"/>
|
<ms-test-plan-pressure-config :test-plan="testPlan"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="高级配置">
|
<el-tab-pane label="高级配置">
|
||||||
<test-plan-advanced-config/>
|
<ms-test-plan-advanced-config/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TestPlanBasicConfig from './components/BasicConfig';
|
import MsTestPlanBasicConfig from './components/BasicConfig';
|
||||||
import TestPlanPressureConfig from './components/PressureConfig';
|
import MsTestPlanPressureConfig from './components/PressureConfig';
|
||||||
import TestPlanAdvancedConfig from './components/AdvancedConfig';
|
import MsTestPlanAdvancedConfig from './components/AdvancedConfig';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CreateTestPlan",
|
name: "MsEditTestPlan",
|
||||||
components: {
|
components: {
|
||||||
TestPlanBasicConfig,
|
MsTestPlanBasicConfig,
|
||||||
TestPlanPressureConfig,
|
MsTestPlanPressureConfig,
|
||||||
TestPlanAdvancedConfig,
|
MsTestPlanAdvancedConfig,
|
||||||
},
|
},
|
||||||
props: ['testPlanObj'],
|
props: ['testPlanObj'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -70,10 +74,25 @@
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
watch: {
|
||||||
if (this.testPlanObj) {
|
'$route'(to) {
|
||||||
this.testPlan = this.testPlanObj;
|
window.console.log(to);
|
||||||
|
let testId = to.path.split('/')[2]; // find testId
|
||||||
|
this.$get('/testplan/get/' + testId, response => {
|
||||||
|
this.testPlan = response.data;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
let testId = this.$route.path.split('/')[2];
|
||||||
|
window.console.log(testId);
|
||||||
|
if (testId) {
|
||||||
|
this.$get('/testplan/get/' + testId, response => {
|
||||||
|
this.testPlan = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.listProjects();
|
this.listProjects();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -185,9 +204,19 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.edit-testplan-container .el-tabs__nav {
|
.edit-testplan-container {
|
||||||
float: none;
|
float: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
padding: 15px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-testplan-container .el-select .el-input {
|
.edit-testplan-container .el-select .el-input {
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<el-menu>
|
<el-menu router menu-trigger="click" :default-active="$route.path">
|
||||||
<div class="recent-text">
|
<div class="recent-text">
|
||||||
<i class="el-icon-time"/>
|
<i class="el-icon-time"/>
|
||||||
最近的测试
|
最近的测试
|
||||||
</div>
|
</div>
|
||||||
<el-menu-item :key="recentTestPlan.id" v-for="recentTestPlan in recentTestPlans">
|
<el-menu-item :key="t.id" v-for="t in recentTestPlans" :index="'/editTest/' + t.id">
|
||||||
{{ recentTestPlan.name }}
|
{{ t.name }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanAdvancedConfig",
|
name: "MsTestPlanAdvancedConfig",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanBasicConfig",
|
name: "MsTestPlanBasicConfig",
|
||||||
props: ["testPlan"],
|
props: ["testPlan"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -73,8 +73,15 @@
|
||||||
this.getFileMetadata(this.testPlan)
|
this.getFileMetadata(this.testPlan)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
testPlan() {
|
||||||
|
this.getFileMetadata(this.testPlan);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFileMetadata(testPlan) {
|
getFileMetadata(testPlan) {
|
||||||
|
this.fileList = [];// 一个测试只有一个文件
|
||||||
|
this.tableData = [];// 一个测试只有一个文件
|
||||||
this.result = this.$get(this.getFileMetadataPath + "/" + testPlan.id, response => {
|
this.result = this.$get(this.getFileMetadataPath + "/" + testPlan.id, response => {
|
||||||
let file = response.data;
|
let file = response.data;
|
||||||
|
|
||||||
|
@ -84,7 +91,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.testPlan.file = file;
|
this.testPlan.file = file;
|
||||||
|
|
||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
id: file.id,
|
id: file.id,
|
||||||
name: file.name
|
name: file.name
|
||||||
|
|
|
@ -92,10 +92,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanPressureConfig",
|
name: "MsTestPlanPressureConfig",
|
||||||
props: ["testPlan"],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
testPlan: {},
|
||||||
threadNumber: 2,
|
threadNumber: 2,
|
||||||
duration: 3,
|
duration: 3,
|
||||||
rampUpTime: 12,
|
rampUpTime: 12,
|
||||||
|
@ -107,6 +107,11 @@
|
||||||
this.testPlan.loadConfigurationObj = [];
|
this.testPlan.loadConfigurationObj = [];
|
||||||
this.convertProperty();
|
this.convertProperty();
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
testPlan() {
|
||||||
|
this.convertProperty();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
convertProperty() {
|
convertProperty() {
|
||||||
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
||||||
|
|
Loading…
Reference in New Issue