fix(测试跟踪): 用例缺陷附件上传限制为50MB

--bug=1032752 --user=宋昌昌 【测试跟踪】github#27480,功能用例上传附件接口提示是不超过500M,实际上传200M的文件接口会报错 https://www.tapd.cn/55049933/s/1436598
This commit is contained in:
song-cc-rock 2023-11-15 10:41:58 +08:00 committed by 刘瑞斌
parent dc6a1f095e
commit f912c5c0b8
2 changed files with 26 additions and 25 deletions

View File

@ -200,7 +200,7 @@ export default {
* upload file methods * upload file methods
*/ */
fileValidator(file) { fileValidator(file) {
return file.size < 500 * 1024 * 1024; return file.size < 50 * 1024 * 1024;
}, },
beforeUpload(file) { beforeUpload(file) {
if (!this.fileValidator(file)) { if (!this.fileValidator(file)) {

View File

@ -343,31 +343,31 @@ import TestCaseIssueList from "@/business/issue/TestCaseIssueList";
import IssueEditDetail from "@/business/issue/IssueEditDetail"; import IssueEditDetail from "@/business/issue/IssueEditDetail";
import {byteToSize, getTypeByFileName, getUUID,} from "metersphere-frontend/src/utils"; import {byteToSize, getTypeByFileName, getUUID,} from "metersphere-frontend/src/utils";
import { import {
getCurrentProjectID, getCurrentProjectID,
getCurrentUser, getCurrentUser,
getCurrentUserId, getCurrentUserId,
getCurrentWorkspaceId, getCurrentWorkspaceId,
} from "metersphere-frontend/src/utils/token"; } from "metersphere-frontend/src/utils/token";
import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission"; import {hasLicense, hasPermission,} from "metersphere-frontend/src/utils/permission";
import { import {
enableThirdPartTemplate, enableThirdPartTemplate,
getComments, getComments,
getFollow, getFollow,
getIssuePartTemplateWithProject, getIssuePartTemplateWithProject,
getPlatformFormOption, getPlatformFormOption,
getPlatformTransitions, getPlatformTransitions,
getTapdCurrentOwner, getTapdCurrentOwner,
getTapdUser, getTapdUser,
saveFollow, saveFollow,
saveOrUpdateIssue, saveOrUpdateIssue,
} from "@/api/issue"; } from "@/api/issue";
import { import {
attachmentList, attachmentList,
deleteIssueAttachment, deleteIssueAttachment,
dumpAttachment, dumpAttachment,
relatedIssueAttachment, relatedIssueAttachment,
unrelatedIssueAttachment, unrelatedIssueAttachment,
uploadIssueAttachment, uploadIssueAttachment,
} from "@/api/attachment"; } from "@/api/attachment";
import CustomFiledFormItem from "metersphere-frontend/src/components/form/CustomFiledFormItem"; import CustomFiledFormItem from "metersphere-frontend/src/components/form/CustomFiledFormItem";
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText"; import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
@ -856,16 +856,16 @@ export default {
} }
}, },
fileValidator(file) { fileValidator(file) {
return file.size < 500 * 1024 * 1024; return file.size < 50 * 1024 * 1024;
}, },
beforeUpload(file) { beforeUpload(file) {
if (!this.fileValidator(file)) { if (!this.fileValidator(file)) {
this.$error(this.$t("load_test.file_size_out_of_bounds") + file.name); this.$error(this.$t("case.file_size_out_of_bounds"), false);
return false; return false;
} }
if (this.tableData.filter((f) => f.name === file.name).length > 0) { if (this.tableData.filter((f) => f.name === file.name).length > 0) {
this.$error(this.$t("load_test.delete_file") + ", name: " + file.name); this.$error(this.$t("load_test.delete_file") + ", name: " + file.name, false);
return false; return false;
} }
}, },
@ -917,6 +917,7 @@ export default {
progress = 100; progress = 100;
param.onSuccess(response); param.onSuccess(response);
progressCallback({ progress, status: "success" }); progressCallback({ progress, status: "success" });
self.$success(this.$t('attachment.upload_success'), false)
self.cancelFileToken.forEach((token, index, array) => { self.cancelFileToken.forEach((token, index, array) => {
if (token.name == file.name) { if (token.name == file.name) {
array.splice(token, 1); array.splice(token, 1);
@ -1011,7 +1012,7 @@ export default {
this.filterCopyFiles.push(file.id); this.filterCopyFiles.push(file.id);
} else { } else {
deleteIssueAttachment(file.id).then(() => { deleteIssueAttachment(file.id).then(() => {
this.$success(this.$t("commons.delete_success")); this.$success(this.$t("commons.delete_success"), false);
this.getFileMetaData(this.issueId); this.getFileMetaData(this.issueId);
}); });
} }