refactor: 创建新接口版本时同步备注和依赖关系

This commit is contained in:
CaptainB 2022-01-17 10:41:54 +08:00 committed by 刘瑞斌
parent 37dbf0aad9
commit 057451ca0c
3 changed files with 139 additions and 35 deletions

View File

@ -44,7 +44,7 @@
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-basis-parameters :showScript="false" :request="request"/>
<api-other-info :api="basisData"/>
<api-other-info :api="basisData" ref="apiOtherInfo"/>
<ms-change-history ref="changeHistory"/>
<el-dialog
:fullscreen="true"
@ -62,6 +62,25 @@
></dubbo-api-version-diff>
</el-dialog>
<el-dialog
:title="$t('commons.sync_other_info')"
:visible.sync="createNewVersionVisible"
:show-close="false"
width="30%"
>
<div>
<el-checkbox v-model="basisData.newVersionRemark">{{ $t('commons.remark') }}</el-checkbox>
<el-checkbox v-model="basisData.newVersionDeps">{{ $t('commons.relationship.name') }}</el-checkbox>
</div>
<template v-slot:footer>
<ms-dialog-footer
@cancel="cancelCreateNewVersion"
:title="$t('commons.edit_info')"
@confirm="saveApi">
</ms-dialog-footer>
</template>
</el-dialog>
</div>
</template>
@ -71,17 +90,19 @@ import MsBasisParameters from "../request/dubbo/BasisParameters";
import MsChangeHistory from "../../../../history/ChangeHistory";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
import {getCurrentUser, hasLicense} from "@/common/js/utils";
import DubboApiVersionDiff from "./version/DubboApiVersionDiff";
import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
import DubboApiVersionDiff from "./version/DubboApiVersionDiff"
import {createComponent } from ".././jmeter/components";
const {Body} = require("@/business/components/api/definition/model/ApiTestModel");
import { TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
export default {
name: "MsApiDubboRequestForm",
components: {
MsDialogFooter,
ApiOtherInfo,
MsBasisApi, MsBasisParameters, MsChangeHistory,
'MsVersionHistory': versionHistory.default,
@ -135,12 +156,13 @@ export default {
return {
validated: false,
showFollow: false,
dialogVisible:false,
newShowFollow:false,
dialogVisible: false,
newShowFollow: false,
versionData: [],
newData:{},
oldRequest:{},
oldResponse:{}
newData: {},
oldRequest: {},
oldResponse: {},
createNewVersionVisible: false,
};
},
methods: {
@ -293,7 +315,10 @@ export default {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
}
if (stepArray[i].type === "Assertions" && !stepArray[i].document) {
stepArray[i].document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}};
stepArray[i].document = {
type: "JSON",
data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}
};
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.sort(stepArray[i].hashTree);
@ -301,6 +326,10 @@ export default {
}
}
},
cancelCreateNewVersion() {
this.createNewVersionVisible = false;
this.getVersionHistory();
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
@ -311,7 +340,13 @@ export default {
create(row) {
//
this.basisData.versionId = row.id;
this.basisData.newVersionRemark = !!this.basisData.remark;
this.basisData.newVersionDeps = this.$refs.apiOtherInfo.relationshipCount > 0;
if (this.$refs.apiOtherInfo.relationshipCount > 0 || this.basisData.remark) {
this.createNewVersionVisible = true;
} else {
this.saveApi();
}
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {

View File

@ -43,7 +43,7 @@
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-basis-parameters :showScript="false" :request="request"/>
<api-other-info :api="basisData"/>
<api-other-info :api="basisData" ref="apiOtherInfo"/>
<ms-change-history ref="changeHistory"/>
@ -63,6 +63,25 @@
></s-q-l-api-version-diff>
</el-dialog>
<el-dialog
:title="$t('commons.sync_other_info')"
:visible.sync="createNewVersionVisible"
:show-close="false"
width="30%"
>
<div>
<el-checkbox v-model="basisData.newVersionRemark">{{ $t('commons.remark') }}</el-checkbox>
<el-checkbox v-model="basisData.newVersionDeps">{{ $t('commons.relationship.name') }}</el-checkbox>
</div>
<template v-slot:footer>
<ms-dialog-footer
@cancel="cancelCreateNewVersion"
:title="$t('commons.edit_info')"
@confirm="saveApi">
</ms-dialog-footer>
</template>
</el-dialog>
</div>
</template>
@ -72,9 +91,10 @@ import MsBasisParameters from "../request/database/BasisParameters";
import MsChangeHistory from "../../../../history/ChangeHistory";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
import {getCurrentUser, hasLicense} from "@/common/js/utils";
import SQLApiVersionDiff from "./version/SQLApiVersionDiff"
import {createComponent } from ".././jmeter/components";
import { TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import SQLApiVersionDiff from "./version/SQLApiVersionDiff";
import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
@ -84,6 +104,7 @@ const {Body} = require("@/business/components/api/definition/model/ApiTestModel"
export default {
name: "MsApiSqlRequestForm",
components: {
MsDialogFooter,
ApiOtherInfo,
MsBasisApi, MsBasisParameters, MsChangeHistory,
'MsVersionHistory': versionHistory.default,
@ -123,12 +144,13 @@ export default {
return {
validated: false,
showFollow: false,
dialogVisible:false,
newShowFollow:false,
dialogVisible: false,
newShowFollow: false,
versionData: [],
newData:{},
oldRequest:{},
oldResponse:{}
newData: {},
oldRequest: {},
oldResponse: {},
createNewVersionVisible: false,
};
},
created() {
@ -299,7 +321,10 @@ export default {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
}
if (stepArray[i].type === "Assertions" && !stepArray[i].document) {
stepArray[i].document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}};
stepArray[i].document = {
type: "JSON",
data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}
};
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.sort(stepArray[i].hashTree);
@ -307,6 +332,10 @@ export default {
}
}
},
cancelCreateNewVersion() {
this.createNewVersionVisible = false;
this.getVersionHistory();
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
@ -316,9 +345,14 @@ export default {
},
create(row) {
//
this.basisData.versionId = row.id;
this.basisData.newVersionRemark = !!this.basisData.remark;
this.basisData.newVersionDeps = this.$refs.apiOtherInfo.relationshipCount > 0;
if (this.$refs.apiOtherInfo.relationshipCount > 0 || this.basisData.remark) {
this.createNewVersionVisible = true;
} else {
this.saveApi();
}
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {

View File

@ -71,7 +71,7 @@
:request="request"/>
<!-- <api-response-component :currentProtocol="apiCase.request.protocol" :api-item="apiCase"/>-->
</div>
<api-other-info :api="basisData"/>
<api-other-info :api="basisData" ref="apiOtherInfo"/>
<ms-change-history ref="changeHistory"/>
<el-dialog
@ -94,6 +94,26 @@
:method-types="methodTypes"
></t-c-p-api-version-diff>
</el-dialog>
<el-dialog
:title="$t('commons.sync_other_info')"
:visible.sync="createNewVersionVisible"
:show-close="false"
width="30%"
>
<div>
<el-checkbox v-model="basisData.newVersionRemark">{{ $t('commons.remark') }}</el-checkbox>
<el-checkbox v-model="basisData.newVersionDeps">{{ $t('commons.relationship.name') }}</el-checkbox>
</div>
<template v-slot:footer>
<ms-dialog-footer
@cancel="cancelCreateNewVersion"
:title="$t('commons.edit_info')"
@confirm="saveApi">
</ms-dialog-footer>
</template>
</el-dialog>
</div>
</template>
@ -104,9 +124,10 @@ import MsTcpFormatParameters from "../request/tcp/TcpFormatParameters";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {getCurrentProjectID, getCurrentUser, hasLicense} from "@/common/js/utils";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
import TCPApiVersionDiff from "./version/TCPApiVersionDiff"
import {createComponent } from ".././jmeter/components";
import { TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import TCPApiVersionDiff from "./version/TCPApiVersionDiff";
import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
const {Body} = require("@/business/components/api/definition/model/ApiTestModel");
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
@ -117,6 +138,7 @@ const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "MsAddCompleteTcpApi",
components: {
MsDialogFooter,
ApiOtherInfo, MsTcpBasicApi, MsTcpFormatParameters, MsChangeHistory,
"esbDefinition": esbDefinition.default,
"esbDefinitionResponse": esbDefinitionResponse.default,
@ -147,13 +169,13 @@ export default {
],
showXpackCompnent: false,
versionData: [],
dialogVisible:false,
newShowFollow:false,
newData:{},
oldRequest:{},
oldResponse:{},
dialogVisible: false,
newShowFollow: false,
newData: {},
oldRequest: {},
oldResponse: {},
oldApiProtocol: "TCP",
createNewVersionVisible: false,
};
},
created: function () {
@ -421,7 +443,10 @@ export default {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
}
if (stepArray[i].type === "Assertions" && !stepArray[i].document) {
stepArray[i].document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}};
stepArray[i].document = {
type: "JSON",
data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}
};
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.sort(stepArray[i].hashTree);
@ -429,6 +454,10 @@ export default {
}
}
},
cancelCreateNewVersion() {
this.createNewVersionVisible = false;
this.getVersionHistory();
},
checkout(row) {
let api = this.versionData.filter(v => v.versionId === row.id)[0];
if (api.tags && api.tags.length > 0) {
@ -439,7 +468,13 @@ export default {
create(row) {
//
this.basisData.versionId = row.id;
this.basisData.newVersionRemark = !!this.basisData.remark;
this.basisData.newVersionDeps = this.$refs.apiOtherInfo.relationshipCount > 0;
if (this.$refs.apiOtherInfo.relationshipCount > 0 || this.basisData.remark) {
this.createNewVersionVisible = true;
} else {
this.saveApi();
}
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {