Merge branch 'master' of https://github.com/metersphere/server
This commit is contained in:
commit
1f39b8fe4a
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum ReportKeys {
|
||||
LoadChart, ResponseTimeChart, Errors, ErrorsTop5, RequestStatistics, Overview, TimeInfo
|
||||
LoadChart, ResponseTimeChart, Errors, ErrorsTop5, RequestStatistics, Overview, TimeInfo, ResultStatus
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,7 @@ import io.metersphere.base.mapper.*;
|
|||
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtLoadTestReportDetailMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.constants.ScheduleType;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
|
@ -281,6 +278,13 @@ public class PerformanceTestService {
|
|||
loadTestReportDetailMapper.insertSelective(reportDetail);
|
||||
// append \n
|
||||
extLoadTestReportDetailMapper.appendLine(testReport.getId(), "\n");
|
||||
// 保存一个 reportStatus
|
||||
LoadTestReportResult reportResult = new LoadTestReportResult();
|
||||
reportResult.setId(UUID.randomUUID().toString());
|
||||
reportResult.setReportId(testReport.getId());
|
||||
reportResult.setReportKey(ReportKeys.ResultStatus.name());
|
||||
reportResult.setReportValue("Ready"); // 初始化一个 result_status, 这个值用在data-streaming中
|
||||
loadTestReportResultMapper.insertSelective(reportResult);
|
||||
} catch (MSException e) {
|
||||
LogUtil.error(e);
|
||||
loadTest.setStatus(PerformanceTestStatus.Error.name());
|
||||
|
|
|
@ -25,11 +25,10 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ReportService {
|
||||
|
@ -154,11 +153,7 @@ public class ReportService {
|
|||
public void checkReportStatus(String reportId) {
|
||||
LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||
String reportStatus = loadTestReport.getStatus();
|
||||
if (StringUtils.equals(PerformanceTestStatus.Running.name(), reportStatus)) {
|
||||
MSException.throwException("Reporting in progress...");
|
||||
} else if (StringUtils.equals(PerformanceTestStatus.Reporting.name(), reportStatus)) {
|
||||
MSException.throwException("Reporting in progress...");
|
||||
} else if (StringUtils.equals(PerformanceTestStatus.Error.name(), reportStatus)) {
|
||||
if (StringUtils.equals(PerformanceTestStatus.Error.name(), reportStatus)) {
|
||||
MSException.throwException("Report generation error!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,11 +136,7 @@
|
|||
this.$warning(this.$t('report.start_status'));
|
||||
break;
|
||||
case 'Reporting':
|
||||
this.$info(this.$t('report.being_generated'));
|
||||
break;
|
||||
case 'Running':
|
||||
this.$warning(this.$t('report.run_status'));
|
||||
break;
|
||||
case 'Completed':
|
||||
default:
|
||||
break;
|
||||
|
@ -165,7 +161,7 @@
|
|||
this.$set(this.report, "id", this.reportId);
|
||||
this.$set(this.report, "status", data.status);
|
||||
this.checkReportStatus(data.status);
|
||||
if (this.status === "Completed") {
|
||||
if (this.status === "Completed" || this.status === "Running") {
|
||||
this.initReportTimeInfo();
|
||||
}
|
||||
})
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
handler(val) {
|
||||
let status = val.status;
|
||||
this.id = val.id;
|
||||
if (status === "Completed") {
|
||||
if (status === "Completed" || status === "Running") {
|
||||
this.initTableData();
|
||||
} else {
|
||||
this.tableData = [];
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
handler(val) {
|
||||
let status = val.status;
|
||||
this.id = val.id;
|
||||
if (status === "Completed") {
|
||||
if (status === "Completed" || status === "Running") {
|
||||
this.getResource();
|
||||
} else {
|
||||
this.resource = [];
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
handler(val){
|
||||
let status = val.status;
|
||||
this.id = val.id;
|
||||
if (status === "Completed") {
|
||||
if (status === "Completed" || status === "Running") {
|
||||
this.initTableData();
|
||||
} else {
|
||||
this.tableData = [];
|
||||
|
|
|
@ -327,7 +327,7 @@
|
|||
handler(val) {
|
||||
let status = val.status;
|
||||
this.id = val.id;
|
||||
if (status === "Completed") {
|
||||
if (status === "Completed" || status === "Running") {
|
||||
this.initTableData();
|
||||
} else {
|
||||
this.maxUsers = '0';
|
||||
|
|
|
@ -151,11 +151,7 @@
|
|||
this.$warning(this.$t('report.start_status'));
|
||||
break;
|
||||
case 'Reporting':
|
||||
this.$info(this.$t('report.being_generated'));
|
||||
break;
|
||||
case 'Running':
|
||||
this.$warning(this.$t('report.run_status'));
|
||||
break;
|
||||
case 'Completed':
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue