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

View File

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

View File

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

View File

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

View File

@ -58,7 +58,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig";
import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig"; import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; 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 MsScheduleConfig from "../../common/components/MsScheduleConfig";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";

View File

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