This commit is contained in:
chenjianxing 2020-04-08 15:42:30 +08:00
commit 54201699a4
8 changed files with 156 additions and 77 deletions

View File

@ -344,8 +344,13 @@ public class JtlResolver {
failSize++; failSize++;
} }
} }
// todo
timeList.add(entry.getKey()); try {
timeList.add(formatDate(entry.getKey()));
} catch (ParseException e) {
e.printStackTrace();
}
hits.add(decimalFormat.format(metrics.size() * 1.0 / maxUsers)); hits.add(decimalFormat.format(metrics.size() * 1.0 / maxUsers));
users.add(String.valueOf(maxUsers)); users.add(String.valueOf(maxUsers));
errors.add(String.valueOf(failSize)); errors.add(String.valueOf(failSize));
@ -357,7 +362,7 @@ public class JtlResolver {
resultMap.put("errors", errors); resultMap.put("errors", errors);
JSONObject serices = new JSONObject(resultMap); JSONObject serices = new JSONObject(resultMap);
data.setxAxis(StringUtils.join(",", timeList)); data.setxAxis(String.join(",", timeList));
data.setSerices(serices.toString()); data.setSerices(serices.toString());
return data; return data;
@ -384,7 +389,13 @@ public class JtlResolver {
Map<String, List<Metric>> metricsMap = metricList.stream().collect(Collectors.groupingBy(Metric::getThreadName)); Map<String, List<Metric>> metricsMap = metricList.stream().collect(Collectors.groupingBy(Metric::getThreadName));
int maxUsers = metricsMap.size(); int maxUsers = metricsMap.size();
int sumElapsedTime = metricList.stream().mapToInt(metric -> Integer.parseInt(metric.getElapsed())).sum(); int sumElapsedTime = metricList.stream().mapToInt(metric -> Integer.parseInt(metric.getElapsed())).sum();
timestampList.add(entry.getKey());
try {
timestampList.add(formatDate(entry.getKey()));
} catch (ParseException e) {
e.printStackTrace();
}
users.add(String.valueOf(maxUsers)); users.add(String.valueOf(maxUsers));
resTimeList.add(String.valueOf(sumElapsedTime / metricList.size())); resTimeList.add(String.valueOf(sumElapsedTime / metricList.size()));
} }
@ -393,7 +404,7 @@ public class JtlResolver {
resultMap.put("users", users); resultMap.put("users", users);
resultMap.put("resTime", resTimeList); resultMap.put("resTime", resTimeList);
JSONObject serices = new JSONObject(resultMap); JSONObject serices = new JSONObject(resultMap);
chartsData.setxAxis(StringUtils.join(",", timestampList)); chartsData.setxAxis(String.join(",", timestampList));
chartsData.setSerices(serices.toString()); chartsData.setSerices(serices.toString());
return chartsData; return chartsData;
} }
@ -405,6 +416,16 @@ public class JtlResolver {
return simpleDateFormat.format(date); return simpleDateFormat.format(date);
} }
/**
* @param "yyyy-MM-dd HH:mm:ss"
* @return "HH:mm:ss"
*/
private static String formatDate(String dateString) throws ParseException {
SimpleDateFormat before = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat after = new SimpleDateFormat("HH:mm:ss");
return after.format(before.parse(dateString));
}
private static int sortByDate(Map.Entry<String, List<Metric>> map1, Map.Entry<String, List<Metric>> map2) { private static int sortByDate(Map.Entry<String, List<Metric>> map1, Map.Entry<String, List<Metric>> map2) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date1 = null, date2 = null; Date date1 = null, date2 = null;

View File

@ -10,10 +10,12 @@ import io.metersphere.base.mapper.TestResourcePoolMapper;
import io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper; import io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper;
import io.metersphere.commons.constants.ResourcePoolTypeEnum; import io.metersphere.commons.constants.ResourcePoolTypeEnum;
import io.metersphere.commons.constants.ResourceStatusEnum; import io.metersphere.commons.constants.ResourceStatusEnum;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest; import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.NodeDTO; import io.metersphere.dto.NodeDTO;
import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.engine.kubernetes.provider.KubernetesProvider; import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
import io.metersphere.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -25,6 +27,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
import static io.metersphere.commons.constants.ResourceStatusEnum.VALID; import static io.metersphere.commons.constants.ResourceStatusEnum.VALID;
@ -81,10 +84,20 @@ public class TestResourcePoolService {
private void validateNodes(TestResourcePoolDTO testResourcePool) { private void validateNodes(TestResourcePoolDTO testResourcePool) {
if (CollectionUtils.isEmpty(testResourcePool.getResources())) { if (CollectionUtils.isEmpty(testResourcePool.getResources())) {
throw new RuntimeException("没有节点信息"); MSException.throwException(Translator.get("no_nodes_message"));
} }
deleteTestResource(testResourcePool.getId()); deleteTestResource(testResourcePool.getId());
List<String> nodeIps = testResourcePool.getResources().stream()
.map(resource -> {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
return nodeDTO.getIp();
})
.distinct()
.collect(Collectors.toList());
if (nodeIps.size() < testResourcePool.getResources().size()) {
MSException.throwException(Translator.get("duplicate_node_ip"));
}
for (TestResource resource : testResourcePool.getResources()) { for (TestResource resource : testResourcePool.getResources()) {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class); NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
boolean isValidate = validateNode(nodeDTO); boolean isValidate = validateNode(nodeDTO);
@ -112,7 +125,7 @@ public class TestResourcePoolService {
private void validateK8s(TestResourcePoolDTO testResourcePool) { private void validateK8s(TestResourcePoolDTO testResourcePool) {
if (CollectionUtils.isEmpty(testResourcePool.getResources()) || testResourcePool.getResources().size() != 1) { if (CollectionUtils.isEmpty(testResourcePool.getResources()) || testResourcePool.getResources().size() != 1) {
throw new RuntimeException("只能添加一个 K8s"); throw new RuntimeException(Translator.get("only_one_k8s"));
} }
TestResource testResource = testResourcePool.getResources().get(0); TestResource testResource = testResourcePool.getResources().get(0);

View File

@ -14,5 +14,8 @@
"run_load_test_file_content_not_found": "Cannot run test, cannot get test file content, test ID:", "run_load_test_file_content_not_found": "Cannot run test, cannot get test file content, test ID:",
"run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:", "run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:",
"load_test_is_running": "Load test is running, please wait.", "load_test_is_running": "Load test is running, please wait.",
"node_deep_limit": "The node depth does not exceed 5 layers!" "node_deep_limit": "The node depth does not exceed 5 layers!",
"no_nodes_message": "No node message",
"duplicate_node_ip": "Duplicate IPs",
"only_one_k8s": "Only one K8s can be added"
} }

View File

@ -14,5 +14,8 @@
"run_load_test_file_content_not_found": "无法运行测试无法获取测试文件内容测试ID", "run_load_test_file_content_not_found": "无法运行测试无法获取测试文件内容测试ID",
"run_load_test_file_init_error": "无法运行测试初始化运行环境失败测试ID", "run_load_test_file_init_error": "无法运行测试初始化运行环境失败测试ID",
"load_test_is_running": "测试正在运行, 请等待", "load_test_is_running": "测试正在运行, 请等待",
"node_deep_limit": "节点深度不超过5层" "node_deep_limit": "节点深度不超过5层",
"no_nodes_message": "没有节点信息",
"duplicate_node_ip": "节点 IP 重复",
"only_one_k8s": "只能添加一个 K8s"
} }

View File

@ -70,7 +70,7 @@
width="150" width="150"
: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-s-data" 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-delete" size="mini" circle/>
</template> </template>
</el-table-column> </el-table-column>

View File

@ -1,30 +1,31 @@
<template> <template>
<div v-loading="loading"> <div v-loading="result.loading">
<el-card> <el-card>
<template v-slot:header> <template v-slot:header>
<div> <div>
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">测试资源池 <span class="title">{{$t('commons.test_resource_pool')}}
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" :placeholder="$t('test_resource_pool.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60" v-model="condition" @change="search" clearable/> maxlength="60" v-model="condition" @change="search" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
</template> </template>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
<el-table-column prop="name" label="名称"/> <el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" label="描述"/> <el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column prop="type" label="类型"> <el-table-column prop="type" :label="$t('test_resource_pool.type')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span v-if="scope.row.type === 'NODE'">独立节点</span> <span v-if="scope.row.type === 'NODE'">Single Docker</span>
<span v-if="scope.row.type === 'K8S'">Kubernetes</span> <span v-if="scope.row.type === 'K8S'">Kubernetes</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="启用/禁用"> <el-table-column prop="status" :label="$t('test_resource_pool.enable_disable')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-switch v-model="scope.row.status" <el-switch v-model="scope.row.status"
active-color="#13ce66" active-color="#13ce66"
@ -35,12 +36,12 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="创建时间" width="180"> <el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="updateTime" label="更新时间" width="180"> <el-table-column prop="updateTime" :label="$t('commons.update_time')" width="180">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template> </template>
@ -71,20 +72,24 @@
</div> </div>
</el-card> </el-card>
<el-dialog title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc" <el-dialog v-loading="result.loading"
:title="$t('test_resource_pool.create_resource_pool')"
:visible.sync="createVisible" width="70%"
@closed="closeFunc"
:destroy-on-close="true"> :destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="createTestResourcePoolForm"> ref="createTestResourcePoolForm">
<el-form-item label="名称" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="description"> <el-form-item :label="$t('commons.description')" prop="description">
<el-input v-model="form.description" autocomplete="off"/> <el-input v-model="form.description" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="资源类型" prop="type"> <el-form-item :label="$t('test_resource_pool.type')" prop="type">
<el-select v-model="form.type" placeholder="选择资源类型" @change="changeResourceType()"> <el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
@change="changeResourceType()">
<el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option> <el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option>
<el-option key="NODE" value="NODE" label="独立节点">独立节点</el-option> <el-option key="NODE" value="NODE" label="Node">Single Docker</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<div v-for="(item,index) in infoList " :key="index"> <div v-for="(item,index) in infoList " :key="index">
@ -103,7 +108,7 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数"> <el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -120,7 +125,7 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数"> <el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -143,25 +148,29 @@
<template v-slot:footer> <template v-slot:footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="createTestResourcePool('createTestResourcePoolForm')" <el-button type="primary" @click="createTestResourcePool('createTestResourcePoolForm')"
size="medium">创建</el-button> size="medium">{{$t('commons.create')}}</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true" <el-dialog
@close="closeFunc"> v-loading="result.loading"
:title="$t('test_resource_pool.update_resource_pool')" :visible.sync="updateVisible" width="70%"
:destroy-on-close="true"
@close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="updateTestResourcePoolForm"> ref="updateTestResourcePoolForm">
<el-form-item label="名称" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="description"> <el-form-item :label="$t('commons.description')" prop="description">
<el-input v-model="form.description" autocomplete="off"/> <el-input v-model="form.description" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="资源类型" prop="type"> <el-form-item :label="$t('test_resource_pool.type')" prop="type">
<el-select v-model="form.type" placeholder="选择资源类型" @change="changeResourceType()"> <el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
@change="changeResourceType()">
<el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option> <el-option key="K8S" value="K8S" label="Kubernetes">Kubernetes</el-option>
<el-option key="NODE" value="NODE" label="独立节点">独立节点</el-option> <el-option key="NODE" value="NODE" label="Node">Single Docker</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<div v-for="(item,index) in infoList " :key="index"> <div v-for="(item,index) in infoList " :key="index">
@ -177,7 +186,8 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数" style="padding-left: 20px"> <el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -194,7 +204,8 @@
</el-form-item> </el-form-item>
</div> </div>
<div style="width: 30%;float: left"> <div style="width: 30%;float: left">
<el-form-item prop="maxConcurrency" label="最大并发数" style="padding-left: 20px"> <el-form-item prop="maxConcurrency" :label="$t('test_resource_pool.max_threads')"
style="padding-left: 20px">
<el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number> <el-input-number v-model="item.maxConcurrency" :min="1" :max="9999"></el-input-number>
</el-form-item> </el-form-item>
</div> </div>
@ -216,7 +227,7 @@
<template v-slot:footer> <template v-slot:footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')" <el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')"
size="medium">修改</el-button> size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
@ -232,14 +243,14 @@
components: {MsCreateBox}, components: {MsCreateBox},
data() { data() {
return { return {
loading: false, result: {},
testLoading: false, testLoading: false,
createVisible: false, createVisible: false,
infoList: [], infoList: [],
updateVisible: false, updateVisible: false,
btnTips: "添加资源池", btnTips: this.$t('test_resource_pool.create_resource_pool'),
btnTipsAdd: "添加", btnTipsAdd: this.$t("commons.add"),
btnTipsDel: "删除", btnTipsDel: this.$t("commons.delete"),
queryPath: "testresourcepool/list", queryPath: "testresourcepool/list",
condition: "", condition: "",
items: [], items: [],
@ -249,20 +260,20 @@
form: {}, form: {},
rule: { rule: {
name: [ name: [
{required: true, message: '请输入资源池名称', trigger: 'blur'}, {required: true, message: this.$t('test_resource_pool.input_pool_name'), trigger: 'blur'},
{min: 2, max: 64, message: this.$t('commons.input_limit', [2, 64]), trigger: 'blur'}, {min: 2, max: 64, message: this.$t('commons.input_limit', [2, 64]), trigger: 'blur'},
{ {
required: true, required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/, pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: '资源池名称不支持特殊字符', message: this.$t('test_resource_pool.pool_name_valid'),
trigger: 'blur' trigger: 'blur'
} }
], ],
description: [ description: [
{max: 60, message: '最大长度 60 个字符', trigger: 'blur'} {max: 60, message: this.$t('commons.input_limit', [0, 60]), trigger: 'blur'}
], ],
type: [ type: [
{required: true, message: '请选择资源类型', trigger: 'blur'} {required: true, message: this.$t('test_resource_pool.select_pool_type'), trigger: 'blur'}
] ]
} }
} }
@ -298,16 +309,16 @@
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
message: "不能删除所有独立节点" message: this.$t('test_resource_pool.cannot_remove_all_node')
}); });
} }
}, },
validateResourceInfo() { validateResourceInfo() {
if (this.infoList.length <= 0) { if (this.infoList.length <= 0) {
return {validate: false, msg: "资源池不能为空"} return {validate: false, msg: this.$t('test_resource_pool.cannot_empty')}
} }
let resultValidate = {validate: true, msg: "请完善数据"} let resultValidate = {validate: true, msg: this.$t('test_resource_pool.fill_the_data')};
this.infoList.forEach(function (info) { this.infoList.forEach(function (info) {
for (let key in info) { for (let key in info) {
if (info[key] != '0' && !info[key]) { if (info[key] != '0' && !info[key]) {
@ -355,12 +366,12 @@
}, },
del(row) { del(row) {
window.console.log(row); window.console.log(row);
this.$confirm('此操作将永久删除该资源池, 是否继续?', '提示', { this.$confirm(this.$t('test_resource_pool.delete_prompt'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'), cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$get(`/testresourcepool/delete/${row.id}`).then(() => { this.result = this.$get(`/testresourcepool/delete/${row.id}`).then(() => {
this.initTableData(); this.initTableData();
}); });
this.$message({ this.$message({
@ -381,16 +392,15 @@
if (vri.validate) { if (vri.validate) {
this.testLoading = true; this.testLoading = true;
this.convertSubmitResources(); this.convertSubmitResources();
this.$post("/testresourcepool/add", this.form) this.result = this.$post("/testresourcepool/add", this.form, () => {
.then(() => { this.$message({
this.$message({ type: 'success',
type: 'success', message: this.$t('commons.save_success')
message: '添加成功!' },
}, this.createVisible = false,
this.createVisible = false, this.initTableData());
this.initTableData()); this.testLoading = false;
this.testLoading = false; });
});
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
@ -424,17 +434,16 @@
let vri = this.validateResourceInfo(); let vri = this.validateResourceInfo();
if (vri.validate) { if (vri.validate) {
this.convertSubmitResources(); this.convertSubmitResources();
this.$post("/testresourcepool/update", this.form) this.result = this.$post("/testresourcepool/update", this.form, () => {
.then(() => { this.$message({
this.$message({ type: 'success',
type: 'success', message: this.$t('commons.modify_success')
message: this.$t('commons.modify_success') },
}, this.updateVisible = false,
this.updateVisible = false, this.initTableData(),
this.initTableData(), self.loading = false);
self.loading = false); this.testLoading = false;
this.testLoading = false; });
});
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
@ -452,10 +461,10 @@
this.form = {}; this.form = {};
}, },
changeSwitch(row) { changeSwitch(row) {
this.$post('/testresourcepool/update', row).then(() => { this.result = this.$post('/testresourcepool/update', row).then(() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '状态修改成功!' message: this.$t('test_resource_pool.status_change_success')
}); });
}) })
} }

View File

@ -237,6 +237,22 @@ export default {
'select_execute_result': 'Select execute result', 'select_execute_result': 'Select execute result',
'save': 'Save' 'save': 'Save'
}, },
test_resource_pool: {
'type': 'type',
'enable_disable': 'Enable / disable',
'search_by_name': 'Search by name',
'create_resource_pool': 'Create resource pool',
'update_resource_pool': 'Create resource pool',
'select_pool_type': 'Select resource type',
'max_threads': 'Maximum concurrent number',
'input_pool_name': 'Please enter the resource pool name',
'pool_name_valid': 'Resource pool name does not support special characters',
'cannot_remove_all_node': 'Cannot delete all independent nodes',
'cannot_empty': 'Resource pool cannot be empty',
'fill_the_data': 'Please complete the data',
'delete_prompt': 'This operation will permanently delete the resource pool, continue?',
'status_change_success': 'Successfully changed the status!',
},
i18n: { i18n: {
'home': 'Home' 'home': 'Home'
} }

View File

@ -224,7 +224,6 @@ export default {
'plan_status_completed': '已完成', 'plan_status_completed': '已完成',
'delete_module_confirm': '确认删除模块: ', 'delete_module_confirm': '确认删除模块: ',
'delete_module_resource': '以及模块下所有子模块和测试用例', 'delete_module_resource': '以及模块下所有子模块和测试用例',
'relevance_test_case': '关联测试用例', 'relevance_test_case': '关联测试用例',
'executor': '执行人', 'executor': '执行人',
'execute_result': '执行结果', 'execute_result': '执行结果',
@ -237,7 +236,22 @@ export default {
'step_result': '步骤执行结果', 'step_result': '步骤执行结果',
'select_execute_result': '选择执行结果', 'select_execute_result': '选择执行结果',
'save': '保 存' 'save': '保 存'
},
test_resource_pool: {
'type': '类型',
'enable_disable': '启用/禁用',
'search_by_name': '根据名称搜索',
'create_resource_pool': '创建资源池',
'update_resource_pool': '修改资源池',
'select_pool_type': '选择资源类型',
'max_threads': '最大并发数',
'input_pool_name': '请输入资源池名称',
'pool_name_valid': '资源池名称不支持特殊字符',
'cannot_remove_all_node': '不能删除所有独立节点',
'cannot_empty': '资源池不能为空',
'fill_the_data': '请完善数据',
'delete_prompt': '此操作将永久删除该资源池, 是否继续?',
'status_change_success': '状态修改成功!',
}, },
i18n: { i18n: {
'home': '首页' 'home': '首页'