fix(系统设置): 修复环境设置中编辑下模块和路径匹配时模块和路径允许为空的缺陷

--bug=1010200 --user=王孝刚 【项目管理】github#9994,环境设置,建议模块和路径匹配时模块和路径不允许为空
https://www.tapd.cn/55049933/s/1109863
This commit is contained in:
wxg0103 2022-02-24 16:51:22 +08:00 committed by jianxing
parent dabcd53b6a
commit 3710188d32
1 changed files with 28 additions and 4 deletions

View File

@ -264,22 +264,46 @@ export default {
}); });
} else { } else {
this.condition.ids = []; this.condition.ids = [];
this.condition.details = []; this.$warning(this.$t('api_test.environment.module_warning'));
return;
} }
}, },
update() { update() {
const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id); const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id);
this.validateSocket(this.condition.socket); this.validateSocket(this.condition.socket);
let obj = { let obj = {
id: this.condition.id, type: this.condition.type, domain: this.condition.domain, socket: this.condition.socket, headers: this.condition.headers, id: this.condition.id,
protocol: this.condition.protocol, details: this.condition.details, port: this.condition.port, time: this.condition.time 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 (obj.type === "PATH") {
if (this.pathDetails.name === '') {
this.$warning(this.$t('api_test.environment.path_warning'));
return;
}
this.httpConfig.conditions[index].details = [this.pathDetails]; 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) { if (index !== -1) {
Vue.set(this.httpConfig.conditions[index], obj, 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.reload();
} }
this.$refs.envTable.setCurrentRow(0); this.$refs.envTable.setCurrentRow(0);