fix (接口定义): 插件功能历史数据兼容处理

This commit is contained in:
fit2-zhao 2021-09-03 18:32:24 +08:00 committed by fit2-zhao
parent b37d9a8425
commit 6bf1efd0b3
3 changed files with 31 additions and 2 deletions

View File

@ -39,6 +39,7 @@
import Sampler from "./jmeter/components/sampler/sampler";
import {WORKSPACE_ID} from '@/common/js/constants';
import {handleCtrlSEvent} from "../../../../../common/js/utils";
import {ELEMENT_TYPE, TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
export default {
name: "ApiConfig",
@ -167,6 +168,18 @@
this.currentApi.request = this.request;
}
},
sort(stepArray) {
if (stepArray) {
for (let i in stepArray) {
if (!stepArray[i].clazzName) {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.sort(stepArray[i].hashTree);
}
}
}
},
formatApi() {
if (this.currentApi.response != null && this.currentApi.response != 'null' && this.currentApi.response != undefined) {
if (Object.prototype.toString.call(this.currentApi.response).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
@ -203,6 +216,8 @@
}
this.response.body = body;
}
this.request.clazzName = TYPE_TO_C.get(this.request.type);
this.sort(this.request.hashTree);
},
saveApi(data) {
this.setParameters(data);

View File

@ -176,6 +176,7 @@ const esbDefinition = (requireComponent != null && requireComponent.keys().lengt
const esbDefinitionResponse = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
import {API_METHOD_COLOUR} from "../../model/JsonData";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
export default {
name: "ApiCaseItem",
@ -387,6 +388,18 @@ export default {
this.saveLoading = false
});
},
sort(stepArray) {
if (stepArray) {
for (let i in stepArray) {
if (!stepArray[i].clazzName) {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.sort(stepArray[i].hashTree);
}
}
}
},
saveCase(row, hideAlert) {
let tmp = JSON.parse(JSON.stringify(row));
this.isShowInput = false;
@ -419,6 +432,8 @@ export default {
if (tmp.tags instanceof Array) {
tmp.tags = JSON.stringify(tmp.tags);
}
tmp.clazzName = TYPE_TO_C.get(tmp.type);
this.sort(tmp.hashTree);
this.result = this.$fileUpload(url, null, bodyFiles, tmp, (response) => {
let data = response.data;
row.id = data.id;

View File

@ -65,7 +65,6 @@ import MsDrawer from "../../../../common/components/MsDrawer";
import {CASE_ORDER, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsBatchEdit from "../basis/BatchEdit";
import MsTaskCenter from "../../../../task/TaskCenter";
export default {
name: 'ApiCaseList',
@ -75,7 +74,7 @@ export default {
ApiCaseHeader,
ApiCaseItem,
MsBatchEdit,
MsTaskCenter,
MsTaskCenter: () => import("../../../../task/TaskCenter"),
},
props: {
createCase: String,