fix(接口测试): 修复sql协议切换环境,没有显示第一个数据源的缺陷
--bug=1027588 --user=王孝刚 【接口测试】SQL协议-API/TEST/CASE/切换运行环境-数据源显示为空 https://www.tapd.cn/55049933/s/1389900
This commit is contained in:
parent
8b1af2b919
commit
ae0219625c
|
@ -261,6 +261,12 @@ export default {
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
|
// 接口/用例 自身环境监听
|
||||||
|
'request.environmentId': function () {
|
||||||
|
if (!this.scenarioId) {
|
||||||
|
this.setStep(undefined, undefined, this.request.targetDataSourceName);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
|
@ -535,6 +541,21 @@ export default {
|
||||||
environmentConfigClose() {
|
environmentConfigClose() {
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
},
|
},
|
||||||
|
setStep(envId, currentEnvironment, targetDataSourceName) {
|
||||||
|
let envs = this.environments.filter((item) => this.request && item.id === this.request.environmentId);
|
||||||
|
if (envs && envs.length === 0) {
|
||||||
|
let id = this.request.projectId ? this.request.projectId : this.projectId;
|
||||||
|
this.result = getEnvironmentByProjectId(id).then((response) => {
|
||||||
|
this.environments = response.data;
|
||||||
|
this.environments.forEach((environment) => {
|
||||||
|
parseEnvironment(environment);
|
||||||
|
});
|
||||||
|
this.initDataSource(envId, currentEnvironment, targetDataSourceName);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.initDataSource(envId, currentEnvironment, targetDataSourceName);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue