fix: 修复文件名过短导致场景无法引入,文件重复弹框提示优化
This commit is contained in:
parent
b54ed5c92e
commit
0f1676166c
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE file_metadata
|
||||||
|
MODIFY name VARCHAR(250) NOT NULL COMMENT 'File name';
|
|
@ -154,35 +154,39 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
let rows = this.existFiles.filter(f => this.selectIds.has(f.id));
|
let rows = this.existFiles.filter(f => this.selectIds.has(f.id));
|
||||||
|
let jmxIds = [];
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
let row = rows[i];
|
let row = rows[i];
|
||||||
if (this.tableData.filter(f => f.name === row.name).length > 0) {
|
if (this.tableData.filter(f => f.name === row.name).length > 0) {
|
||||||
this.$error(this.$t('load_test.delete_file') + ', name: ' + row.name);
|
setTimeout(() => {
|
||||||
this.selectIds.clear();
|
this.$warning(this.$t('load_test.delete_file') + 'name: ' + row.name);
|
||||||
return;
|
}, 100);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (row.type.toUpperCase() === 'JMX') {
|
||||||
|
jmxIds.push(row.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.loadType === 'resource') {
|
|
||||||
rows.forEach(row => {
|
|
||||||
this.fileList.push(row);
|
|
||||||
this.tableData.push({
|
this.tableData.push({
|
||||||
name: row.name,
|
name: row.name,
|
||||||
size: (row.size / 1024).toFixed(2) + ' KB',
|
size: (row.size / 1024).toFixed(2) + ' KB',
|
||||||
type: row.type.toUpperCase(),
|
type: row.type.toUpperCase(),
|
||||||
updateTime: row.lastModified,
|
updateTime: row.lastModified,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.loadType === 'resource') {
|
||||||
|
rows.forEach(row => {
|
||||||
|
this.fileList.push(row);
|
||||||
})
|
})
|
||||||
this.$success(this.$t('test_track.case.import.success'));
|
this.$success(this.$t('test_track.case.import.success'));
|
||||||
this.loadFileVisible = false;
|
this.close();
|
||||||
this.selectIds.clear();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getJmxContents();
|
this.getJmxContents(jmxIds);
|
||||||
},
|
},
|
||||||
getJmxContents() {
|
getJmxContents(jmxIds) {
|
||||||
this.projectLoadingResult = this.$post('/performance/export/jmx', [...this.selectIds], (response) => {
|
this.projectLoadingResult = this.$post('/performance/export/jmx', jmxIds, (response) => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
|
@ -195,18 +199,11 @@ export default {
|
||||||
});
|
});
|
||||||
let file = new File([d.jmx], d.name);
|
let file = new File([d.jmx], d.name);
|
||||||
this.uploadList.push(file);
|
this.uploadList.push(file);
|
||||||
this.tableData.push({
|
|
||||||
name: file.name,
|
|
||||||
size: (file.size / 1024).toFixed(2) + ' KB',
|
|
||||||
type: 'JMX',
|
|
||||||
updateTime: file.lastModified,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$emit('fileChange', this.scenarios);
|
this.$emit('fileChange', this.scenarios);
|
||||||
this.$success(this.$t('test_track.case.import.success'));
|
this.$success(this.$t('test_track.case.import.success'));
|
||||||
this.loadFileVisible = false;
|
this.close();
|
||||||
this.selectIds.clear();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
beforeUploadFile(file) {
|
beforeUploadFile(file) {
|
||||||
|
|
Loading…
Reference in New Issue