project
This commit is contained in:
parent
ce4c1b0af8
commit
54963b2fa0
|
@ -1,6 +1,9 @@
|
||||||
package io.metersphere.service;
|
package io.metersphere.service;
|
||||||
|
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.FileContent;
|
||||||
|
import io.metersphere.base.domain.FileMetadata;
|
||||||
|
import io.metersphere.base.domain.LoadTestFile;
|
||||||
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
|
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
|
||||||
import io.metersphere.commons.constants.EngineType;
|
import io.metersphere.commons.constants.EngineType;
|
||||||
|
@ -9,14 +12,11 @@ import io.metersphere.controller.request.testplan.*;
|
||||||
import io.metersphere.dto.LoadTestDTO;
|
import io.metersphere.dto.LoadTestDTO;
|
||||||
import io.metersphere.engine.Engine;
|
import io.metersphere.engine.Engine;
|
||||||
import io.metersphere.engine.EngineFactory;
|
import io.metersphere.engine.EngineFactory;
|
||||||
import org.apache.commons.lang3.RandomUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -40,28 +40,6 @@ public class LoadTestService {
|
||||||
@Resource
|
@Resource
|
||||||
private FileService fileService;
|
private FileService fileService;
|
||||||
|
|
||||||
// 测试,模拟数据
|
|
||||||
@PostConstruct
|
|
||||||
public void initData() {
|
|
||||||
if (!CollectionUtils.isEmpty(loadTestMapper.selectByExample(null))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<Project> projects = projectMapper.selectByExample(null);
|
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
final LoadTestWithBLOBs loadTest = new LoadTestWithBLOBs();
|
|
||||||
loadTest.setId(UUID.randomUUID().toString());
|
|
||||||
loadTest.setName("load test " + i);
|
|
||||||
loadTest.setProjectId(projects.get(RandomUtils.nextInt(0, projects.size())).getId());
|
|
||||||
loadTest.setCreateTime(System.currentTimeMillis());
|
|
||||||
loadTest.setUpdateTime(System.currentTimeMillis());
|
|
||||||
loadTest.setScenarioDefinition(UUID.randomUUID().toString());
|
|
||||||
loadTest.setDescription(UUID.randomUUID().toString());
|
|
||||||
loadTestMapper.insert(loadTest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
|
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
|
||||||
return extLoadTestMapper.list(request);
|
return extLoadTestMapper.list(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ const en_US = {
|
||||||
project: {
|
project: {
|
||||||
'recent': 'Recent Projects',
|
'recent': 'Recent Projects',
|
||||||
'create': 'Create Project',
|
'create': 'Create Project',
|
||||||
|
'edit': 'Edit Project',
|
||||||
'delete_confirm': 'Are you sure you want to delete this project?',
|
'delete_confirm': 'Are you sure you want to delete this project?',
|
||||||
'search_by_name': 'Search by name',
|
'search_by_name': 'Search by name',
|
||||||
'input_name': 'Please enter a workspace name',
|
'input_name': 'Please enter a workspace name',
|
||||||
|
|
|
@ -42,6 +42,7 @@ const zh_CN = {
|
||||||
project: {
|
project: {
|
||||||
'recent': '最近的项目',
|
'recent': '最近的项目',
|
||||||
'create': '创建项目',
|
'create': '创建项目',
|
||||||
|
'edit': '编辑项目',
|
||||||
'delete_confirm': '这个项目确定要删除吗?',
|
'delete_confirm': '这个项目确定要删除吗?',
|
||||||
'search_by_name': '根据名称搜索',
|
'search_by_name': '根据名称搜索',
|
||||||
'input_name': '请输入项目名称',
|
'input_name': '请输入项目名称',
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-dialog :title="$t('project.create')" :visible.sync="createVisible">
|
<el-dialog :title="title" :visible.sync="createVisible">
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
||||||
<el-form-item :label="$t('commons.name')">
|
<el-form-item :label="$t('commons.name')">
|
||||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
createVisible: false,
|
createVisible: false,
|
||||||
result: {},
|
result: {},
|
||||||
btnTips: this.$t('project.create'),
|
btnTips: this.$t('project.create'),
|
||||||
|
title: this.$t('project.create'),
|
||||||
condition: "",
|
condition: "",
|
||||||
items: [],
|
items: [],
|
||||||
form: {},
|
form: {},
|
||||||
|
@ -89,7 +90,7 @@
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.$route.path.split('/')[2] === 'create') {
|
if (this.$route.path.split('/')[2] === 'create') {
|
||||||
this.createVisible = true;
|
this.create();
|
||||||
this.$router.push('/project/all');
|
this.$router.push('/project/all');
|
||||||
}
|
}
|
||||||
this.list();
|
this.list();
|
||||||
|
@ -97,7 +98,7 @@
|
||||||
watch: {
|
watch: {
|
||||||
'$route'(to) {
|
'$route'(to) {
|
||||||
if (to.path.split('/')[2] === 'create') {
|
if (to.path.split('/')[2] === 'create') {
|
||||||
this.createVisible = true;
|
this.create();
|
||||||
this.$router.push('/project/all');
|
this.$router.push('/project/all');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,10 +108,12 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
create() {
|
create() {
|
||||||
|
this.title = this.$t('project.create');
|
||||||
this.createVisible = true;
|
this.createVisible = true;
|
||||||
this.form = {};
|
this.form = {};
|
||||||
},
|
},
|
||||||
edit(row) {
|
edit(row) {
|
||||||
|
this.title = this.$t('project.edit');
|
||||||
this.createVisible = true;
|
this.createVisible = true;
|
||||||
this.form = Object.assign({}, row);
|
this.form = Object.assign({}, row);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue