Merge remote-tracking branch 'origin/v1.0' into v1.0

This commit is contained in:
wenyann 2020-07-07 16:31:56 +08:00
commit b852fe7457
5 changed files with 29 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiTestFileMapper; import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.ApiTestMapper; import io.metersphere.base.mapper.ApiTestMapper;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.ext.ExtApiTestMapper; import io.metersphere.base.mapper.ext.ExtApiTestMapper;
import io.metersphere.commons.constants.APITestStatus; import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
@ -46,6 +47,8 @@ public class APITestService {
private JMeterService jMeterService; private JMeterService jMeterService;
@Resource @Resource
private APIReportService apiReportService; private APIReportService apiReportService;
@Resource
private TestCaseMapper testCaseMapper;
public List<APITestResult> list(QueryAPITestRequest request) { public List<APITestResult> list(QueryAPITestRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
@ -110,6 +113,20 @@ public class APITestService {
} }
public void delete(String testId) { public void delete(String testId) {
// 是否关联测试用例
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andTestIdEqualTo(testId);
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
if (testCases.size() > 0) {
String caseName = "";
for (int i = 0; i < testCases.size(); i++) {
caseName = caseName + testCases.get(i).getName() + ",";
}
caseName = caseName.substring(0, caseName.length() - 1);
MSException.throwException(Translator.get("related_case_del_fail_prefix") + caseName + Translator.get("related_case_del_fail_suffix"));
}
deleteFileByTestId(testId); deleteFileByTestId(testId);
apiReportService.deleteByTestId(testId); apiReportService.deleteByTestId(testId);
apiTestMapper.deleteByPrimaryKey(testId); apiTestMapper.deleteByPrimaryKey(testId);

View File

@ -131,12 +131,15 @@
let transactions = data.reduce(function (total, currentValue) { let transactions = data.reduce(function (total, currentValue) {
return total + parseFloat(currentValue.transactions); return total + parseFloat(currentValue.transactions);
}, 0); }, 0);
transactions = transactions.toFixed(2);
let received = data.reduce(function (total, currentValue) { let received = data.reduce(function (total, currentValue) {
return total + parseFloat(currentValue.received); return total + parseFloat(currentValue.received);
}, 0); }, 0);
received = received.toFixed(2);
let sent = data.reduce(function (total, currentValue) { let sent = data.reduce(function (total, currentValue) {
return total + parseFloat(currentValue.sent); return total + parseFloat(currentValue.sent);
}, 0); }, 0);
sent = sent.toFixed(2);
let error = (Math.round(failSize / allSamples * 10000) / 100) + '%'; let error = (Math.round(failSize / allSamples * 10000) / 100) + '%';
let averageTime = (averageTimeTotal / allSamples).toFixed(2); let averageTime = (averageTimeTotal / allSamples).toFixed(2);

View File

@ -39,7 +39,7 @@
</el-card> </el-card>
</ms-main-container> </ms-main-container>
<el-dialog :title="title" :visible.sync="createVisible"> <el-dialog :title="title" :visible.sync="createVisible" destroy-on-close>
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>

View File

@ -162,7 +162,7 @@
</el-dialog> </el-dialog>
<!--Modify user information in system settings--> <!--Modify user information in system settings-->
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" <el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="35%" :destroy-on-close="true"
@close="handleClose"> @close="handleClose">
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">

View File

@ -355,6 +355,13 @@
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
if (this.operationType == 'add' && this.isCreateContinue) { if (this.operationType == 'add' && this.isCreateContinue) {
this.form.name = ''; this.form.name = '';
this.form.prerequisite = '';
this.form.steps = [{
num: 1,
desc: '',
result: ''
}];
this.form.remark = '';
this.$emit("refresh"); this.$emit("refresh");
return; return;
} }