ssr_degrade.hbs
2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
<li>SSR自适应降级</li>
</ul>
<h4>配置列表</h4>
</div>
</div>
<!-- media -->
</div>
<style>
.degrades-ul {
list-style: none;
margin: 0;
padding: 0;
}
</style>
<!-- pageheader -->
<style>
.li-degrade, .td-degrade {
color: red;
}
</style>
<div class="contentpanel servers-page">
<button type="button" class="btn btn-success add">新增配置</button>
<table class="table table-hover table-striped table-bordered" style="margin-top: 2rem">
<thead>
<tr>
<th>应用名称</th>
<th>降级条件</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{{#list}}
<tr>
<td>{{app}}</td>
<td>
<ul class="degrades-ul">
{{#degrades}}
<li class="{{#if status}}li-degrade{{/if}}">
{{time}}秒内平均qps大于{{tick}},{{delay}}分钟内未触发则恢复{{#if status}}-[已触发]{{/if}}
</li>
{{/degrades}}
</ul>
</td>
<td class="{{#if status}}td-degrade{{/if}}">{{#if status}}已降级{{^}}正常{{/if}}</td>
<td><button data-app="{{app}}" type="button" class="btn btn-success edit">编辑</button><button data-app="{{app}}" type="button" class="btn btn-danger ml10 del">删除</button></td>
</tr>
{{/list}}
{{#if noData}}
<tr>
<td colspan="4" class="text-center">无数据</td>
</tr>
{{/if}}
</tbody>
</table>
</div>
<script>
$('.add').on('click', function() {
location.href = '/ssr_degrade/edit';
});
$('.del').on('click', function() {
var app = $(this).data('app');
var confirmed = confirm('是否删除?')
if (confirmed) {
$.get('/ssr_degrade/delete', {
app
}, function(ret) {
if (ret.code === 200) {
alert('删除成功!');
location.reload();
} else {
alert('删除失败!');
}
});
}
});
$('.edit').on('click', function() {
var app = $(this).data('app');
location.href = '/ssr_degrade/edit?app=' + app;
});
</script>