From 0f1676166cd1dcb1f1b2f7af22d501efd9fbb91f Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 30 Mar 2021 14:52:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E8=BF=87=E7=9F=AD=E5=AF=BC=E8=87=B4=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=BC=95=E5=85=A5=EF=BC=8C=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=BC=B9=E6=A1=86=E6=8F=90=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V79__v1.8.1_release.sql | 2 + .../test/components/ExistFiles.vue | 41 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V79__v1.8.1_release.sql diff --git a/backend/src/main/resources/db/migration/V79__v1.8.1_release.sql b/backend/src/main/resources/db/migration/V79__v1.8.1_release.sql new file mode 100644 index 0000000000..db9b4273a0 --- /dev/null +++ b/backend/src/main/resources/db/migration/V79__v1.8.1_release.sql @@ -0,0 +1,2 @@ +ALTER TABLE file_metadata + MODIFY name VARCHAR(250) NOT NULL COMMENT 'File name'; \ No newline at end of file diff --git a/frontend/src/business/components/performance/test/components/ExistFiles.vue b/frontend/src/business/components/performance/test/components/ExistFiles.vue index bcecb0713c..e264843c2b 100644 --- a/frontend/src/business/components/performance/test/components/ExistFiles.vue +++ b/frontend/src/business/components/performance/test/components/ExistFiles.vue @@ -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); + } + 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.tableData.push({ - name: row.name, - size: (row.size / 1024).toFixed(2) + ' KB', - type: row.type.toUpperCase(), - updateTime: row.lastModified, - }); }) 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) {