This commit is contained in:
chenjianxing 2021-02-04 15:58:24 +08:00
commit 391cbf06d7
4 changed files with 81 additions and 26 deletions

View File

@ -0,0 +1,42 @@
package io.metersphere.performance.job;
import com.fit2cloud.quartz.anno.QuartzScheduled;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.LoadTestReport;
import io.metersphere.base.domain.LoadTestReportDetailExample;
import io.metersphere.base.domain.LoadTestReportExample;
import io.metersphere.base.mapper.LoadTestReportDetailMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component
public class LoadTestReportDetailCleanJob {
@Resource
private LoadTestReportDetailMapper loadTestReportDetailMapper;
@Resource
private LoadTestReportMapper loadTestReportMapper;
/**
* 每天处理一次清理任务
*/
@QuartzScheduled(cron = "0 0 1 * * ?")
public void cleanCompletedTestDetail() {
LoadTestReportExample example = new LoadTestReportExample();
example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name());
long count = loadTestReportMapper.countByExample(example);
for (int i = 0; i < count / 10; i++) {
PageHelper.startPage(i, 10);
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
loadTestReports.forEach(report -> {
// 清理文件
LoadTestReportDetailExample example2 = new LoadTestReportDetailExample();
example2.createCriteria().andReportIdEqualTo(report.getId());
loadTestReportDetailMapper.deleteByExample(example2);
});
}
}
}

View File

@ -0,0 +1,3 @@
ALTER TABLE api_scenario MODIFY COLUMN id VARCHAR (255);
ALTER TABLE test_plan_api_scenario MODIFY COLUMN api_scenario_id VARCHAR (255);
ALTER TABLE api_scenario_report MODIFY COLUMN scenario_id VARCHAR (255);

View File

@ -58,27 +58,27 @@
</template>
<script>
import MsEditConstant from "./EditConstant";
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsEditCounter from "./EditCounter";
import MsEditRandom from "./EditRandom";
import MsEditListValue from "./EditListValue";
import MsEditCsv from "./EditCsv";
import {getUUID} from "@/common/js/utils";
import MsEditConstant from "./EditConstant";
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsEditCounter from "./EditCounter";
import MsEditRandom from "./EditRandom";
import MsEditListValue from "./EditListValue";
import MsEditCsv from "./EditCsv";
import {getUUID} from "@/common/js/utils";
export default {
name: "MsVariableList",
components: {
MsEditConstant,
MsDialogFooter,
MsTableHeader,
MsTablePagination,
MsEditCounter,
MsEditRandom,
MsEditListValue,
MsEditCsv
export default {
name: "MsVariableList",
components: {
MsEditConstant,
MsDialogFooter,
MsTableHeader,
MsTablePagination,
MsEditCounter,
MsEditRandom,
MsEditListValue,
MsEditCsv
},
data() {
return {
@ -188,6 +188,8 @@ export default {
} else {
item.hidden = undefined;
}
} else {
item.hidden = undefined;
}
datas.push(item);
})
@ -202,12 +204,8 @@ export default {
}
</script>
<style scoped>
<style>
.ms-variable-hidden-row {
display: none;
}
/deep/ .el-dialog__body {
padding: 10px 10px;
}
</style>

View File

@ -54,7 +54,8 @@
import {CASE_ORDER} from "../../model/JsonData";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsBatchEdit from "../basis/BatchEdit";
import {CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
// import {CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
import {CASE_PRIORITY,API_METHOD_COLOUR, API_STATUS, REQ_METHOD, TCP_METHOD, SQL_METHOD, DUBBO_METHOD} from "../../model/JsonData";
export default {
name: 'ApiCaseList',
@ -313,6 +314,17 @@
this.$warning("请选择用例!");
return;
}
// //
if (this.currentApi.protocol == 'HTTP') {
this.valueArr.method = REQ_METHOD;
} else if (this.currentApi.protocol == 'TCP') {
this.valueArr.method = TCP_METHOD;
} else if (this.currentApi.protocol == 'SQL') {
this.valueArr.method = SQL_METHOD;
} else if (this.currentApi.protocol == 'DUBBO') {
this.valueArr.method = DUBBO_METHOD;
}
this.$refs.batchEdit.open();
},
batchEdit(form) {