Merge remote-tracking branch 'origin/master'

This commit is contained in:
wenyann 2020-12-18 12:58:43 +08:00
commit 2ff9cdde0c
11 changed files with 37 additions and 45 deletions

View File

@ -201,6 +201,7 @@ public class ApiDefinitionService {
test.setName(request.getName());
test.setPath(request.getPath());
test.setProjectId(request.getProjectId());
request.getRequest().setId(request.getId());
test.setRequest(JSONObject.toJSONString(request.getRequest()));
test.setUpdateTime(System.currentTimeMillis());
test.setStatus(request.getStatus());
@ -227,6 +228,7 @@ public class ApiDefinitionService {
test.setPath(request.getPath());
test.setModuleId(request.getModuleId());
test.setProjectId(request.getProjectId());
request.getRequest().setId(request.getId());
test.setRequest(JSONObject.toJSONString(request.getRequest()));
test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());

View File

@ -552,7 +552,7 @@
remove(row, node) {
const parent = node.parent
const hashTree = parent.data.hashTree || parent.data;
const index = hashTree.findIndex(d => d.id != undefined && row.id != undefined && d.id === row.id)
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
hashTree.splice(index, 1);
this.sort();
this.reload();

View File

@ -268,7 +268,7 @@
},
saveApi(data) {
this.setTabTitle(data);
this.$refs.apiList[0].initApiTable(data);
this.$refs.apiList[0].initTable(data);
},
showExecResult(row){

View File

@ -100,13 +100,19 @@
name: "MsAddCompleteHttpApi",
components: {MsResponseText, MsApiRequestForm, MsJsr233Processor},
data() {
let validateURL = (rule, value, callback) => {
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
callback(this.$t('api_test.definition.request.path_valid_info'));
}
callback();
};
return {
rule: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
],
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}],
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {validator: validateURL, trigger: 'blur'}],
userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
@ -124,10 +130,6 @@
runTest() {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
if(this.httpForm.path.match(/\s/)!=null){
this.$error(this.$t("api_test.definition.request.path_valid_info"));
return false;
}
this.setParameter();
this.$emit('runTest', this.httpForm);
} else {
@ -150,10 +152,6 @@
saveApi() {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
if(this.httpForm.path.match(/\s/)!=null){
this.$error(this.$t("api_test.definition.request.path_valid_info"));
return false;
}
this.setParameter();
this.$emit('saveApi', this.httpForm);
}

View File

@ -63,10 +63,20 @@
scenario: Boolean,
},
data() {
let validateURL = (rule, value, callback) => {
try {
new URL(this.debugForm.url);
} catch (e) {
callback(this.$t('api_test.request.url_invalid'));
}
};
return {
rules: {
method: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
url: [{required: true, message: this.$t('api_test.definition.request.path_all_info'), trigger: 'blur'}],
url: [
{max: 500, required: true, message: this.$t('commons.input_limit', [1, 500]), trigger: 'blur'},
{validator: validateURL, trigger: 'blur'}
],
},
debugForm: {method: REQ_METHOD[0].id, environmentId: ""},
options: [],

View File

@ -206,6 +206,8 @@
data.request = JSON.stringify(this.api.request);
data.method = this.api.method;
data.url = this.api.url;
let id = getUUID();
data.id = id;
data.status = this.api.status;
data.userId = this.api.userId;
data.description = this.api.description;

View File

@ -1,6 +1,6 @@
<template>
<div v-loading="result.loading">
<el-input placeholder="搜索项目"
<el-input :placeholder="$t('project.search_by_name')"
prefix-icon="el-icon-search"
v-model="searchString"
clearable
@ -8,7 +8,7 @@
size="small"/>
<div v-if="items.length === 0" style="text-align: center; margin: 15px 0">
<span style="font-size: 15px; color: #8a8b8d;">
无数据
{{ $t('project.no_data') }}
</span>
</div>
<div v-else style="height: 150px;overflow: auto">
@ -114,7 +114,7 @@ export default {
this.$emit("update:currentProject", project[0].name);
}
} else {
this.$emit("update:currentProject", '选择项目');
this.$emit("update:currentProject", this.$t('project.select'));
}
}
}

View File

@ -5,7 +5,7 @@
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="$t('commons.project')"/>
</template>
<el-table border class="adjust-table" @row-click="link" :data="items" style="width: 100%" @sort-change="sort">
<el-table border class="adjust-table" :data="items" style="width: 100%" @sort-change="sort">
<el-table-column prop="name" :label="$t('commons.name')" width="250" show-overflow-tooltip/>
<el-table-column prop="description" :label="$t('commons.description')" show-overflow-tooltip>
<template v-slot:default="scope">
@ -95,7 +95,6 @@ import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import ApiEnvironmentConfig from "../../api/test/components/ApiEnvironmentConfig";
import TemplateComponent from "../../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
import {ApiEvent, LIST_CHANGE, PerformanceEvent, TrackEvent} from "@/business/components/common/head/ListEvent";
import {PROJECT_ID} from "@/common/js/constants";
export default {
@ -223,10 +222,6 @@ export default {
}
Message.success(this.$t('commons.delete_success'));
this.list();
// 广 head
ApiEvent.$emit(LIST_CHANGE);
TrackEvent.$emit(LIST_CHANGE);
PerformanceEvent.$emit(LIST_CHANGE);
});
}).catch(() => {
this.$message({
@ -253,22 +248,6 @@ export default {
this.total = data.itemCount;
})
},
link(row) {
// performance_test project link
if (this.$route.name === 'perProject') {
this.$router.push({
path: '/performance/test/' + row.id,
})
} else if (this.$route.name === 'fucProject') {
this.$router.push({
path: '/api/test/list/' + row.id
})
} else if (this.$route.name === 'trackProject') {
this.$router.push({
path: '/track/case/' + row.id
})
}
},
sort(column) {
_sort(column, this.condition);
this.list();
@ -292,11 +271,6 @@ export default {
</script>
<style scoped>
.el-table {
cursor: pointer;
}
pre {
margin: 0 0;
}

View File

@ -304,6 +304,8 @@ export default {
jira_key: 'JIRA Project key',
zentao_id: 'Zentao Project ID',
manager: 'Manager',
no_data: 'No Data',
select: 'Select'
},
member: {
create: 'Create',
@ -543,7 +545,7 @@ export default {
create_info: 'Create',
update_info: 'Update',
batch_edit: "Batch edit",
path_valid_info: "The request address cannot contain spaces",
path_valid_info: "The request path is invalid",
}
},
automation: {

View File

@ -301,6 +301,8 @@ export default {
jira_key: 'JIRA项目key',
zentao_id: 'Zentao项目ID',
manager: '项目管理',
no_data: '无数据',
select: '选择项目'
},
member: {
create: '添加成员',
@ -542,7 +544,7 @@ export default {
create_info: '创建',
update_info: '更新',
batch_edit: "批量编辑",
path_valid_info: "请求地址不能包含空格",
path_valid_info: "请求路径无效",
}
},
automation: {

View File

@ -301,6 +301,8 @@ export default {
jira_key: 'JIRA項目key',
zentao_id: 'Zentao項目ID',
manager: '項目管理',
no_data: '無數據',
select: '選擇項目'
},
member: {
create: '添加成員',
@ -542,7 +544,7 @@ export default {
create_info: '創建',
update_info: '更新',
batch_edit: "批量編輯",
path_valid_info: "請求地址不能包含空格",
path_valid_info: "請求路径无效",
}
},
automation: {