[WAF]规则支持导入导出

This commit is contained in:
GoEdgeLab
2020-12-02 16:09:23 +08:00
parent c83a05a123
commit ee999435e4
23 changed files with 781 additions and 10 deletions

View File

@@ -7,8 +7,8 @@
<menu-item :href="'/servers/components/waf/ipadmin?firewallPolicyId=' + firewallPolicyId" code="ipadmin">IP管理</menu-item>
<menu-item :href="'/servers/components/waf/log?firewallPolicyId=' + firewallPolicyId" code="log">拦截日志</menu-item>
<!-- TODO -->
<!--<menu-item :href="'/servers/components/waf/test?firewallPolicyId=' + firewallPolicyId" code="test">测试</menu-item>
<!--<menu-item :href="'/servers/components/waf/test?firewallPolicyId=' + firewallPolicyId" code="test">测试</menu-item>-->
<menu-item :href="'/servers/components/waf/import?firewallPolicyId=' + firewallPolicyId" code="import">导入</menu-item>
<menu-item :href="'/servers/components/waf/export?firewallPolicyId=' + firewallPolicyId" code="export">导出</menu-item>-->
<menu-item :href="'/servers/components/waf/export?firewallPolicyId=' + firewallPolicyId" code="export">导出</menu-item>
<menu-item :href="'/servers/components/waf/update?firewallPolicyId=' + firewallPolicyId" code="update">修改</menu-item>
</second-menu>

View File

@@ -0,0 +1,7 @@
.groups-box .group-box {
float: left;
width: 11em;
margin-top: 0.1em;
margin-bottom: 0.6em;
}
/*# sourceMappingURL=export.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["export.less"],"names":[],"mappings":"AAAA,WACC;EACC,WAAA;EACA,WAAA;EACA,iBAAA;EACA,oBAAA","file":"export.css"}

View File

@@ -1,5 +1,33 @@
{$layout}
{$template "waf_menu"}
{$template "waf_menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<p class="ui message">此功能暂未开放,敬请期待。</p>
<table class="ui table definition selectable">
<tr>
<td class="title">选择入站规则</td>
<td>
<span v-if="inboundGroups.length == 0" class="disabled">暂时还没有入站规则。</span>
<div class="groups-box" v-show="inboundGroups.length > 0">
<div v-for="g in inboundGroups" class="group-box">
<checkbox name="inboundGroupIds" :value="true" :v-value="g.id">{{g.name}}</checkbox>
</div>
</div>
</td>
</tr>
<tr>
<td>选择出站规则</td>
<td>
<span v-if="outboundGroups.length == 0" class="disabled">暂时还没有出站规则。</span>
<div class="groups-box" v-show="outboundGroups.length > 0">
<div v-for="g in outboundGroups" class="group-box">
<checkbox name="outboundGroupIds" :value="true" :v-value="g.id">{{g.name}}</checkbox>
</div>
</div>
</td>
</tr>
</table>
<submit-btn>导出</submit-btn>
</form>

View File

@@ -0,0 +1,5 @@
Tea.context(function () {
this.success = function (resp) {
window.location = "/servers/components/waf/exportDownload?key=" + resp.data.key
}
})

View File

@@ -0,0 +1,8 @@
.groups-box {
.group-box {
float: left;
width: 11em;
margin-top: 0.1em;
margin-bottom: 0.6em;
}
}

View File

@@ -1,5 +1,16 @@
{$layout}
{$template "waf_menu"}
{$template "waf_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">选择要倒入的规则文件</td>
<td>
<input type="file" name="file" accept=".json"/>
</td>
</tr>
</table>
<submit-btn>导入</submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("导入成功")
})