WAF规则中国家/地区、省份、城市、ISP增加候选项检索和选择

This commit is contained in:
GoEdgeLab
2022-06-14 17:38:50 +08:00
parent f80f2c65e8
commit f7d139e6ca
18 changed files with 467 additions and 43 deletions

View File

@@ -107,6 +107,29 @@
<!-- 其余数据 -->
<textarea rows="3" maxlength="4096" name="value" v-model="rule.value" @input="changeRuleValue" v-else></textarea>
<!-- 特殊规则 -->
<div style="margin-top: 1em">
<!-- geo country name -->
<div v-if="checkpoint != null && checkpoint.prefix == 'geoCountryName'" >
<combo-box title="已添加" width="14em" data-url="/ui/countryOptions" data-key="countries" placeholder="点这里选择国家/地区" @change="selectGeoCountryName" ref="countryComboBox" key="combo-box-country"></combo-box>
</div>
<!-- geo province name -->
<div v-if="checkpoint != null && checkpoint.prefix == 'geoProvinceName'" >
<combo-box title="已添加" data-url="/ui/provinceOptions" data-key="provinces" placeholder="点这里选择省份名称" @change="selectGeoProvinceName" ref="provinceComboBox" key="combo-box-province"></combo-box>
</div>
<!-- geo city name -->
<div v-if="checkpoint != null && checkpoint.prefix == 'geoCityName'" >
<combo-box title="已添加" data-url="/ui/cityOptions" data-key="cities" placeholder="点这里选择城市名称" @change="selectGeoCityName" ref="cityComboBox" key="combo-box-city"></combo-box>
</div>
<!-- ISP Name -->
<div v-if="checkpoint != null && checkpoint.prefix == 'ispName'" >
<combo-box title="已添加" data-url="/ui/providerOptions" data-key="providers" placeholder="点这里选择ISP名称" @change="selectISPName" ref="ispComboBox" key="combo-box-isp"></combo-box>
</div>
</div>
</td>
</tr>
<tr v-if="rule.operator == 'match' || rule.operator == 'not match'">

View File

@@ -121,4 +121,68 @@ Tea.context(function () {
this.regexpTestResult = resp.data.result
})
}
// isp
this.selectISPName = function (isp) {
if (isp == null) {
return
}
let ispName = isp.name
this.$refs.ispComboBox.clear()
if (this.rule.value.length == 0) {
this.rule.value = ispName
} else {
this.rule.value += "|" + ispName
}
}
// country
this.selectGeoCountryName = function (country) {
if (country == null) {
return
}
let countryName = country.name
this.$refs.countryComboBox.clear()
if (this.rule.value.length == 0) {
this.rule.value = countryName
} else {
this.rule.value += "|" + countryName
}
}
// province
this.selectGeoProvinceName = function (province) {
if (province == null) {
return
}
let provinceName = province.name
this.$refs.provinceComboBox.clear()
if (this.rule.value.length == 0) {
this.rule.value = provinceName
} else {
this.rule.value += "|" + provinceName
}
}
// city
this.selectGeoCityName = function (city) {
if (city == null) {
return
}
let cityName = city.name
this.$refs.cityComboBox.clear()
if (this.rule.value.length == 0) {
this.rule.value = cityName
} else {
this.rule.value += "|" + cityName
}
}
})