fix(系统设置): 修复环境设置中编辑下模块和路径匹配时模块和路径允许为空的缺陷
--bug=1010200 --user=王孝刚 【项目管理】github#9994,环境设置,建议模块和路径匹配时模块和路径不允许为空 https://www.tapd.cn/55049933/s/1109863
This commit is contained in:
parent
95a9f396aa
commit
7662880d4e
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue