feat (接口定义): 优化用例全局环境设置
This commit is contained in:
parent
7d68149409
commit
bb108a1f43
|
@ -20,6 +20,13 @@
|
|||
</ms-aside-container>
|
||||
|
||||
<ms-main-container>
|
||||
<ms-environment-select
|
||||
:project-id="projectId"
|
||||
:is-read-only="false"
|
||||
:useEnvironment='useEnvironment'
|
||||
@setEnvironment="setEnvironment"
|
||||
class="ms-api-button"
|
||||
ref="environmentSelect"/>
|
||||
<!-- 主框架列表 -->
|
||||
<el-tabs v-model="apiDefaultTab" @edit="handleTabRemove" @tab-click="addTab">
|
||||
<el-tab-pane
|
||||
|
@ -92,8 +99,6 @@
|
|||
<!-- 列表集合 -->
|
||||
<ms-api-list
|
||||
v-if="activeDom==='left'"
|
||||
@runTest="runTest"
|
||||
@refreshTree="refreshTree"
|
||||
:module-tree="nodeTree"
|
||||
:module-options="moduleOptions"
|
||||
:current-protocol="currentProtocol"
|
||||
|
@ -104,6 +109,8 @@
|
|||
:queryDataType="queryDataType"
|
||||
:selectDataRange="selectDataRange"
|
||||
:is-read-only="isReadOnly"
|
||||
@runTest="runTest"
|
||||
@refreshTree="refreshTree"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
@editApi="editApi"
|
||||
@handleCase="handleCase"
|
||||
|
@ -239,6 +246,7 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
|
|||
import MockConfig from "@/business/components/api/definition/components/mock/MockConfig";
|
||||
import ApiSchedule from "@/business/components/api/definition/components/import/ApiSchedule";
|
||||
import MsEditCompleteContainer from "./components/EditCompleteContainer";
|
||||
import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect";
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -278,7 +286,8 @@ export default {
|
|||
MsRunTestDubboPage,
|
||||
ApiDocumentsPage,
|
||||
MockConfig,
|
||||
MsEditCompleteContainer
|
||||
MsEditCompleteContainer,
|
||||
MsEnvironmentSelect
|
||||
},
|
||||
props: {
|
||||
visible: {
|
||||
|
@ -322,6 +331,7 @@ export default {
|
|||
//影响API表格刷新的操作。 为了防止高频率刷新模块列表用。如果是模块更新而造成的表格刷新,则不回调模块刷新方法
|
||||
initApiTableOpretion: 'init',
|
||||
param: {},
|
||||
useEnvironment: String,
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
|
@ -376,6 +386,12 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
setEnvironment(data) {
|
||||
if (data) {
|
||||
this.useEnvironment = data.id;
|
||||
this.$store.state.useEnvironment = data.id;
|
||||
}
|
||||
},
|
||||
hasPermission,
|
||||
getPath(id, arr) {
|
||||
if (id === null) {
|
||||
|
@ -652,7 +668,7 @@ export default {
|
|||
|
||||
/deep/ .el-tabs__header {
|
||||
margin: 0 0 0px;
|
||||
/*width: calc(100% - 90px);*/
|
||||
width: calc(100% - 200px);
|
||||
}
|
||||
|
||||
/deep/ .el-card {
|
||||
|
@ -665,4 +681,16 @@ export default {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.ms-api-button {
|
||||
position: absolute;
|
||||
top: 92px;
|
||||
right: 10px;
|
||||
padding: 0;
|
||||
background: 0 0;
|
||||
border: none;
|
||||
outline: 0;
|
||||
cursor: pointer;
|
||||
margin-right: 10px;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<el-button plain :class="{active: showApiList}" @click="changeTab('api')" size="small">API</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip class="item" effect="dark" :content="$t('commons.test')" placement="top">
|
||||
<el-button plain :class="{active: showTest}" @click="changeTab('test')" size="small">{{ $t('commons.test') }}</el-button>
|
||||
<el-button plain :class="{active: showTest}" @click="changeTab('test')" size="small">TEST</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip class="item" effect="dark" :content="$t('api_test.definition.case_title')" placement="top">
|
||||
<el-button plain :class="{active: showTestCaseList}" @click="changeTab('testCase')" size="small">CASE</el-button>
|
||||
|
|
|
@ -124,6 +124,9 @@ export default {
|
|||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.useEnvironment': function () {
|
||||
this.environment = this.$store.state.useEnvironment;
|
||||
},
|
||||
refreshSign() {
|
||||
this.api = this.currentApi;
|
||||
this.getApiTest();
|
||||
|
@ -396,7 +399,7 @@ export default {
|
|||
this.runData.push(row.request);
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
this.$emit("refresh",row.id);
|
||||
this.$emit("refresh", row.id);
|
||||
},
|
||||
|
||||
batchRun() {
|
||||
|
@ -476,7 +479,7 @@ export default {
|
|||
this.getApiTest();
|
||||
});
|
||||
},
|
||||
showHistory(id){
|
||||
showHistory(id) {
|
||||
this.$refs.taskCenter.openHistory(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
{{ $t('operating_log.change_history') }}
|
||||
</el-link>
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
{{ $t('operating_log.change_history') }}
|
||||
</el-link>
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
{{ $t('operating_log.change_history') }}
|
||||
</el-link>
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
@keyup.enter.native="enterSearch"
|
||||
v-model="condition.name" ref="inputVal"/>
|
||||
|
||||
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
|
||||
<ms-table
|
||||
:data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
|
||||
:total="total" enableSelection
|
||||
:batch-operators="trashEnable ? trashButtons : buttons" :screen-height="screenHeight"
|
||||
:operators="tableOperatorButtons" operator-width="200px"
|
||||
|
|
|
@ -174,6 +174,12 @@ export default {
|
|||
updateApi() {
|
||||
let url = "/api/definition/update";
|
||||
let bodyFiles = this.getBodyUploadFiles();
|
||||
if (Object.prototype.toString.call(this.api.response).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
this.api.response = JSON.parse(this.api.response);
|
||||
}
|
||||
if (this.api.tags instanceof Array) {
|
||||
this.api.tags = JSON.stringify(this.api.tags);
|
||||
}
|
||||
this.$fileUpload(url, null, bodyFiles, this.api, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
if (this.syncTabs.indexOf(this.api.id) === -1) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<!-- 执行环境 -->
|
||||
<el-form-item prop="environmentId">
|
||||
<environment-select :current-data="api" :project-id="projectId"/>
|
||||
<environment-select :current-data="api" :project-id="projectId"/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 请求地址 -->
|
||||
|
@ -114,6 +114,16 @@
|
|||
}
|
||||
},
|
||||
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
|
||||
computed:{
|
||||
'api.environmentId'(){
|
||||
return this.$store.state.useEnvironment;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'$store.state.useEnvironment':function (){
|
||||
this.api.environmentId = this.$store.state.useEnvironment;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -207,6 +217,12 @@
|
|||
let bodyFiles = this.getBodyUploadFiles();
|
||||
this.api.method = this.api.request.method;
|
||||
this.api.path = this.api.request.path;
|
||||
if (Object.prototype.toString.call(this.api.response).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
this.api.response = JSON.parse(this.api.response);
|
||||
}
|
||||
if (this.api.tags instanceof Array) {
|
||||
this.api.tags = JSON.stringify(this.api.tags);
|
||||
}
|
||||
this.$fileUpload(url, null, bodyFiles, this.api, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit('saveApi', this.api);
|
||||
|
|
|
@ -176,6 +176,12 @@ export default {
|
|||
updateApi() {
|
||||
let url = "/api/definition/update";
|
||||
let bodyFiles = this.getBodyUploadFiles();
|
||||
if (Object.prototype.toString.call(this.api.response).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
this.api.response = JSON.parse(this.api.response);
|
||||
}
|
||||
if (this.api.tags instanceof Array) {
|
||||
this.api.tags = JSON.stringify(this.api.tags);
|
||||
}
|
||||
this.$fileUpload(url, null, bodyFiles, this.api, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
if (this.syncTabs.indexOf(this.api.id) === -1) {
|
||||
|
|
|
@ -205,6 +205,12 @@ export default {
|
|||
updateApi() {
|
||||
let url = "/api/definition/update";
|
||||
let bodyFiles = this.getBodyUploadFiles();
|
||||
if (Object.prototype.toString.call(this.api.response).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
this.api.response = JSON.parse(this.api.response);
|
||||
}
|
||||
if (this.api.tags instanceof Array) {
|
||||
this.api.tags = JSON.stringify(this.api.tags);
|
||||
}
|
||||
if(this.api.method==='ESB'){
|
||||
this.api.esbDataStruct = JSON.stringify(this.api.request.esbDataStruct);
|
||||
this.api.backEsbDataStruct = JSON.stringify(this.api.request.backEsbDataStruct);
|
||||
|
|
|
@ -21,7 +21,7 @@ const state = {
|
|||
testReviewSelectNode: {},
|
||||
testReviewSelectNodeIds: [],
|
||||
testReviewModuleOptions: [],
|
||||
|
||||
useEnvironment: "",
|
||||
testPlanViewSelectNode: {}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue