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 jmxIds = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let row = rows[i];
|
||||
if (this.tableData.filter(f => f.name === row.name).length > 0) {
|
||||
this.$error(this.$t('load_test.delete_file') + ', name: ' + row.name);
|
||||
this.selectIds.clear();
|
||||
return;
|
||||
setTimeout(() => {
|
||||
this.$warning(this.$t('load_test.delete_file') + 'name: ' + row.name);
|
||||
}, 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({
|
||||
name: row.name,
|
||||
size: (row.size / 1024).toFixed(2) + ' KB',
|
||||
type: row.type.toUpperCase(),
|
||||
updateTime: row.lastModified,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.loadType === 'resource') {
|
||||
rows.forEach(row => {
|
||||
this.fileList.push(row);
|
||||
})
|
||||
this.$success(this.$t('test_track.case.import.success'));
|
||||
this.loadFileVisible = false;
|
||||
this.selectIds.clear();
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.getJmxContents();
|
||||
this.getJmxContents(jmxIds);
|
||||
},
|
||||
getJmxContents() {
|
||||
this.projectLoadingResult = this.$post('/performance/export/jmx', [...this.selectIds], (response) => {
|
||||
getJmxContents(jmxIds) {
|
||||
this.projectLoadingResult = this.$post('/performance/export/jmx', jmxIds, (response) => {
|
||||
let data = response.data;
|
||||
if (!data) {
|
||||
return;
|
||||
|
@ -195,18 +199,11 @@ export default {
|
|||
});
|
||||
let file = new File([d.jmx], d.name);
|
||||
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.$success(this.$t('test_track.case.import.success'));
|
||||
this.loadFileVisible = false;
|
||||
this.selectIds.clear();
|
||||
this.close();
|
||||
});
|
||||
},
|
||||
beforeUploadFile(file) {
|
||||
|
|
Loading…
Reference in New Issue