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 21a2240cca
commit 32ff3432c1
6 changed files with 84 additions and 21 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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