This commit is contained in:
chenjianxing 2020-09-02 15:29:17 +08:00
commit d0e8cf0a49
6 changed files with 56 additions and 50 deletions

View File

@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
@ -42,8 +43,6 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@Service
@Transactional(rollbackFor = Exception.class)
public class PerformanceTestService {
@ -381,6 +380,10 @@ public class PerformanceTestService {
if (!CollectionUtils.isEmpty(loadTestFiles)) {
loadTestFiles.forEach(loadTestFile -> {
FileMetadata fileMetadata = fileService.copyFile(loadTestFile.getFileId());
if (fileMetadata == null) {
// 如果性能测试出现文件变更这里会有 null
return;
}
loadTestFile.setTestId(copy.getId());
loadTestFile.setFileId(fileMetadata.getId());
loadTestFileMapper.insert(loadTestFile);

View File

@ -60,6 +60,10 @@ public class FileService {
FileContentExample example2 = new FileContentExample();
example2.createCriteria().andFileIdIn(ids);
fileContentMapper.deleteByExample(example2);
LoadTestFileExample example3 = new LoadTestFileExample();
example3.createCriteria().andFileIdIn(ids);
loadTestFileMapper.deleteByExample(example3);
}
public FileMetadata saveFile(MultipartFile file) {

View File

@ -7,10 +7,11 @@
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200" @change="change" :placeholder="keyText" show-word-limit>
<el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200"
@change="change" :placeholder="keyText" show-word-limit>
<template v-slot:prepend>
<el-select v-if="type === 'body'" :disabled="isReadOnly" class="kv-type" v-model="item.type">
<el-option value="text" />
<el-select v-if="type === 'body'" :disabled="isReadOnly" class="kv-type" v-model="item.type">
<el-option value="text"/>
<el-option value="file"/>
</el-select>
</template>
@ -31,12 +32,12 @@
value-key="name"
highlight-first-item
@select="change">
<i slot="suffix" class="el-input__icon el-icon-edit" style="cursor: pointer;" @click="advanced(item)"></i>
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced(item)"></i>
</el-autocomplete>
</el-col>
<el-col v-if="item.type === 'file'">
<ms-api-body-file-upload :parameter="item"/>
<ms-api-body-file-upload :parameter="item"/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
@ -155,31 +156,36 @@ export default {
</script>
<style scoped>
.kv-description {
font-size: 13px;
}
.kv-description {
font-size: 13px;
}
.kv-row {
margin-top: 10px;
}
.kv-row {
margin-top: 10px;
}
.kv-delete {
width: 60px;
}
.kv-delete {
width: 60px;
}
.el-autocomplete {
width: 100%;
}
.el-autocomplete {
width: 100%;
}
.advanced-item-value >>> .el-dialog__body {
padding: 15px 25px;
}
.advanced-item-value >>> .el-dialog__body {
padding: 15px 25px;
}
.el-row {
margin-bottom: 5px;
}
.el-row {
margin-bottom: 5px;
}
.kv-type {
width: 70px;
}
.kv-type {
width: 70px;
}
.pointer {
cursor: pointer;
color: #1E90FF;
}
</style>

View File

@ -127,7 +127,7 @@ export default {
}
},
methods: {
initBreadcrumb() {
initBreadcrumb(callback) {
if (this.reportId) {
this.result = this.$get("/performance/report/test/pro/info/" + this.reportId, res => {
let data = res.data;
@ -137,6 +137,10 @@ export default {
this.testName = data.testName;
this.projectId = data.projectId;
this.projectName = data.projectName;
//
if (callback) callback(res);
} else {
this.$error(this.$t('report.not_exist'));
}
})
}
@ -280,27 +284,16 @@ export default {
}
let reportId = to.path.split('/')[4];
this.reportId = reportId;
if (reportId) {
this.$get("/performance/report/test/pro/info/" + reportId, response => {
let data = response.data;
if (data) {
this.status = data.status;
this.reportName = data.name;
this.testName = data.testName;
this.testId = data.testId;
this.projectName = data.projectName;
this.initBreadcrumb((response) => {
let data = response.data;
this.$set(this.report, "id", reportId);
this.$set(this.report, "status", data.status);
this.$set(this.report, "id", reportId);
this.$set(this.report, "status", data.status);
this.checkReportStatus(data.status);
this.initReportTimeInfo();
} else {
this.$error(this.$t('report.not_exist'));
}
});
}
this.checkReportStatus(data.status);
this.initReportTimeInfo();
});
this.initWebSocket();
} else {
console.log("close socket.");
this.websocket.close() //websocket

View File

@ -58,7 +58,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig";
import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";

View File

@ -4,7 +4,7 @@
accept=".jmx,.csv"
drag
action=""
:limit="2"
:limit="5"
multiple
:show-file-list="false"
:before-upload="beforeUpload"