fix(测试跟踪): 修复功能用例附件上传的问题
--bug=1015099 --user=宋昌昌 【测试跟踪】功能用例附件-上传附件文件过程中,删除了上面已传完成的一个附件,然后这个文件也被删除了,重新上传后如视频中所示异常 https://www.tapd.cn/55049933/s/1206058
This commit is contained in:
parent
98f0c6b623
commit
f8a132e9b3
|
@ -48,6 +48,7 @@ public class AttachmentController {
|
||||||
return ResponseEntity.ok()
|
return ResponseEntity.ok()
|
||||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(fileOperationRequest.getName(), StandardCharsets.UTF_8) + "\"")
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(fileOperationRequest.getName(), StandardCharsets.UTF_8) + "\"")
|
||||||
|
.contentLength(bytes.length)
|
||||||
.body(bytes);
|
.body(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,9 +297,19 @@ export default {
|
||||||
progress = 100;
|
progress = 100;
|
||||||
param.onSuccess(response);
|
param.onSuccess(response);
|
||||||
progressCallback({progress, status: 'success'});
|
progressCallback({progress, status: 'success'});
|
||||||
|
self.cancelFileToken.forEach((token, index, array)=>{
|
||||||
|
if(token.name == file.name){
|
||||||
|
array.splice(token,1)
|
||||||
|
}
|
||||||
|
})
|
||||||
}).catch(error => { // 失败回调
|
}).catch(error => { // 失败回调
|
||||||
progress = 100;
|
progress = 100;
|
||||||
progressCallback({progress, status: 'error'});
|
progressCallback({progress, status: 'error'});
|
||||||
|
self.cancelFileToken.forEach((token, index, array)=>{
|
||||||
|
if(token.name == file.name){
|
||||||
|
array.splice(token,1)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showProgress(file, params) {
|
showProgress(file, params) {
|
||||||
|
@ -329,8 +339,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleDelete(file, index) {
|
handleDelete(file, index) {
|
||||||
this.$alert(this.$t('load_test.delete_file_confirm') + file.name + "?", '', {
|
this.$alert((this.cancelFileToken.length > 0 ? this.$t('load_test.delete_file_when_uploading') + '<br/>': "") + this.$t('load_test.delete_file_confirm') + file.name + "?", '', {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
this._handleDelete(file, index);
|
this._handleDelete(file, index);
|
||||||
|
@ -339,6 +350,12 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_handleDelete(file, index) {
|
_handleDelete(file, index) {
|
||||||
|
// 中断所有正在上传的文件
|
||||||
|
if (this.cancelFileToken && this.cancelFileToken.length >= 1) {
|
||||||
|
this.cancelFileToken.forEach(cacelToken => {
|
||||||
|
cacelToken.cancelFunc();
|
||||||
|
})
|
||||||
|
}
|
||||||
this.fileList.splice(index, 1);
|
this.fileList.splice(index, 1);
|
||||||
this.tableData.splice(index, 1);
|
this.tableData.splice(index, 1);
|
||||||
this.$get('/attachment/delete/testcase/' + file.id , response => {
|
this.$get('/attachment/delete/testcase/' + file.id , response => {
|
||||||
|
|
|
@ -683,9 +683,19 @@ export default {
|
||||||
progress = 100;
|
progress = 100;
|
||||||
param.onSuccess(response);
|
param.onSuccess(response);
|
||||||
progressCallback({progress, status: 'success'});
|
progressCallback({progress, status: 'success'});
|
||||||
|
self.cancelFileToken.forEach((token, index, array)=>{
|
||||||
|
if(token.name == file.name){
|
||||||
|
array.splice(token,1)
|
||||||
|
}
|
||||||
|
})
|
||||||
}).catch(({error}) => { // 失败回调
|
}).catch(({error}) => { // 失败回调
|
||||||
progress = 100;
|
progress = 100;
|
||||||
progressCallback({progress, status: 'error'});
|
progressCallback({progress, status: 'error'});
|
||||||
|
self.cancelFileToken.forEach((token, index, array)=>{
|
||||||
|
if(token.name == file.name){
|
||||||
|
array.splice(token,1)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showProgress(file, params) {
|
showProgress(file, params) {
|
||||||
|
@ -715,8 +725,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleDelete(file, index) {
|
handleDelete(file, index) {
|
||||||
this.$alert(this.$t('load_test.delete_file_confirm') + file.name + "?", '', {
|
this.$alert((this.cancelFileToken.length > 0 ? this.$t('load_test.delete_file_when_uploading') + '<br/>': "") + this.$t('load_test.delete_file_confirm') + file.name + "?", '', {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
this._handleDelete(file, index);
|
this._handleDelete(file, index);
|
||||||
|
@ -725,6 +736,12 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_handleDelete(file, index) {
|
_handleDelete(file, index) {
|
||||||
|
// 中断所有正在上传的文件
|
||||||
|
if (this.cancelFileToken && this.cancelFileToken.length >= 1) {
|
||||||
|
this.cancelFileToken.forEach(cacelToken => {
|
||||||
|
cacelToken.cancelFunc();
|
||||||
|
})
|
||||||
|
}
|
||||||
this.fileList.splice(index, 1);
|
this.fileList.splice(index, 1);
|
||||||
this.tableData.splice(index, 1);
|
this.tableData.splice(index, 1);
|
||||||
let data = {"belongId": this.issueId, "belongType": "issue"}
|
let data = {"belongId": this.issueId, "belongType": "issue"}
|
||||||
|
|
|
@ -1040,6 +1040,7 @@ export default {
|
||||||
upload_tips: 'Drag files here, or <em> click to upload </em>',
|
upload_tips: 'Drag files here, or <em> click to upload </em>',
|
||||||
upload_type: 'Only JMX/CSV/JAR files can be uploaded',
|
upload_type: 'Only JMX/CSV/JAR files can be uploaded',
|
||||||
related_file_not_found: "No related test file found!",
|
related_file_not_found: "No related test file found!",
|
||||||
|
delete_file_when_uploading: 'The current operation may interrupt the file being uploaded!',
|
||||||
delete_file_confirm: 'Confirm delete file:',
|
delete_file_confirm: 'Confirm delete file:',
|
||||||
file_size_out_of_bounds: "File size out of bounds, file name: ",
|
file_size_out_of_bounds: "File size out of bounds, file name: ",
|
||||||
file_size_limit: "The number of files exceeds the limit!",
|
file_size_limit: "The number of files exceeds the limit!",
|
||||||
|
|
|
@ -1046,6 +1046,7 @@ export default {
|
||||||
upload_tips: '将文件拖到此处,或<em>点击上传</em>',
|
upload_tips: '将文件拖到此处,或<em>点击上传</em>',
|
||||||
upload_type: '只能上传JMX/CSV/JAR文件',
|
upload_type: '只能上传JMX/CSV/JAR文件',
|
||||||
related_file_not_found: "未找到关联的测试文件!",
|
related_file_not_found: "未找到关联的测试文件!",
|
||||||
|
delete_file_when_uploading: '当前操作可能会中断正在上传的文件!',
|
||||||
delete_file_confirm: '确认删除文件: ',
|
delete_file_confirm: '确认删除文件: ',
|
||||||
file_size_limit: "文件个数超出限制!",
|
file_size_limit: "文件个数超出限制!",
|
||||||
file_size_out_of_bounds: "文件大小超出范围, 文件名称: ",
|
file_size_out_of_bounds: "文件大小超出范围, 文件名称: ",
|
||||||
|
|
|
@ -1043,6 +1043,7 @@ export default {
|
||||||
upload_tips: '將文件拖到此處,或<em>點擊上傳</em>',
|
upload_tips: '將文件拖到此處,或<em>點擊上傳</em>',
|
||||||
upload_type: '只能上傳JMX/CSV/JAR文件',
|
upload_type: '只能上傳JMX/CSV/JAR文件',
|
||||||
related_file_not_found: "未找到關聯的測試文件!",
|
related_file_not_found: "未找到關聯的測試文件!",
|
||||||
|
delete_file_when_uploading: '當前操作可能會中斷正在上傳的文件!',
|
||||||
delete_file_confirm: '確認刪除文件: ',
|
delete_file_confirm: '確認刪除文件: ',
|
||||||
file_size_limit: "文件個數超出限製!",
|
file_size_limit: "文件個數超出限製!",
|
||||||
file_size_out_of_bounds: "文件大小超出範圍, 文件名称: ",
|
file_size_out_of_bounds: "文件大小超出範圍, 文件名称: ",
|
||||||
|
|
Loading…
Reference in New Issue