fix: 修复接口测试关闭版本时显示版本字段的问题

--bug=1009707 --user=刘瑞斌 【接口测试】没开启版本,接口定义右上角显示了版本字段 https://www.tapd.cn/55049933/s/1093635
This commit is contained in:
CaptainB 2022-01-18 19:12:50 +08:00 committed by xiaomeinvG
parent b16fdfff7e
commit 0d77113760
6 changed files with 84 additions and 21 deletions

View File

@ -1,7 +1,7 @@
<template>
<span>
<span>
<div class="ms-opt-btn" v-if="apiDefinitionId">
<div class="ms-opt-btn" v-if="apiDefinitionId && versionEnable">
{{ $t('project.version.name') }}: {{ apiDefinition.versionName }}
</div>
<el-input :placeholder="$t('commons.search_by_id_name_tag')" @blur="search" @keyup.enter.native="search"
@ -429,7 +429,8 @@ export default {
timeoutIndex: 0,
versionFilters: [],
versionName: '',
runCaseIds: []
runCaseIds: [],
versionEnable: false,
};
},
props: {
@ -1214,6 +1215,7 @@ export default {
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
if (!response.data) {
this.fields = this.fields.filter(f => f.id !== 'versionId');
}

View File

@ -1,8 +1,8 @@
<template>
<div>
<div>
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ mockConfigData.versionName }}
<div class="ms-opt-btn" v-if="versionEnable">
{{ $t('project.version.name') }}: {{ mockConfigData.versionName }}
</div>
<el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small"
:clearable="true"
@ -81,7 +81,7 @@
<script>
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import MockEditDrawer from "@/business/components/api/definition/components/mock/MockEditDrawer";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
@ -124,6 +124,7 @@ export default {
permissions: ['PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL']
}
],
versionEnable: false,
};
},
@ -131,6 +132,7 @@ export default {
},
created() {
this.mockConfigData = this.baseMockConfigData;
this.checkVersionEnable();
},
computed: {
projectId() {
@ -250,6 +252,16 @@ export default {
this.mockConfigData = response.data;
});
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
}
};
</script>

View File

@ -1,8 +1,8 @@
<template>
<div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
<div class="ms-opt-btn" v-if="versionEnable">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content">
<!-- 操作按钮 -->
@ -50,7 +50,7 @@
</template>
<script>
import {getUUID} from "@/common/js/utils";
import {getUUID, hasLicense} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
@ -94,7 +94,8 @@ export default {
},
runData: [],
reportId: "",
runLoading: false
runLoading: false,
versionEnable: false,
}
},
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
@ -277,6 +278,16 @@ export default {
this.$success(this.$t('report.test_stop_success'));
});
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
},
created() {
//
@ -286,6 +297,7 @@ export default {
this.runLoading = false;
this.getEnvironments();
this.getResult();
this.checkVersionEnable();
}
}
</script>

View File

@ -1,8 +1,8 @@
<template>
<div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
<div class="ms-opt-btn" v-if="versionEnable">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content">
@ -79,7 +79,7 @@
<script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID} from "@/common/js/utils";
import {getUUID, hasLicense} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsRequestResultTail from "../response/RequestResultTail";
@ -121,6 +121,7 @@ export default {
envMap: new Map,
runLoading: false,
versionName: '',
versionEnable: false,
}
},
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
@ -292,6 +293,16 @@ export default {
this.$success(this.$t('report.test_stop_success'));
});
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
},
created() {
//
@ -303,6 +314,7 @@ export default {
}
this.runLoading = false;
//this.getResult();
this.checkVersionEnable();
}
}
</script>

View File

@ -1,8 +1,8 @@
<template>
<div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
<div class="ms-opt-btn" v-if="versionEnable">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content">
<!-- 操作按钮 -->
@ -49,7 +49,7 @@
</template>
<script>
import {getUUID} from "@/common/js/utils";
import {getUUID, hasLicense} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
@ -93,7 +93,8 @@ export default {
},
runData: [],
reportId: "",
runLoading: false
runLoading: false,
versionEnable: false,
}
},
props: {apiData: {}, currentProtocol: String,syncTabs: Array, projectId: String},
@ -275,6 +276,16 @@ export default {
this.$success(this.$t('report.test_stop_success'));
});
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
},
created() {
//
@ -284,6 +295,7 @@ export default {
this.runLoading = false;
this.getEnvironments();
this.getResult();
this.checkVersionEnable();
}
}
</script>

View File

@ -1,8 +1,8 @@
<template>
<div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
<div class="ms-opt-btn" v-if="versionEnable">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content">
@ -73,7 +73,7 @@
<script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID} from "@/common/js/utils";
import {getUUID, hasLicense} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
@ -84,6 +84,7 @@ import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
@ -119,8 +120,9 @@ export default {
},
runData: [],
reportId: "",
showXpackCompnent:false,
runLoading: false
showXpackCompnent: false,
runLoading: false,
versionEnable: false,
}
},
props: {apiData: {}, currentProtocol: String,syncTabs: Array, projectId: String},
@ -274,6 +276,16 @@ export default {
this.$success(this.$t('report.test_stop_success'));
});
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
}
},
created() {
//
@ -285,6 +297,7 @@ export default {
if (requireComponent != null && JSON.stringify(esbDefinition) !== '{}') {
this.showXpackCompnent = true;
}
this.checkVersionEnable();
}
}
</script>