transactionRuleUpdate.jsp
3.62 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
<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<jsp:useBean id="ctx" type="com.dianping.cat.system.page.config.Context" scope="request"/>
<jsp:useBean id="payload" type="com.dianping.cat.system.page.config.Payload" scope="request"/>
<jsp:useBean id="model" type="com.dianping.cat.system.page.config.Model" scope="request"/>
<a:config>
<h3 class="text-center text-success">编辑Transaction监控规则</h3>
<form name="transactionRuleUpdate" id="form" method="post">
<table style='width:100%' class='table table-striped table-condensed '>
<c:set var="conditions" value="${fn:split(payload.ruleId, ';')}" />
<c:set var="domain" value="${conditions[0]}" />
<c:set var="type" value="${conditions[1]}" />
<c:set var="name" value="${conditions[2]}" />
<c:set var="monitor" value="${conditions[3]}" />
<tr>
<td> 项目 <input name="domain" id="domain" value="${domain}"/>
Type <input name="type" id="type" value="${type}"/>
Name <input name="name" id="name" value="${name}"/>(默认为All)
监控项 <select name="monitor" id="monitor" style="width:200px;">
<option value="count">执行次数</option>
<option value="avg">响应时间</option>
<option value="failRatio">失败率</option>
</select>
</tr>
<tr><th>${model.content}</th></tr>
<tr>
<td style='text-align:center' colspan='2'><input class="btn btn-primary btn-sm" id="ruleSubmitButton" type="text" name="submit" value="提交"></button></td>
</tr>
</table>
</form>
</a:config>
<script type="text/javascript">
function update() {
var configStr = generateConfigsJsonString();
var domain = $("#domain").val().trim();
if(domain == "undefined" || domain == ""){
if($("#errorMessage").length == 0){
$("#domain").after($("<span class=\"text-danger\" id=\"errorMessage\"> 该字段不能为空</span>"));
}
return;
}
var type = $("#type").val().trim();
if(type == "undefined" || type == ""){
if($("#errorMessage").length == 0){
$("#type").after($("<span class=\"text-danger\" id=\"errorMessage\"> 该字段不能为空</span>"));
}
return;
}
var name = $("#name").val().trim();
if(name == "undefined" || name == ""){
name = "All";
$("#domain").val("All");
}
var monitor = $("#monitor").val();
var split = ";";
var id = domain + split + type + split + name + split + monitor;
window.location.href = "?op=transactionRuleSubmit&configs=" + configStr + "&ruleId=" + id;
}
$(document).ready(function() {
initRuleConfigs(["DescVal","DescPer","AscVal","AscPer"]);
var ruleId = "${payload.ruleId}";
if(ruleId.length > 0){
document.getElementById("domain").disabled = true;
document.getElementById("type").disabled = true;
document.getElementById("name").disabled = true;
document.getElementById("monitor").disabled = true;
var monitor = ruleId.split(';')[3];
$('#monitor').val(monitor);
}
var name = $("#name").val().trim();
if(name == "" || name.length == 0){
$("#name").val("All");
}
$('#application_config').addClass('active open');
$('#transactionRule').addClass('active');
$(document).delegate("#ruleSubmitButton","click",function(){
update();
})
});
</script>