fix(接口测试): 接口定义中case名称过长导致报错

This commit is contained in:
wxg0103 2021-12-17 11:05:56 +08:00 committed by 刘瑞斌
parent 466b0e39cd
commit d5566fc4fe
5 changed files with 14 additions and 4 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE api_definition_exec_result
MODIFY COLUMN name VARCHAR (255);

View File

@ -6,7 +6,8 @@
<span @click.stop>
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/>
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
class="ms-api-header-select" style="width: 180px" :readonly="!hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE')"
class="ms-api-header-select" style="width: 180px"
:readonly="!hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE')"
@blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
<span v-else>
<el-tooltip :content="apiCase.id ? apiCase.name : ''" placement="top">
@ -408,9 +409,6 @@ export default {
saveCase(row, hideAlert) {
let tmp = JSON.parse(JSON.stringify(row));
this.isShowInput = false;
if (this.validate(tmp)) {
return;
}
tmp.request.body = row.request.body;
let bodyFiles = this.getBodyUploadFiles(tmp);
tmp.projectId = getCurrentProjectID();
@ -466,6 +464,9 @@ export default {
});
},
saveTestCase(row, hideAlert) {
if (this.validate(row)) {
return;
}
if (this.compare.indexOf(row.id) === -1) {
this.compare.push(row.id);
if (this.api.saved) {
@ -500,6 +501,10 @@ export default {
this.$warning(this.$t('api_test.input_name'));
return true;
}
if (row.name.length > 100) {
this.$warning(this.$t('api_test.input_name_length'));
return true;
}
},
showExecResult(item) {
item.active = true;

View File

@ -985,6 +985,7 @@ export default {
invert_select: "Invert select",
select_or_invert: "Select all/Invert select",
input_name: "Please enter the test name",
input_name_length: "The length of the test name cannot exceed 100",
select_project: "Please select project",
variable_name: "Variable name",
variable: "Variable",

View File

@ -992,6 +992,7 @@ export default {
invert_select: "反选",
select_or_invert: "全选/反选",
input_name: "请输入测试名称",
input_name_length: "测试名称长度不能超过100",
select_project: "请选择项目",
variable_name: "变量名",
variable: "变量",

View File

@ -989,6 +989,7 @@ export default {
invert_select: "反選",
select_or_invert: "全選/反選",
input_name: "請輸入測試名稱",
input_name_length: "測試名稱長度不能超過100",
select_project: "請選擇項目",
variable_name: "變量名",
variable: "變量",