mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
缓存策略列表支持搜索
This commit is contained in:
@@ -16,8 +16,14 @@ func (this *IndexAction) Init() {
|
|||||||
this.FirstMenu("index")
|
this.FirstMenu("index")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *IndexAction) RunGet(params struct{}) {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
countResp, err := this.RPC().HTTPCachePolicyRPC().CountAllEnabledHTTPCachePolicies(this.AdminContext(), &pb.CountAllEnabledHTTPCachePoliciesRequest{})
|
Keyword string
|
||||||
|
}) {
|
||||||
|
this.Data["keyword"] = params.Keyword
|
||||||
|
|
||||||
|
countResp, err := this.RPC().HTTPCachePolicyRPC().CountAllEnabledHTTPCachePolicies(this.AdminContext(), &pb.CountAllEnabledHTTPCachePoliciesRequest{
|
||||||
|
Keyword: params.Keyword,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
@@ -27,8 +33,9 @@ func (this *IndexAction) RunGet(params struct{}) {
|
|||||||
this.Data["page"] = page.AsHTML()
|
this.Data["page"] = page.AsHTML()
|
||||||
|
|
||||||
listResp, err := this.RPC().HTTPCachePolicyRPC().ListEnabledHTTPCachePolicies(this.AdminContext(), &pb.ListEnabledHTTPCachePoliciesRequest{
|
listResp, err := this.RPC().HTTPCachePolicyRPC().ListEnabledHTTPCachePolicies(this.AdminContext(), &pb.ListEnabledHTTPCachePoliciesRequest{
|
||||||
Offset: page.Offset,
|
Keyword: params.Keyword,
|
||||||
Size: page.Size,
|
Offset: page.Offset,
|
||||||
|
Size: page.Size,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Vue.component("keyword", {
|
|||||||
let slot = this.$slots["default"][0]
|
let slot = this.$slots["default"][0]
|
||||||
let text = slot.text
|
let text = slot.text
|
||||||
if (word.length > 0) {
|
if (word.length > 0) {
|
||||||
text = text.replace(new RegExp(word, "g"), "<span style=\"border: 1px #ccc dashed\">" + word + "</span>")
|
text = text.replace(new RegExp(word, "g"), "<span style=\"border: 1px #ccc dashed; color: #ef4d58\">" + word + "</span>")
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,36 +1,49 @@
|
|||||||
{$layout}
|
{$layout}
|
||||||
|
|
||||||
<second-menu>
|
<first-menu>
|
||||||
<menu-item href="/servers/components/cache" code="index">列表</menu-item>
|
<menu-item href="/servers/components/cache" code="index">列表</menu-item>
|
||||||
<span class="item">|</span>
|
<span class="item">|</span>
|
||||||
<a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
|
<a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
|
||||||
</second-menu>
|
</first-menu>
|
||||||
|
|
||||||
<p class="comment" v-if="cachePolicies == null || cachePolicies.length == 0">暂时还没有缓存策略。</p>
|
<div class="margin"></div>
|
||||||
<table class="ui table selectable celled" v-if="cachePolicies != null && cachePolicies.length > 0">
|
<form class="ui form" method="get" action="/servers/components/cache">
|
||||||
<thead>
|
<div class="ui fields inline">
|
||||||
<tr>
|
<div class="ui field">
|
||||||
<th>策略名称</th>
|
<input type="text" name="keyword" v-model="keyword" placeholder="策略名称..."/>
|
||||||
<th>策略类型</th>
|
</div>
|
||||||
<th>容量</th>
|
<div class="ui field">
|
||||||
<th class="center">集群数</th>
|
<button type="submit" class="ui button">搜索</button>
|
||||||
<th class="center">状态</th>
|
</div>
|
||||||
<th class="two op">操作</th>
|
</div>
|
||||||
</tr>
|
</form>
|
||||||
</thead>
|
|
||||||
<tr v-for="(policy, index) in cachePolicies">
|
|
||||||
<td>{{policy.name}}</td>
|
|
||||||
<td>{{infos[index].typeName}} <span class="small">({{policy.type}})</span></td>
|
|
||||||
<td>
|
|
||||||
<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].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>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="page" v-html="page"></div>
|
|
||||||
|
<p class="comment" v-if="cachePolicies == null || cachePolicies.length == 0">暂时还没有缓存策略。</p>
|
||||||
|
<table class="ui table selectable celled" v-if="cachePolicies != null && cachePolicies.length > 0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>策略名称</th>
|
||||||
|
<th>策略类型</th>
|
||||||
|
<th>容量</th>
|
||||||
|
<th class="center">集群数</th>
|
||||||
|
<th class="center">状态</th>
|
||||||
|
<th class="two op">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr v-for="(policy, index) in cachePolicies">
|
||||||
|
<td><keyword :v-word="keyword">{{policy.name}}</keyword></td>
|
||||||
|
<td>{{infos[index].typeName}} <span class="small">({{policy.type}})</span></td>
|
||||||
|
<td>
|
||||||
|
<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].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>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="page" v-html="page"></div>
|
||||||
Reference in New Issue
Block a user