feat(性能测试): 编辑性能测试时选择文件保留前一页的选项

--bug=1019307 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001019307
This commit is contained in:
guoyuqi 2023-01-04 18:32:02 +08:00 committed by f2c-ci-robot[bot]
parent 48e52d6d3a
commit aad051a956
3 changed files with 45 additions and 8 deletions

View File

@ -374,10 +374,20 @@
#{id}
</foreach>
AND project_id = #{projectId,jdbcType=VARCHAR}
<if test="request.name!=null">
<if test="request.name != null">
AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%')
</if>
order by update_time DESC
<if test="request.ids != null and request.ids.size() > 0">
AND file_metadata.id NOT IN (
SELECT file_id
FROM load_test_file t
WHERE t.test_id IN
<foreach collection="request.ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
)
</if>
ORDER BY update_time DESC
</select>
<select id="selectProjectIds" resultType="java.lang.String">

View File

@ -102,11 +102,19 @@
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {findThreadGroup} from "../../../business/test/model/ThreadGroup";
import {findThreadGroup} from "@/business/test/model/ThreadGroup";
import MsTableButton from "metersphere-frontend/src/components/MsTableButton";
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
import MsTableOperatorButton from "metersphere-frontend/src/components/MsTableOperatorButton";
import {checkFileIsRelated, deleteFile, getJmxContents, getProjectFileByName, getProjectFiles, updateFile, uploadFiles} from "../../../api/performance";
import {
checkFileIsRelated,
deleteFile,
getJmxContents,
getProjectFileByName,
getProjectFiles,
updateFile,
uploadFiles
} from "@/api/performance";
export default {
name: "ExistFiles",
@ -117,6 +125,7 @@ export default {
uploadList: Array,
scenarios: Array,
isReadOnly: Boolean,
testId: String
},
inject: [
'reload'
@ -131,6 +140,7 @@ export default {
loadType: 'jmx',
existFiles: [],
selectIds: new Set,
selectFiles: [],
condition: {},
projectId: getCurrentProjectID()
};
@ -144,16 +154,23 @@ export default {
close() {
this.loadFileVisible = false;
this.selectIds.clear();
this.selectFiles = [];
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.existFiles.forEach(item => {
this.selectIds.add(item.id);
this.selectFiles.push(item);
});
} else {
this.existFiles.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
for (let i = 0; i < this.selectFiles.length - 1; i++) {
if (this.selectFiles[i].id === item.id) {
this.selectFiles.splice(i, 1);
}
}
}
});
}
@ -161,11 +178,21 @@ export default {
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
for (let i = 0; i < this.selectFiles.length - 1; i++) {
if (this.selectFiles[i].id === row.id) {
this.selectFiles.splice(i, 1);
}
}
} else {
this.selectIds.add(row.id);
this.selectFiles.push(row);
}
},
getProjectFiles() {
if (this.testId) {
this.condition.ids = [];
this.condition.ids.push(this.testId);
}
this.loading = getProjectFiles(this.loadType, this.projectId, this.currentPage, this.pageSize, this.condition)
.then(res => {
let data = res.data;
@ -176,6 +203,7 @@ export default {
handleImport(file) {
if (file) { //
this.selectIds.add(file.id);
this.selectFiles.push(file)
this.getJmxContents();
return;
}
@ -183,11 +211,9 @@ export default {
this.loadFileVisible = false;
return;
}
let rows = this.existFiles.filter(f => this.selectIds.has(f.id));
let jmxIds = [];
for (let i = 0; i < rows.length; i++) {
let row = rows[i];
for (let i = 0; i < this.selectFiles.length; i++) {
let row = this.selectFiles[i];
if (this.tableData.filter(f => f.name === row.name).length > 0) {
setTimeout(() => {
this.$warning(this.$t('load_test.delete_file') + 'name: ' + row.name);

View File

@ -110,6 +110,7 @@
<exist-files ref="existFiles"
@fileChange="fileChange"
:test-id="test.id"
:file-list="fileList"
:table-data="tableData"
:upload-list="uploadList"