mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-19 23:50:25 +08:00
实现WAF策略部分功能
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<second-menu>
|
||||
<menu-item href="/servers/components/cache">列表</menu-item>
|
||||
<span class="item">|</span>
|
||||
<menu-item :href="'/servers/components/cache/policy?cachePolicyId=' + cachePolicyId" code="index">{{cachePolicyName}}</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/policy?cachePolicyId=' + cachePolicyId" code="index">{{cachePolicyName}}</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/test?cachePolicyId=' + cachePolicyId" code="test">测试</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/stat?cachePolicyId=' + cachePolicyId" code="stat">统计</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/stat?cachePolicyId=' + cachePolicyId" code="stat">统计</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/clean?cachePolicyId=' + cachePolicyId" code="clean">清理</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/purge?cachePolicyId=' + cachePolicyId" code="purge">删除</menu-item>
|
||||
<menu-item :href="'/servers/components/cache/preheat?cachePolicyId=' + cachePolicyId" code="preheat">预热</menu-item>
|
||||
|
||||
13
web/views/@default/servers/components/waf/@waf_menu.html
Normal file
13
web/views/@default/servers/components/waf/@waf_menu.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<second-menu>
|
||||
<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/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>
|
||||
<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/update?firewallPolicyId=' + firewallPolicyId" code="update">修改</menu-item>
|
||||
</second-menu>
|
||||
44
web/views/@default/servers/components/waf/createPopup.html
Normal file
44
web/views/@default/servers/components/waf/createPopup.html
Normal file
@@ -0,0 +1,44 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<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>启用预置的规则</td>
|
||||
<td>
|
||||
<div class="ui checkbox" v-for="group in groups" style="width:10em;margin-bottom:0.5em">
|
||||
<input type="checkbox" name="groupCodes" :value="group.code" :id="'group-checkbox-' + group.code" v-model="group.isOn"/>
|
||||
<label :for="'group-checkbox-' + group.code">{{group.name}}</label>
|
||||
</div>
|
||||
<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" 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>
|
||||
3
web/views/@default/servers/components/waf/createPopup.js
Normal file
3
web/views/@default/servers/components/waf/createPopup.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -2,5 +2,37 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
<second-menu>
|
||||
<menu-item href="/servers/components/waf" code="index">列表</menu-item>
|
||||
<span class="item">|</span>
|
||||
<a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
|
||||
</second-menu>
|
||||
|
||||
<p class="comment" v-if="policies.length == 0">暂时还没有WAF策略。</p>
|
||||
|
||||
<table class="ui table selectable" v-if="policies.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>策略名称</th>
|
||||
<th>入站规则分组</th>
|
||||
<th>出站规则分组</th>
|
||||
<th>引用服务</th>
|
||||
<th class="two wide">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="policy in policies">
|
||||
<td>{{policy.name}}</td>
|
||||
<td>{{policy.countInbound}}</td>
|
||||
<td>{{policy.countOutbound}}</td>
|
||||
<td>{{policy.countServers}}</td>
|
||||
<td><label-on :v-is-on="policy.isOn"></label-on></td>
|
||||
<td>
|
||||
<a :href="'/servers/components/waf/policy?firewallPolicyId=' + policy.id">详情</a>
|
||||
<a href="" @click.prevent="deletePolicy(policy.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
25
web/views/@default/servers/components/waf/index.js
Normal file
25
web/views/@default/servers/components/waf/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
Tea.context(function () {
|
||||
// 创建策略
|
||||
this.createPolicy = function () {
|
||||
teaweb.popup("/servers/components/waf/createPopup", {
|
||||
height: "27em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除策略
|
||||
this.deletePolicy = function (policyId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此WAF策略吗?", function () {
|
||||
that.$post("/servers/components/waf/delete")
|
||||
.params({
|
||||
firewallPolicyId: policyId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
})
|
||||
32
web/views/@default/servers/components/waf/policy.html
Normal file
32
web/views/@default/servers/components/waf/policy.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">策略名称</td>
|
||||
<td>{{firewallPolicy.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
<label-on :v-is-on="firewallPolicy.isOn"></label-on>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>预置的规则分组</td>
|
||||
<td>
|
||||
<span class="ui label tiny" v-for="group in firewallPolicy.groups" style="margin-bottom:0.5em" :class="{disabled:!group.isOn}">{{group.name}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
<span v-if="firewallPolicy.description.length > 0">{{firewallPolicy.description}}</span>
|
||||
<span v-else class="disabled">暂时还没有描述。</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
50
web/views/@default/servers/components/waf/update.html
Normal file
50
web/views/@default/servers/components/waf/update.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
{$template "waf_menu"}
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">策略名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus" v-model="firewallPolicy.name"/>
|
||||
<p class="comment">给策略起一个容易识别的名字。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>启用预置的规则</td>
|
||||
<td>
|
||||
<div class="ui checkbox" v-for="group in groups" style="width:10em;margin-bottom:0.5em">
|
||||
<input type="checkbox" name="groupCodes" :value="group.code" :id="'group-checkbox-' + group.code" v-model="group.isOn"/>
|
||||
<label :for="'group-checkbox-' + group.code">{{group.name}}</label>
|
||||
</div>
|
||||
<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" rows="3" v-model="firewallPolicy.description"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="isOn" value="1" v-model="firewallPolicy.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/components/waf/update.js
Normal file
3
web/views/@default/servers/components/waf/update.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifySuccess("保存成功", "/servers/components/waf/policy?firewallPolicyId=" + this.firewallPolicyId)
|
||||
})
|
||||
Reference in New Issue
Block a user