Files
EdgeAdmin/web/public/js/components/server/http-firewall-config-box.js
2022-03-16 17:07:46 +08:00

45 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Vue.component("http-firewall-config-box", {
props: ["v-firewall-config", "v-is-location", "v-is-group", "v-firewall-policy"],
data: function () {
let firewall = this.vFirewallConfig
if (firewall == null) {
firewall = {
isPrior: false,
isOn: false,
firewallPolicyId: 0
}
}
return {
firewall: firewall
}
},
template: `<div>
<input type="hidden" name="firewallJSON" :value="JSON.stringify(firewall)"/>
<table class="ui table selectable definition">
<prior-checkbox :v-config="firewall" v-if="vIsLocation || vIsGroup"></prior-checkbox>
<tbody v-show="(!vIsLocation && !vIsGroup) || firewall.isPrior">
<tr v-show="!vIsGroup">
<td>WAF策略</td>
<td>
<div v-if="vFirewallPolicy != null">{{vFirewallPolicy.name}} <span v-if="vFirewallPolicy.modeInfo != null">&nbsp; <span :class="{green: vFirewallPolicy.modeInfo.code == 'defend', blue: vFirewallPolicy.modeInfo.code == 'observe', grey: vFirewallPolicy.modeInfo.code == 'bypass'}">[{{vFirewallPolicy.modeInfo.name}}]</span>&nbsp;</span> <link-icon :href="'/servers/components/waf/policy?firewallPolicyId=' + vFirewallPolicy.id"></link-icon>
<p class="comment">使用当前服务所在集群的设置。</p>
</div>
<span v-else class="red">当前集群没有设置WAF策略当前配置无法生效。</span>
</td>
</tr>
<tr>
<td class="title">启用WAF</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="firewall.isOn"/>
<label></label>
</div>
<p class="comment">启用WAF之后各项WAF设置才会生效。</p>
</td>
</tr>
</tbody>
</table>
<div class="margin"></div>
</div>`
})