mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-03-31 09:55:18 +08:00
集群可以设置默认的WAF策略、缓存策略
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Vue.component("http-cache-config-box", {
|
||||
props: ["v-cache-config", "v-cache-policies", "v-is-location"],
|
||||
props: ["v-cache-config", "v-is-location", "v-cache-policy"],
|
||||
data: function () {
|
||||
let cacheConfig = this.vCacheConfig
|
||||
if (cacheConfig == null) {
|
||||
@@ -86,6 +86,15 @@ Vue.component("http-cache-config-box", {
|
||||
<table class="ui table definition selectable">
|
||||
<prior-checkbox :v-config="cacheConfig" v-if="vIsLocation"></prior-checkbox>
|
||||
<tbody v-show="!vIsLocation || cacheConfig.isPrior">
|
||||
<tr>
|
||||
<td>缓存策略</td>
|
||||
<td>
|
||||
<div v-if="vCachePolicy != null">{{vCachePolicy.name}}
|
||||
<p class="comment">使用当前服务所在集群的设置。</p>
|
||||
</div>
|
||||
<span v-else class="red">当前集群没有设置缓存策略,当前配置无法生效。</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">是否开启缓存</td>
|
||||
<td>
|
||||
@@ -102,13 +111,11 @@ Vue.component("http-cache-config-box", {
|
||||
<table class="ui table selectable" v-show="cacheConfig.cacheRefs.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>缓存策略</th>
|
||||
<th>条件</th>
|
||||
<th>缓存时间</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
<tr v-for="(cacheRef, index) in cacheConfig.cacheRefs">
|
||||
<td><a :href="'/servers/components/cache/policy?cachePolicyId=' + cacheRef.cachePolicyId">{{cacheRef.cachePolicy.name}}</a></td>
|
||||
<td>
|
||||
<http-request-conds-view :v-conds="cacheRef.conds"></http-request-conds-view>
|
||||
</td>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
Vue.component("http-cache-policy-selector", {
|
||||
props: ["v-cache-policy"],
|
||||
mounted: function () {
|
||||
let that = this
|
||||
Tea.action("/servers/components/cache/count")
|
||||
.post()
|
||||
.success(function (resp) {
|
||||
that.count = resp.data.count
|
||||
})
|
||||
},
|
||||
data: function () {
|
||||
let cachePolicy = this.vCachePolicy
|
||||
return {
|
||||
count: 0,
|
||||
cachePolicy: cachePolicy
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
remove: function () {
|
||||
this.cachePolicy = null
|
||||
},
|
||||
select: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/cache/selectPopup", {
|
||||
callback: function (resp) {
|
||||
that.cachePolicy = resp.data.cachePolicy
|
||||
}
|
||||
})
|
||||
},
|
||||
create: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/cache/createPopup", {
|
||||
height: "26em",
|
||||
callback: function (resp) {
|
||||
that.cachePolicy = resp.data.cachePolicy
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div v-if="cachePolicy != null" class="ui label basic">
|
||||
<input type="hidden" name="cachePolicyId" :value="cachePolicy.id"/>
|
||||
{{cachePolicy.name}} <a :href="'/servers/components/cache/policy?cachePolicyId=' + cachePolicy.id" target="_blank"><i class="icon pencil small"></i></a> <a href="" @click.prevent="remove()"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
<div v-if="cachePolicy == null">
|
||||
<span v-if="count > 0"><a href="" @click.prevent="select">[选择已有策略]</a> </span><a href="" @click.prevent="create">[创建新策略]</a>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
@@ -43,7 +43,7 @@ Vue.component("http-cache-ref-box", {
|
||||
},
|
||||
template: `<tbody>
|
||||
<tr>
|
||||
<td>匹配条件 *</td>
|
||||
<td class="title">匹配条件 *</td>
|
||||
<td>
|
||||
<http-request-conds-box :v-conds="ref.conds" @change="changeConds"></http-request-conds-box>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Vue.component("http-firewall-config-box", {
|
||||
props: ["v-firewall-config", "v-firewall-policies", "v-is-location"],
|
||||
props: ["v-firewall-config", "v-is-location", "v-firewall-policy"],
|
||||
data: function () {
|
||||
let firewall = this.vFirewallConfig
|
||||
if (firewall == null) {
|
||||
@@ -11,22 +11,7 @@ Vue.component("http-firewall-config-box", {
|
||||
}
|
||||
|
||||
return {
|
||||
firewall: firewall,
|
||||
selectedPolicy: this.lookupPolicy(firewall.firewallPolicyId)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changePolicyId: function () {
|
||||
this.firewall.firewallPolicyId = parseInt(this.firewall.firewallPolicyId)
|
||||
this.selectedPolicy = this.lookupPolicy(this.firewall.firewallPolicyId)
|
||||
},
|
||||
lookupPolicy: function (policyId) {
|
||||
if (policyId <= 0) {
|
||||
return null
|
||||
}
|
||||
return this.vFirewallPolicies.$find(function (k, v) {
|
||||
return v.id == policyId
|
||||
})
|
||||
firewall: firewall
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
@@ -34,6 +19,15 @@ Vue.component("http-firewall-config-box", {
|
||||
<table class="ui table selectable definition">
|
||||
<prior-checkbox :v-config="firewall" v-if="vIsLocation"></prior-checkbox>
|
||||
<tbody v-show="!vIsLocation || firewall.isPrior">
|
||||
<tr>
|
||||
<td>WAF策略</td>
|
||||
<td>
|
||||
<div v-if="vFirewallPolicy != null">{{vFirewallPolicy.name}}
|
||||
<p class="comment">使用当前服务所在集群的设置。</p>
|
||||
</div>
|
||||
<span v-else class="red">当前集群没有设置WAF策略,当前配置无法生效。</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">是否启用Web防火墙</td>
|
||||
<td>
|
||||
@@ -44,21 +38,6 @@ Vue.component("http-firewall-config-box", {
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-show="(!vIsLocation || firewall.isPrior) && firewall.isOn">
|
||||
<tr>
|
||||
<td>选择Web防火墙策略</td>
|
||||
<td>
|
||||
<span class="disabled" v-if="vFirewallPolicies.length == 0">暂时还没有防火墙策略</span>
|
||||
<div v-if="vFirewallPolicies.length > 0">
|
||||
<select class="ui dropdown auto-width" v-model="firewall.firewallPolicyId" @change="changePolicyId">
|
||||
<option value="0">[请选择]</option>
|
||||
<option v-for="policy in vFirewallPolicies" :value="policy.id">{{policy.name}}</option>
|
||||
</select>
|
||||
<p class="comment" v-if="selectedPolicy != null"><span v-if="!selectedPolicy.isOn" class="red">[正在停用的策略]</span>{{selectedPolicy.description}} <a :href="'/servers/components/waf/policy?firewallPolicyId=' + selectedPolicy.id">详情»</a> </p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
Vue.component("http-firewall-policy-selector", {
|
||||
props: ["v-http-firewall-policy"],
|
||||
mounted: function () {
|
||||
let that = this
|
||||
Tea.action("/servers/components/waf/count")
|
||||
.post()
|
||||
.success(function (resp) {
|
||||
that.count = resp.data.count
|
||||
})
|
||||
},
|
||||
data: function () {
|
||||
let firewallPolicy = this.vHttpFirewallPolicy
|
||||
return {
|
||||
count: 0,
|
||||
firewallPolicy: firewallPolicy
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
remove: function () {
|
||||
this.firewallPolicy = null
|
||||
},
|
||||
select: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/waf/selectPopup", {
|
||||
callback: function (resp) {
|
||||
that.firewallPolicy = resp.data.firewallPolicy
|
||||
}
|
||||
})
|
||||
},
|
||||
create: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/waf/createPopup", {
|
||||
height: "26em",
|
||||
callback: function (resp) {
|
||||
that.firewallPolicy = resp.data.firewallPolicy
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div v-if="firewallPolicy != null" class="ui label basic">
|
||||
<input type="hidden" name="httpFirewallPolicyId" :value="firewallPolicy.id"/>
|
||||
{{firewallPolicy.name}} <a :href="'/servers/components/waf/policy?firewallPolicyId=' + firewallPolicy.id" target="_blank"><i class="icon pencil small"></i></a> <a href="" @click.prevent="remove()"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
<div v-if="firewallPolicy == null">
|
||||
<span v-if="count > 0"><a href="" @click.prevent="select">[选择已有策略]</a> </span><a href="" @click.prevent="create">[创建新策略]</a>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
19
web/views/@default/clusters/cluster/settings/cache/index.html
vendored
Normal file
19
web/views/@default/clusters/cluster/settings/cache/index.html
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<form class="ui form" method="post" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">选择缓存策略 *</td>
|
||||
<td>
|
||||
<http-cache-policy-selector :v-cache-policy="cachePolicy"></http-cache-policy-selector>
|
||||
<p class="comment">部署在当前集群上的所有服务都会自动使用此策略,只是服务可以自定义是否开启。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/clusters/cluster/settings/cache/index.js
vendored
Normal file
3
web/views/@default/clusters/cluster/settings/cache/index.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
19
web/views/@default/clusters/cluster/settings/waf/index.html
Normal file
19
web/views/@default/clusters/cluster/settings/waf/index.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<form class="ui form" method="post" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">选择WAF策略 *</td>
|
||||
<td>
|
||||
<http-firewall-policy-selector :v-http-firewall-policy="firewallPolicy"></http-firewall-policy-selector>
|
||||
<p class="comment">部署在当前集群上的所有服务都会自动使用此策略,只是服务可以自定义是否开启。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -9,6 +9,18 @@
|
||||
<td class="title">集群名称 *</td>
|
||||
<td><input type="text" name="name" maxlength="50" ref="focus"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>默认缓存设置 *</td>
|
||||
<td>
|
||||
<http-cache-policy-selector></http-cache-policy-selector>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>默认WAF设置 *</td>
|
||||
<td>
|
||||
<http-firewall-policy-selector></http-firewall-policy-selector>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>节点安装选项</h4>
|
||||
|
||||
@@ -2,18 +2,12 @@
|
||||
|
||||
<h3>选择认证</h3>
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="grantId" :value="grantId"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">选择认证</td>
|
||||
<td>
|
||||
<span v-if="grants.length == 0">暂时还没有可用的认证。</span>
|
||||
<a class="ui label small basic" v-for="grant in grants" :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)" style="margin-bottom:0.5em">{{grant.name}} <span class="small">({{grant.methodName}})</span></a>
|
||||
<p class="comment">请点击选中某个认证。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<submit-btn>确定</submit-btn>
|
||||
</form>
|
||||
<table class="ui table definition">
|
||||
<tr>
|
||||
<td>
|
||||
<span v-if="grants.length == 0">暂时还没有可用的认证。</span>
|
||||
<a class="ui label small basic" v-for="grant in grants" :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)" style="margin-bottom:0.5em">{{grant.name}} <span class="small">({{grant.methodName}})</span></a>
|
||||
<p class="comment">请点击选中某个认证。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -2,8 +2,11 @@ Tea.context(function () {
|
||||
this.grantId = 0;
|
||||
|
||||
this.selectGrant = function (grant) {
|
||||
this.grantId = grant.id;
|
||||
NotifyPopup({
|
||||
code: 200,
|
||||
data: {
|
||||
grant: grant
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
this.success = NotifyPopup;
|
||||
});
|
||||
@@ -13,7 +13,7 @@
|
||||
<th>策略名称</th>
|
||||
<th>策略类型</th>
|
||||
<th>容量</th>
|
||||
<th class="center">引用服务</th>
|
||||
<th class="center">集群数</th>
|
||||
<th class="center">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
@@ -25,7 +25,7 @@
|
||||
<span v-if="policy.capacity != null && policy.capacity.count > 0">{{policy.capacity.count}}{{policy.capacity.unit.toUpperCase()}}</span>
|
||||
<span v-else class="disabled">不限</span>
|
||||
</td>
|
||||
<td class="center">{{infos[index].countServers}}</td>
|
||||
<td class="center">{{infos[index].countClusters}}</td>
|
||||
<td class="center"><label-on :v-is-on="policy.isOn"></label-on></td>
|
||||
<td>
|
||||
<a :href="'/servers/components/cache/policy?cachePolicyId=' + policy.id">详情</a> <a href="" @click.prevent="deletePolicy(policy.id)">删除</a>
|
||||
|
||||
@@ -1,67 +1,74 @@
|
||||
{$layout}
|
||||
{$template "policy_menu"}
|
||||
|
||||
{$template "policy_menu"}
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">策略名称</td>
|
||||
<td>{{cachePolicy.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态</td>
|
||||
<td><label-on :v-is-on="cachePolicy.isOn"></label-on></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="color-border">缓存类型</td>
|
||||
<td>
|
||||
{{typeName}}<span class="small">({{cachePolicy.type}})</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">策略名称</td>
|
||||
<td>{{cachePolicy.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态</td>
|
||||
<td><label-on :v-is-on="cachePolicy.isOn"></label-on></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="color-border">缓存类型</td>
|
||||
<td>
|
||||
{{typeName}}<span class="small">({{cachePolicy.type}})</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 文件缓存选项 -->
|
||||
<tbody v-if="cachePolicy.type == 'file'">
|
||||
<tr>
|
||||
<td class="color-border">缓存目录</td>
|
||||
<td>
|
||||
{{cachePolicy.options.dir}}
|
||||
<p class="comment">存放文件缓存的目录,通常填写绝对路径。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!-- 文件缓存选项 -->
|
||||
<tbody v-if="cachePolicy.type == 'file'">
|
||||
<tr>
|
||||
<td class="color-border">缓存目录</td>
|
||||
<td>
|
||||
{{cachePolicy.options.dir}}
|
||||
<p class="comment">存放文件缓存的目录,通常填写绝对路径。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>缓存最大容量</td>
|
||||
<td>
|
||||
<size-capacity-view :v-value="cachePolicy.capacity" :v-default-text="'不限'"></size-capacity-view>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>最大内容长度</td>
|
||||
<td>
|
||||
<size-capacity-view :v-value="cachePolicy.maxSize" :v-default-text="'不限'"></size-capacity-view>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>容纳Key数量</td>
|
||||
<td>
|
||||
<span v-if="cachePolicy.maxKeys > 0">{{cachePolicy.maxKeys}}</span>
|
||||
<span v-else>不限</span>
|
||||
<p class="comment">可以容纳多少数量的Key,0表示不限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
<span v-if="cachePolicy.description.length > 0">{{cachePolicy.description}}</span>
|
||||
<span v-else class="disabled">暂时还没有描述。</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<td>缓存最大容量</td>
|
||||
<td>
|
||||
<size-capacity-view :v-value="cachePolicy.capacity" :v-default-text="'不限'"></size-capacity-view>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>最大内容长度</td>
|
||||
<td>
|
||||
<size-capacity-view :v-value="cachePolicy.maxSize" :v-default-text="'不限'"></size-capacity-view>
|
||||
<p class="comment">允许缓存的最大内容长度,如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>容纳Key数量</td>
|
||||
<td>
|
||||
<span v-if="cachePolicy.maxKeys > 0">{{cachePolicy.maxKeys}}</span>
|
||||
<span v-else>不限</span>
|
||||
<p class="comment">可以容纳多少数量的Key,0表示不限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
<span v-if="cachePolicy.description.length > 0">{{cachePolicy.description}}</span>
|
||||
<span v-else class="disabled">暂时还没有描述。</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4>使用此策略的集群</h4>
|
||||
<p class="comment" v-if="clusters.length == 0">暂时还没有集群使用此策略。</p>
|
||||
<table class="ui table selectable" v-if="clusters.length > 0">
|
||||
<tr v-for="cluster in clusters">
|
||||
<td>{{cluster.name}}<link-icon :href="'/clusters/cluster?clusterId=' + cluster.id"></link-icon></td>
|
||||
</tr>
|
||||
</table>
|
||||
24
web/views/@default/servers/components/cache/selectPopup.html
vendored
Normal file
24
web/views/@default/servers/components/cache/selectPopup.html
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>选择缓存策略</h3>
|
||||
<table class="ui table selectable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>策略名称</th>
|
||||
<th style="width: 7em">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="cachePolicy in cachePolicies">
|
||||
<td>{{cachePolicy.name}}</td>
|
||||
<td>
|
||||
<label-on :v-is-on="cachePolicy.isOn"></label-on>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="cachePolicy.isOn">
|
||||
<a href="" @click.prevent="selectPolicy(cachePolicy)">选择</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="page" v-html="page"></div>
|
||||
11
web/views/@default/servers/components/cache/selectPopup.js
vendored
Normal file
11
web/views/@default/servers/components/cache/selectPopup.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
Tea.context(function () {
|
||||
this.selectPolicy = function (cachePolicy) {
|
||||
NotifyPopup({
|
||||
code: 200,
|
||||
data: {
|
||||
cachePolicy: cachePolicy
|
||||
},
|
||||
message: ""
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -14,7 +14,7 @@
|
||||
<th>策略名称</th>
|
||||
<th class="center">入站规则分组</th>
|
||||
<th class="center">出站规则分组</th>
|
||||
<th class="center">引用服务</th>
|
||||
<th class="center">集群数</th>
|
||||
<th class="two wide center">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
@@ -23,7 +23,7 @@
|
||||
<td>{{policy.name}}</td>
|
||||
<td class="center">{{policy.countInbound}}</td>
|
||||
<td class="center">{{policy.countOutbound}}</td>
|
||||
<td class="center">{{policy.countServers}}</td>
|
||||
<td class="center">{{policy.countClusters}}</td>
|
||||
<td class="center"><label-on :v-is-on="policy.isOn"></label-on></td>
|
||||
<td>
|
||||
<a :href="'/servers/components/waf/policy?firewallPolicyId=' + policy.id">详情</a>
|
||||
|
||||
@@ -1,55 +1,54 @@
|
||||
{$layout}
|
||||
{$template "waf_menu"}
|
||||
|
||||
{$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 basic" 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.blockOptions == null" class="disabled">还没有设置。</span>
|
||||
<div v-else>
|
||||
<table class="ui table">
|
||||
<tr>
|
||||
<td class="title">状态码</td>
|
||||
<td>{{firewallPolicy.blockOptions.statusCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>提示内容</td>
|
||||
<td>{{firewallPolicy.blockOptions.body}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<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 basic" 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.blockOptions == null" class="disabled">还没有设置。</span>
|
||||
<div v-else>
|
||||
<table class="ui table">
|
||||
<tr>
|
||||
<td class="title">状态码</td>
|
||||
<td>{{firewallPolicy.blockOptions.statusCode}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>提示内容</td>
|
||||
<td>{{firewallPolicy.blockOptions.body}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<h4>使用此策略的服务</h4>
|
||||
<p class="comment" v-if="servers.length == 0">暂时还没有代理服务使用此策略。</p>
|
||||
<table class="ui table selectable" v-if="servers.length > 0">
|
||||
<tr v-for="server in servers">
|
||||
<td>{{server.name}}<link-icon :href="'/servers/server?serverId=' + server.id"></link-icon></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h4>使用此策略的集群</h4>
|
||||
<p class="comment" v-if="clusters.length == 0">暂时还没有集群使用此策略。</p>
|
||||
<table class="ui table selectable" v-if="clusters.length > 0">
|
||||
<tr v-for="cluster in clusters">
|
||||
<td>{{cluster.name}}<link-icon :href="'/clusters/cluster?clusterId=' + cluster.id"></link-icon></td>
|
||||
</tr>
|
||||
</table>
|
||||
24
web/views/@default/servers/components/waf/selectPopup.html
Normal file
24
web/views/@default/servers/components/waf/selectPopup.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>选择WAF策略</h3>
|
||||
<table class="ui table selectable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>策略名称</th>
|
||||
<th style="width: 7em">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="policy in policies">
|
||||
<td>{{policy.name}}</td>
|
||||
<td>
|
||||
<label-on :v-is-on="policy.isOn"></label-on>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="policy.isOn">
|
||||
<a href="" @click.prevent="selectPolicy(policy)">选择</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="page" v-html="page"></div>
|
||||
11
web/views/@default/servers/components/waf/selectPopup.js
Normal file
11
web/views/@default/servers/components/waf/selectPopup.js
Normal file
@@ -0,0 +1,11 @@
|
||||
Tea.context(function () {
|
||||
this.selectPolicy = function (firewallPolicy) {
|
||||
NotifyPopup({
|
||||
code: 200,
|
||||
data: {
|
||||
firewallPolicy: firewallPolicy
|
||||
},
|
||||
message: ""
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -4,14 +4,6 @@
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">缓存策略 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="cachePolicyId" v-model="cachePolicyId">
|
||||
<option v-for="cachePolicy in cachePolicies" :value="cachePolicy.id">{{cachePolicy.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody is="http-cache-ref-box" :v-cache-ref="cacheRef"></tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
|
||||
@@ -2,16 +2,7 @@ Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
this.cacheRef = null
|
||||
|
||||
let cachePolicyId = 0
|
||||
if (this.cachePolicies.length > 0) {
|
||||
cachePolicyId = this.cachePolicies[0].id
|
||||
}
|
||||
if (window.parent.UPDATING_CACHE_REF != null) {
|
||||
let cacheRef = window.parent.UPDATING_CACHE_REF
|
||||
this.cacheRef = cacheRef
|
||||
if (cacheRef.cachePolicy != null) {
|
||||
cachePolicyId = cacheRef.cachePolicy.id
|
||||
}
|
||||
this.cacheRef = window.parent.UPDATING_CACHE_REF
|
||||
}
|
||||
this.cachePolicyId = cachePolicyId
|
||||
})
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="right-box">
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<http-cache-config-box :v-cache-config="cacheConfig"></http-cache-config-box>
|
||||
<http-cache-config-box :v-cache-config="cacheConfig" :v-cache-policy="cachePolicy"></http-cache-config-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="right-box tiny">
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<http-cache-config-box :v-cache-config="cacheConfig" :v-is-location="true"></http-cache-config-box>
|
||||
<http-cache-config-box :v-cache-config="cacheConfig" :v-cache-policy="cachePolicy" :v-is-location="true"></http-cache-config-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="right-box tiny">
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policies="firewallPolicies" :v-is-location="true"></http-firewall-config-box>
|
||||
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policy="firewallPolicy" :v-is-location="true"></http-firewall-config-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policies="firewallPolicies"></http-firewall-config-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policy="firewallPolicy"></http-firewall-config-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user