mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-17 22:30:25 +08:00
实现WAF部分功能
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
<menu-item href="/servers/components/waf">列表</menu-item>
|
||||
<span class="item">|</span>
|
||||
<menu-item :href="'/servers/components/waf/policy?firewallPolicyId=' + firewallPolicyId" code="index">{{firewallPolicyName}}</menu-item>
|
||||
<menu-item :href="'/servers/components/waf/groups?type=firewallPolicyId=' + firewallPolicyId + '&type=inbound'" code="inbound">入站规则集({{countInboundGroups}})</menu-item>
|
||||
<menu-item :href="'/servers/components/waf/groups?firewallPolicyId=' + firewallPolicyId + '&type=outbound'" code="outbound">出站规则集({{countOutboundGroups}})</menu-item>
|
||||
<menu-item :href="'/servers/components/waf/groups?firewallPolicyId=' + firewallPolicyId + '&type=inbound'" code="inbound">入站规则({{countInboundGroups}})</menu-item>
|
||||
<menu-item :href="'/servers/components/waf/groups?firewallPolicyId=' + firewallPolicyId + '&type=outbound'" code="outbound">出站规则({{countOutboundGroups}})</menu-item>
|
||||
<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>
|
||||
<menu-item :href="'/servers/components/waf/test?firewallPolicyId=' + firewallPolicyId" code="test">测试</menu-item>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>添加分组</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
|
||||
<input type="hidden" name="type" :value="type"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">分组名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus"/>
|
||||
<p class="comment">给分组起一个容易识别的名称</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>分组描述</td>
|
||||
<td>
|
||||
<textarea name="description" maxlength="200" rows="3"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="isOn" value="1" checked="checked"/>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
8
web/views/@default/servers/components/waf/export.html
Normal file
8
web/views/@default/servers/components/waf/export.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
</div>
|
||||
45
web/views/@default/servers/components/waf/groups.html
Normal file
45
web/views/@default/servers/components/waf/groups.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<second-menu style="margin-top:-1em">
|
||||
<a href="" class="item" @click.prevent="createGroup(type)">[添加分组]</a>
|
||||
</second-menu>
|
||||
|
||||
<p class="comment" v-if="groups.length == 0">暂时还没有规则分组。</p>
|
||||
|
||||
<table class="ui table selectable" v-if="groups.length > 0" id="sortable-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:3em"></th>
|
||||
<th>规则分组</th>
|
||||
<th>规则集</th>
|
||||
<th class="three op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody v-for="group in groups" :data-group-id="group.id">
|
||||
<tr>
|
||||
<td style="text-align: center;"><i class="icon bars handle grey" title="拖动排序"></i> </td>
|
||||
<td><span :class="{disabled:!group.isOn}">{{group.name}}</span>
|
||||
<p class="comment" v-if="group.description.length > 0" style="padding-bottom:0">{{group.description}}</p>
|
||||
<p>
|
||||
<span v-if="group.isOn" class="ui label tiny green">启用</span>
|
||||
<span v-if="!group.isOn" class="ui label tiny red">停用</span>
|
||||
<span v-if="group.code.length > 0" class="ui label tiny">预置</span>
|
||||
<span v-if="group.code.length == 0" class="ui label tiny">自定义</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/proxy/components/waf/sets?firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">{{group.countSets}}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/servers/components/waf/group?firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">详情</a>
|
||||
<a href="" v-if="!group.isOn" @click.prevent="enableGroup(group.id)">启用</a><a href="" v-if="group.isOn" @click.prevent="disableGroup(group.id)">停用</a>
|
||||
<a href="" @click.prevent="deleteGroup(group.id)" v-if="group.canDelete">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
68
web/views/@default/servers/components/waf/groups.js
Normal file
68
web/views/@default/servers/components/waf/groups.js
Normal file
@@ -0,0 +1,68 @@
|
||||
Tea.context(function () {
|
||||
// 排序
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
sortTable(function () {
|
||||
let groupIds = []
|
||||
document.querySelectorAll("tbody[data-group-id]")
|
||||
.forEach(function (v) {
|
||||
groupIds.push(v.getAttribute("data-group-id"))
|
||||
})
|
||||
|
||||
that.$post(".sortGroups")
|
||||
.params({
|
||||
firewallPolicyId: that.firewallPolicyId,
|
||||
type: that.type,
|
||||
groupIds: groupIds
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successToast("排序保存成功")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// 启用
|
||||
this.enableGroup = function (groupId) {
|
||||
this.$post(".updateGroupOn")
|
||||
.params({
|
||||
groupId: groupId,
|
||||
isOn: 1
|
||||
})
|
||||
.refresh()
|
||||
|
||||
}
|
||||
|
||||
// 停用
|
||||
this.disableGroup = function (groupId) {
|
||||
this.$post(".updateGroupOn")
|
||||
.params({
|
||||
groupId: groupId,
|
||||
isOn: 0
|
||||
})
|
||||
.refresh()
|
||||
}
|
||||
|
||||
// 删除
|
||||
this.deleteGroup = function (groupId) {
|
||||
teaweb.confirm("确定要删除此规则分组吗?", function () {
|
||||
this.$post(".deleteGroup")
|
||||
.params({
|
||||
firewallPolicyId: this.firewallPolicyId,
|
||||
groupId: groupId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
// 添加分组
|
||||
this.createGroup = function (type) {
|
||||
teaweb.popup("/servers/components/waf/createGroupPopup?firewallPolicyId=" + this.firewallPolicyId + "&type=" + type, {
|
||||
height: "16em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
8
web/views/@default/servers/components/waf/import.html
Normal file
8
web/views/@default/servers/components/waf/import.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
</div>
|
||||
8
web/views/@default/servers/components/waf/ipadmin.html
Normal file
8
web/views/@default/servers/components/waf/ipadmin.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
</div>
|
||||
8
web/views/@default/servers/components/waf/log.html
Normal file
8
web/views/@default/servers/components/waf/log.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
</div>
|
||||
8
web/views/@default/servers/components/waf/test.html
Normal file
8
web/views/@default/servers/components/waf/test.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
</div>
|
||||
Reference in New Issue
Block a user