From 7662880d4e580db49ebacab112c58334acbf5a6c Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 24 Feb 2022 16:51:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E8=AE=BE=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=8B=E6=A8=A1=E5=9D=97=E5=92=8C=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=8C=B9=E9=85=8D=E6=97=B6=E6=A8=A1=E5=9D=97=E5=92=8C?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=85=81=E8=AE=B8=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1010200 --user=王孝刚 【项目管理】github#9994,环境设置,建议模块和路径匹配时模块和路径不允许为空 https://www.tapd.cn/55049933/s/1109863 --- .../environment/EnvironmentHttpConfig.vue | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/test/components/environment/EnvironmentHttpConfig.vue b/frontend/src/business/components/api/test/components/environment/EnvironmentHttpConfig.vue index 67eb8aa48f..be9bc3ba8b 100644 --- a/frontend/src/business/components/api/test/components/environment/EnvironmentHttpConfig.vue +++ b/frontend/src/business/components/api/test/components/environment/EnvironmentHttpConfig.vue @@ -264,22 +264,46 @@ export default { }); } else { this.condition.ids = []; - this.condition.details = []; + this.$warning(this.$t('api_test.environment.module_warning')); + return; } }, update() { const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id); this.validateSocket(this.condition.socket); let obj = { - id: this.condition.id, type: this.condition.type, domain: this.condition.domain, socket: this.condition.socket, headers: this.condition.headers, - protocol: this.condition.protocol, details: this.condition.details, port: this.condition.port, time: this.condition.time + id: this.condition.id, + type: this.condition.type, + domain: this.condition.domain, + socket: this.condition.socket, + headers: this.condition.headers, + protocol: this.condition.protocol, + port: this.condition.port, + time: this.condition.time }; if (obj.type === "PATH") { + if (this.pathDetails.name === '') { + this.$warning(this.$t('api_test.environment.path_warning')); + return; + } this.httpConfig.conditions[index].details = [this.pathDetails]; + } else { + if (this.condition.details.length === 0) { + this.$warning(this.$t('api_test.environment.module_warning')); + return; + } + obj.details = this.condition.details ? JSON.parse(JSON.stringify(this.condition.details)) : this.condition.details; } if (index !== -1) { Vue.set(this.httpConfig.conditions[index], obj, 1); - this.condition = {type: "NONE", details: [new KeyValue({name: "", value: "contains"})], protocol: "http", socket: "", domain: "", headers: [new KeyValue()]}; + this.condition = { + type: "NONE", + details: [new KeyValue({name: "", value: "contains"})], + protocol: "http", + socket: "", + domain: "", + headers: [new KeyValue()] + }; this.reload(); } this.$refs.envTable.setCurrentRow(0);