提交 55bdc59e 编写于 作者: Y yong.you

modify the add modify page of domain node

上级 bb05933a
......@@ -155,7 +155,7 @@ public class MatrixAnalyzer extends AbstractMessageAnalyzer<MatrixReport> implem
String type = t.getType();
Ratio ratio = null;
if (type.equals("Call")) {
if (type.equals("Call") || type.equals("PigeonCall")) {
ratio = ratios.get("Call");
} else if (type.equals("SQL")) {
ratio = ratios.get("SQL");
......
......@@ -343,7 +343,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
} else if (message instanceof Heartbeat) {
return encodeLine(message, buf, 'H', Policy.DEFAULT);
} else {
throw new RuntimeException(String.format("Unsupported message type: %s.", message.getClass()));
throw new RuntimeException(String.format("Unsupported message type: %s.", message));
}
}
......
......@@ -23,4 +23,8 @@ public class CatString {
public static final String EXCEPTION_COUNT = "错误数";
public static final String EXCEPTION_INFO = "异常信息";
public static final String SUCCESS = "Success";
public static final String FAIL = "Fail";
}
......@@ -317,8 +317,7 @@ public class Handler implements PageHandler<Context> {
ModelResponse<DependencyReport> response = m_dependencyService.invoke(request);
DependencyReport report = response.getModel();
Date start = report.getStartTime();
if (start == null) {
if (report != null && report.getStartTime() == null) {
report.setStartTime(new Date(payload.getDate()));
report.setStartTime(new Date(payload.getDate() + TimeUtil.ONE_HOUR));
}
......
......@@ -190,6 +190,15 @@ public class TopologyGraphConfigManger implements Initializable {
m_config = new TopologyGraphConfig();
}
}
public boolean insertDomainDefaultConfig(String type, DomainConfig config) {
NodeConfig node = m_config.findOrCreateNodeConfig(type);
node.setDefaultErrorResponseTime(config.getErrorResponseTime());
node.setDefaultErrorThreshold(config.getErrorThreshold());
node.setDefaultWarningResponseTime(config.getWarningResponseTime());
node.setDefaultWarningThreshold(config.getWarningThreshold());
return flushConfig();
}
public boolean insertDomainConfig(String type, DomainConfig config) {
m_config.findOrCreateNodeConfig(type).addDomainConfig(config);
......@@ -202,7 +211,7 @@ public class TopologyGraphConfigManger implements Initializable {
return flushConfig();
}
private EdgeConfig queryEdgeConfig(String type, String from, String to) {
public EdgeConfig queryEdgeConfig(String type, String from, String to) {
EdgeConfig edgeConfig = m_config.findEdgeConfig(type + ":" + from + ":" + to);
if (edgeConfig == null) {
......@@ -221,7 +230,7 @@ public class TopologyGraphConfigManger implements Initializable {
return edgeConfig;
}
private DomainConfig queryNodeConfig(String type, String domain) {
public DomainConfig queryNodeConfig(String type, String domain) {
NodeConfig typesConfig = m_config.findNodeConfig(type);
if (typesConfig != null) {
......@@ -248,4 +257,5 @@ public class TopologyGraphConfigManger implements Initializable {
m_fileName = file;
}
}
......@@ -14,12 +14,16 @@ public enum Action implements org.unidal.web.mvc.Action {
AGGREGATION_UPDATE_SUBMIT("aggregationUpdateSubmit"),
AGGREGATION_DELETE("aggregationDelete"),
TOPOLOGY_GRAPH_CONFIG_LIST("topologyGraphConfigList"),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE("topologyGraphConfigNodeAdd"),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD("topologyGraphConfigNodeAdd"),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT("topologyGraphConfigNodeAddSumbit"),
TOPOLOGY_GRAPH_CONFIG_NODE_DELETE("topologyGraphConfigNodeDelete"),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD("topologyGraphConfigEdgeAdd"),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD_OR_UPDATE("topologyGraphConfigEdgeAdd"),
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE("topologyGraphConfigEdgeDelete");
......
......@@ -8,6 +8,7 @@ import java.util.List;
import javax.servlet.ServletException;
import org.codehaus.plexus.util.StringUtils;
import org.unidal.dal.jdbc.DalException;
import org.unidal.lookup.annotation.Inject;
import org.unidal.web.mvc.PageHandler;
......@@ -19,6 +20,7 @@ import com.dianping.cat.Cat;
import com.dianping.cat.consumer.core.dal.Project;
import com.dianping.cat.consumer.core.dal.ProjectDao;
import com.dianping.cat.consumer.core.dal.ProjectEntity;
import com.dianping.cat.helper.CatString;
import com.dianping.cat.home.dal.report.AggregationRule;
import com.dianping.cat.home.dal.report.AggregationRuleDao;
import com.dianping.cat.home.dal.report.AggregationRuleEntity;
......@@ -68,6 +70,7 @@ public class Handler implements PageHandler<Context> {
updateProject(payload);
model.setProjects(queryAllProjects());
break;
case AGGREGATION_ALL:
model.setAggregationRules(queryAllAggregationRules());
break;
......@@ -82,30 +85,54 @@ public class Handler implements PageHandler<Context> {
deleteAggregationRule(payload);
model.setAggregationRules(queryAllAggregationRules());
break;
case TOPOLOGY_GRAPH_CONFIG_NODE_ADD:
model.setOpResult(addGraphNodeConfig(payload));
case TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE:
graphNodeConfigAddOrUpdate(payload, model);
break;
case TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT:
model.setOpResult(graphNodeConfigAddOrUpdateSubmit(payload, model));
break;
case TOPOLOGY_GRAPH_CONFIG_NODE_DELETE:
model.setOpResult(graphNodeConfigUpdate(payload));
model.setOpResult(graphNodeConfigDelete(payload));
model.setConfig(m_topologyConfigManager.getConfig());
break;
case TOPOLOGY_GRAPH_CONFIG_EDGE_ADD:
case TOPOLOGY_GRAPH_CONFIG_EDGE_ADD_OR_UPDATE:
model.setOpResult(graphEdgeConfigAdd(payload));
break;
case TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE:
model.setOpResult(graphEdgeConfigDelete(payload));
break;
case TOPOLOGY_GRAPH_CONFIG_LIST:
model.setGraphConfig(m_topologyConfigManager.getConfig());
break;
}
m_jspViewer.view(ctx, model);
}
private boolean addGraphNodeConfig(Payload payload) {
private void graphNodeConfigAddOrUpdate(Payload payload, Model model) {
String domain = payload.getDomain();
String type = payload.getType();
if (!StringUtils.isEmpty(domain)) {
model.setDomainConfig(m_topologyConfigManager.queryNodeConfig(type, domain));
}
}
private boolean graphNodeConfigAddOrUpdateSubmit(Payload payload, Model model) {
String type = payload.getType();
DomainConfig config = payload.getDomainConfig();
return true;
// return m_topologyConfigManager.insertDomainConfig(, config);
String domain = config.getId();
model.setDomainConfig(config);
if (domain.equalsIgnoreCase(CatString.ALL)) {
return m_topologyConfigManager.insertDomainDefaultConfig(type, config);
} else {
return m_topologyConfigManager.insertDomainConfig(type, config);
}
}
private boolean graphNodeConfigUpdate(Payload payload) {
return true;
private boolean graphNodeConfigDelete(Payload payload) {
return m_topologyConfigManager.deleteDomainConfig(payload.getType(), payload.getDomain());
}
private boolean graphEdgeConfigAdd(Payload payload) {
......@@ -113,7 +140,7 @@ public class Handler implements PageHandler<Context> {
}
private boolean graphEdgeConfigDelete(Payload payload) {
return true;
return m_topologyConfigManager.deleteDomainConfig(payload.getType(), payload.getDomain());
}
private List<Project> queryAllProjects() {
......
......@@ -8,14 +8,19 @@ public enum JspFile {
AGGREGATION_ALL("/jsp/system/aggregation.jsp"),
AGGREGATION_UPATE("/jsp/system/aggregationUpdate.jsp"),
TOPOLOGY_GRAPH_CONFIG_ADD_OR_SUBMIT("/jsp/system/topologyGraphConfigNodeAdd.jsp"),
TOPOLOGY_GRAPH_CONFIG_ADD("/jsp/system/topologyGraphConfigNodeAdd.jsp"),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT("/jsp/system/topologyGraphConfigNodeAdd.jsp"),
TOPOLOGY_GRAPH_CONFIG_DELETE("/jsp/system/topologyGraphConfigNodeDelete.jsp"),
TOPOLOGY_GRAPH_CONFIG_DELETE("/jsp/system/topologyGraphConfigs.jsp"),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD("/jsp/system/topologyGraphConfigEdgeAdd.jsp"),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD_OR_UPDATE("/jsp/system/topologyGraphConfigEdgeAdd.jsp"),
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE("/jsp/system/topologyGraphConfigEdgeDelete.jsp"),
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE("/jsp/system/topologyGraphConfigs.jsp"),
TOPOLOGY_GRAPH_CONFIG_LIST("/jsp/system/topologyGraphConfigs.jsp"),
;
......
......@@ -24,14 +24,18 @@ public class JspViewer extends BaseJspViewer<SystemPage, Action, Context, Model>
return JspFile.AGGREGATION_UPATE.getPath();
case AGGREGATION_UPDATE_SUBMIT:
return JspFile.AGGREGATION_ALL.getPath();
case TOPOLOGY_GRAPH_CONFIG_NODE_ADD:
return JspFile.TOPOLOGY_GRAPH_CONFIG_ADD.getPath();
case TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE:
return JspFile.TOPOLOGY_GRAPH_CONFIG_ADD_OR_SUBMIT.getPath();
case TOPOLOGY_GRAPH_CONFIG_NODE_DELETE:
return JspFile.TOPOLOGY_GRAPH_CONFIG_DELETE.getPath();
case TOPOLOGY_GRAPH_CONFIG_EDGE_ADD:
return JspFile.TOPOLOGY_GRAPH_CONFIG_EDGE_ADD.getPath();
case TOPOLOGY_GRAPH_CONFIG_EDGE_ADD_OR_UPDATE:
return JspFile.TOPOLOGY_GRAPH_CONFIG_EDGE_ADD_OR_UPDATE.getPath();
case TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE:
return JspFile.TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE.getPath();
case TOPOLOGY_GRAPH_CONFIG_LIST:
return JspFile.TOPOLOGY_GRAPH_CONFIG_LIST.getPath();
case TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT:
return JspFile.TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT.getPath();
}
throw new RuntimeException("Unknown action: " + action);
......
......@@ -6,7 +6,11 @@ import java.util.List;
import org.unidal.web.mvc.ViewModel;
import com.dianping.cat.consumer.core.dal.Project;
import com.dianping.cat.helper.CatString;
import com.dianping.cat.home.dal.report.AggregationRule;
import com.dianping.cat.home.dependency.config.entity.DomainConfig;
import com.dianping.cat.home.dependency.config.entity.EdgeConfig;
import com.dianping.cat.home.dependency.config.entity.TopologyGraphConfig;
import com.dianping.cat.system.SystemPage;
public class Model extends ViewModel<SystemPage, Action, Context> {
......@@ -19,12 +23,34 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
private List<AggregationRule> m_aggregationRules;
private String m_opState;
private String m_opState = CatString.SUCCESS;
private TopologyGraphConfig m_config;
private DomainConfig m_domainConfig;
private EdgeConfig m_edgeConfig;
public Model(Context ctx) {
super(ctx);
}
public DomainConfig getDomainConfig() {
return m_domainConfig;
}
public void setDomainConfig(DomainConfig domainConfig) {
m_domainConfig = domainConfig;
}
public EdgeConfig getEdgeConfig() {
return m_edgeConfig;
}
public void setEdgeConfig(EdgeConfig edgeConfig) {
m_edgeConfig = edgeConfig;
}
public AggregationRule getAggregationRule() {
return m_aggregationRule;
}
......@@ -55,8 +81,8 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
}
public String getOpState() {
return m_opState;
}
return m_opState;
}
public Project getProject() {
return m_project;
......@@ -74,18 +100,26 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
m_aggregationRules = aggregationRules;
}
public TopologyGraphConfig getConfig() {
return m_config;
}
public void setConfig(TopologyGraphConfig config) {
m_config = config;
}
public void setGraphConfig(TopologyGraphConfig config) {
m_config = config;
}
public void setOpResult(boolean result) {
if (result) {
m_opState = "SUCCESS";
m_opState = CatString.SUCCESS;
} else {
m_opState = "FAIL";
m_opState = CatString.FAIL;
}
}
public void setOpState(String opState) {
m_opState = opState;
}
public void setProject(Project project) {
m_project = project;
}
......
......@@ -32,8 +32,14 @@ public class Payload implements ActionPayload<SystemPage, Action> {
@FieldMeta("projectId")
private int m_projectId;
@FieldMeta("domain")
private String m_domain;
@FieldMeta("id")
private int m_id;
@FieldMeta("type")
private String m_type;
@Override
public Action getAction() {
......@@ -43,74 +49,90 @@ public class Payload implements ActionPayload<SystemPage, Action> {
return m_action;
}
@Override
public SystemPage getPage() {
return m_page;
public DomainConfig getDomainConfig() {
return m_domainConfig;
}
public String getReportType() {
return "";
public EdgeConfig getEdgeConfig() {
return m_edgeConfig;
}
public void setAction(String action) {
m_action = Action.getByName(action, Action.PROJECT_ALL);
public int getId() {
return m_id;
}
@Override
public void setPage(String page) {
m_page = SystemPage.getByName(page, SystemPage.CONFIG);
public SystemPage getPage() {
return m_page;
}
@Override
public void validate(ActionContext<?> ctx) {
public Project getProject() {
return m_project;
}
public void setProjectId(int id) {
m_projectId = id;
public int getProjectId() {
return m_projectId;
}
public String getReportType() {
return "";
}
public AggregationRule getRule() {
return m_rule;
}
public void setRule(AggregationRule rule) {
m_rule = rule;
}
public String getType() {
return m_type;
}
public DomainConfig getDomainConfig() {
return m_domainConfig;
public void setAction(String action) {
m_action = Action.getByName(action, Action.PROJECT_ALL);
}
public void setDomainConfig(DomainConfig domainConfig) {
m_domainConfig = domainConfig;
}
public EdgeConfig getEdgeConfig() {
return m_edgeConfig;
}
public void setEdgeConfig(EdgeConfig edgeConfig) {
m_edgeConfig = edgeConfig;
}
public Project getProject() {
return m_project;
public void setId(int id) {
m_id = id;
}
@Override
public void setPage(String page) {
m_page = SystemPage.getByName(page, SystemPage.CONFIG);
}
public void setProject(Project project) {
m_project = project;
}
public int getProjectId() {
return m_projectId;
public void setProjectId(int id) {
m_projectId = id;
}
public int getId() {
return m_id;
public void setRule(AggregationRule rule) {
m_rule = rule;
}
public void setId(int id) {
m_id = id;
}
public void setType(String type) {
m_type = type;
}
public String getDomain() {
return m_domain;
}
public void setDomain(String domain) {
m_domain = domain;
}
@Override
public void validate(ActionContext<?> ctx) {
}
}
......@@ -2843,6 +2843,9 @@
<requirement>
<role>com.dianping.cat.home.dal.report.AggregationRuleDao</role>
</requirement>
<requirement>
<role>com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManger</role>
</requirement>
</requirements>
</component>
<component>
......@@ -2872,6 +2875,10 @@
</requirement>
</requirements>
</component>
<component>
<role>com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManger</role>
<implementation>com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManger</implementation>
</component>
<component>
<role>com.dianping.cat.system.alarm.AlarmContentBuilder</role>
<implementation>com.dianping.cat.system.alarm.AlarmContentBuilder</implementation>
......
......@@ -24,4 +24,3 @@ function sub(anchor) {
return false;
}
......@@ -20,6 +20,9 @@
var id = '${payload.action.name}';
$('#'+id).addClass("active");
init();
$(".delete").bind("click", function() {
return confirm("确定要删除此项目吗(不可恢复)?");
});
});
</script>
<div class="body-content">
......@@ -49,7 +52,7 @@
</c:otherwise>
</c:choose>
<a class="btn btn-primary btn-small" href="?op=alarmRuleUpdate&alarmRuleId=${item.alarmRule.id}&type=exception">编辑</a>
<a class="btn btn-danger btn-small" href="?op=exceptionAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}">删除</a>
<a class="delete btn btn-danger btn-small" href="?op=exceptionAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}">删除</a>
</td>
</tr>
</c:forEach></tbody>
......
......@@ -21,6 +21,9 @@
init();
var id = '${payload.action.name}';
$('#'+id).addClass("active");
$(".delete").bind("click", function() {
return confirm("确定要删除此项目吗(不可恢复)?");
});
});
</script>
......@@ -50,7 +53,7 @@
</c:otherwise>
</c:choose>
<a class="btn btn-primary btn-small" href="?op=alarmRuleUpdate&alarmRuleId=${item.alarmRule.id}&type=service">编辑</a>
<a class="btn btn-danger btn-small" href="?op=serviceAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}">删除</a>
<a class="delete btn btn-danger btn-small" href="?op=serviceAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}">删除</a>
</td>
</tr>
</c:forEach></tbody>
......
......@@ -3,7 +3,8 @@
<ul class="nav nav-list">
<li class='nav-header'><h4>全局配置信息</h4></li>
<li id="projectList"><a href="?op=projects"><strong>项目基本信息配置</strong></a></li>
<li id="aggregationList"><a href="?op=aggregations"><strong>前端监控规则配置</strong></a></li>
<li id="aggregationList"><a href="?op=aggregations"><strong>前端合并规则配置</strong></a></li>
<li id="topylogyConfigList"><a href="?op=topologyGraphConfigList"><strong>拓扑监控阀值配置</strong></a></li>
<li id="bussinessConfigList"><a href="?"><strong>业务监控规则配置</strong></a></li>
</ul>
</div>
......
......@@ -9,7 +9,6 @@
<jsp:useBean id="model" type="com.dianping.cat.system.page.config.Model" scope="request"/>
<a:body>
<res:useJs value="${res.js.local['alarm_js']}" target="head-js" />
<script type="text/javascript">
$(document).ready(function() {
......
......@@ -20,6 +20,9 @@
init();
var id = '${payload.action.name}';
$('#'+id).addClass("active");
$(".delete").bind("click", function() {
return confirm("确定要删除此项目吗(不可恢复)?");
});
});
</script>
......@@ -51,7 +54,7 @@
</c:otherwise>
</c:choose>
<a class="btn btn-primary btn-small" href="?op=scheduledReportUpdate&scheduledReportId=${item.scheduledReport.id}" target="_blank">编辑</a>
<a class="btn btn-danger btn-small" href="?op=scheduledReportDelete&scheduledReportId=${item.scheduledReport.id}">删除</a>
<a class="delete btn btn-danger btn-small" href="?op=scheduledReportDelete&scheduledReportId=${item.scheduledReport.id}">删除</a>
</td>
</tr>
</c:forEach></tbody>
......
<%@ 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"%>
<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:body>
<res:useJs value="${res.js.local['alarm_js']}" target="head-js" />
<script type="text/javascript">
$(document).ready(function() {
$('#topylogyConfigList').addClass('active');
var action = '${payload.action}';
if(action=='TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT'){
var state = '${model.opState}';
if(state=='Success'){
$('#state').html('操作成功');
}else{
$('#state').html('操作失败');
}
setInterval(function(){
$('#state').html('&nbsp;');
},3000);
}
});
</script>
<div class="row-fluid">
<div class="span2">
<%@include file="./configTree.jsp"%>
</div>
<div class="span10">
<h4 id="state" class="text-center text-error">&nbsp;</h4>
<form name="topologyGraphConfigNodeAddSumbit" id="form" method="post" action="${model.pageUri}?op=topologyGraphConfigNodeAddSumbit">
<table class="table table-striped table-bordered table-condensed">
<tr>
<td>规则类型</td>
<td><input type="name" name="type" value="${payload.type}" readonly/></td>
<td></td>
</tr>
<tr>
<td>项目名称</td>
<td>
<c:if test="${not empty payload.domain}">
<input type="name" name="domainConfig.id" value="${payload.domain}" required/>
</c:if>
<c:if test="${empty payload.domain}">
<input type="name" name="domainConfig.id" value="${model.domainConfig.id}" required/>
</c:if>
</td>
<td>ALL表示所有项目的默认值</td>
</tr>
<tr>
<td>异常数warning阈值</td>
<td><input type="name" name="domainConfig.warningThreshold" value="${model.domainConfig.warningThreshold}" required/></td>
<td style='color:red'>异常warning阈值(1一分钟内异常数目)</td>
</tr>
<tr>
<td>异常数error阈值</td>
<td><input type="name" name="domainConfig.errorThreshold" value="${model.domainConfig.errorThreshold}" required/></td>
<td style='color:red'>异常error阈值(1一分钟内异常数目)</td>
</tr>
<tr>
<td>响应时间warning阈值</td>
<td><input type="name" name="domainConfig.warningResponseTime" value="${model.domainConfig.warningResponseTime}" required/></td>
<td style='color:red'>响应时间warning阈值</td>
</tr>
<tr>
<td>响应时间error阈值</td>
<td><input type="name" name="domainConfig.errorResponseTime" value="${model.domainConfig.errorResponseTime}" required/></td>
<td style='color:red'>响应时间error阈值</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input class='btn btn-primary' type="submit" name="submit" value="submit" /></td>
</tr>
</table>
</form>
</div>
</div>
</a:body>
\ No newline at end of file
<%@ 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"%>
<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:body>
<res:useJs value="${res.js.local['alarm_js']}" target="head-js" />
<script type="text/javascript">
$(document).ready(function() {
$('#topylogyConfigList').addClass('active');
$('#tab0').addClass('active');
$('#tabContent0').addClass('active');
$(".delete").bind("click", function() {
return confirm("确定要删除此项目吗(不可恢复)?");
});
var action = '${payload.action}';
if(action=='TOPOLOGY_GRAPH_CONFIG_NODE_DELETE'){
var state = '${model.opState}';
if(state=='Success'){
$('#state').html('操作成功');
}else{
$('#state').html('操作失败');
}
setInterval(function(){
$('#state').html('&nbsp;');
},3000);
}
});
</script>
<div class="row-fluid">
<div class="span2">
<%@include file="./configTree.jsp"%>
</div>
<div class="span10">
<h4 id="state" class="text-center text-error">&nbsp;</h4>
<div class="tabbable tabs-left" id="topMetric"> <!-- Only required for left/right tabs -->
<ul class="nav nav-tabs">
<c:forEach var="item" items="${model.config.nodeConfigs}" varStatus="status">
<c:set var="key" value="${item.key}"/>
<li id="tab${status.index}" class="text-right"><a href="#tabContent${status.index}" data-toggle="tab"> <h4 class="text-error">${key}</h4></a></li>
</c:forEach>
</ul>
<div class="tab-content">
<c:forEach var="item" items="${model.config.nodeConfigs}" varStatus="status">
<c:set var="value" value="${item.value}"/>
<div class="tab-pane" id="tabContent${status.index}">
<h2 class="text-center text-error">${item.key}</h2>
<table class="table table-striped table-bordered table-condensed">
<tr class="text-success">
<th><h4 class='text-center'>项目</h4></th><th><h4 class='text-center'>异常Warning阀值</h4></th>
<th><h4 class='text-center'>异常Error阀值</h4></th><th><h4 class='text-center'>响应时间Warning阀值</h4></th>
<th><h4 class='text-center'>响应时间Error阀值</h4></th>
<th><h4 class='text-center'>操作<a class="btn btn-primary btn-small" href="?op=topologyGraphConfigNodeAdd&type=${item.key}">新增</a></h4></th>
</tr>
<tr class="text-error"><td><h5>默认值</h5></td><td><h5 class="text-right">${value.defaultWarningThreshold}</h5></td>
<td><h5 class="text-right">${value.defaultErrorThreshold}</h5></td>
<td><h5 class="text-right">${value.defaultWarningResponseTime}</h5></td>
<td><h5 class="text-right">${value.defaultErrorResponseTime}</h5></td>
<td><a href="?op=topologyGraphConfigNodeAdd&type=${item.key}&domain=ALL" class="btn btn-primary btn-small">修改</a></td>
</tr>
<c:forEach var="domainConfig" items="${value.domains}">
<c:set var="temp" value="${domainConfig.value}"/>
<tr><td>${temp.id}</td>
<td style="text-align:right">${temp.warningThreshold}</td>
<td style="text-align:right">${temp.errorThreshold}</td>
<td style="text-align:right">${temp.warningResponseTime}</td>
<td style="text-align:right">${temp.errorResponseTime}</td>
<td><a href="?op=topologyGraphConfigNodeAdd&type=${item.key}&domain=${temp.id}" class="btn btn-primary btn-small">修改</a>
<a href="?op=topologyGraphConfigNodeDelete&type=${item.key}&domain=${temp.id}" class="btn btn-primary btn-small btn-danger delete">删除</a></td>
</tr>
</c:forEach>
</table>
</div>
</c:forEach>
</div>
</div>
</div>
</div>
</a:body>
\ No newline at end of file
......@@ -30,30 +30,22 @@ public class OpDataCollectTest extends ComponentTestCase {
@Test
public void test() throws Exception {
m_hourlyReportService = (HourlyReportService) lookup(HourlyReportService.class);
String dateStr1 = "2013-03-24 16:00";
String dateStr2 = "2013-04-14 16:00";
String dateStr1 = "2013-03-22 16:00";
String dateStr2 = "2013-04-26 16:00";
String dateStr3 = "2013-05-24 16:00";
String[] domains = getDomains();
System.out.println("Domain\tDate\tType\tTotal\tAvg\tLine95\tStd\tQPS");
for (String domain : domains) {
buildTransactionData(domain, dateStr1);
}
for (String domain : domains) {
buildTransactionData(domain, dateStr2);
}
for (String domain : domains) {
buildTransactionData(domain, dateStr3);
}
System.out.println("Domain\tDate\tLoad\tHttp");
for (String domain : domains) {
buildHeartbeatData(domain, dateStr1);
}
for (String domain : domains) {
buildHeartbeatData(domain, dateStr2);
}
for (String domain : domains) {
buildHeartbeatData(domain, dateStr3);
}
}
......@@ -90,7 +82,10 @@ public class OpDataCollectTest extends ComponentTestCase {
}
private String[] getDomains() {
String domains = "MobileMembercardMainApiWeb,MobileMembercardMainServer,MobileMembercardRecomServer,PayEngine,tuangou-paygate,DealService,TuanGouApiMobile,TuanGouRank,TuanGouRemote,TuanGouWap,TuanGouWeb,MobileApi,MLocationService,MConfigAPI,MobileRecomStore,UserBaseService,GroupService,GroupWeb,PiccenterDisplay,PiccenterStorage,PiccenterUpload,ShopServer,ShopWeb,ShoppicService,ShopSearchWeb,ReviewServer,UserService";
String domains = "MobileMembercardMainApiWeb,MobileMembercardMainServer,MobileMembercardRecomServer,PayEngine,"
+ "tuangou-paygate,DealService,TuanGouApiMobile,TuanGouRank,TuanGouRemote,TuanGouWap,TuanGouWeb,MobileApi,"
+ "MLocationService,MConfigAPI,MobileRecomStore,UserBaseService,GroupService,GroupWeb,PiccenterDisplay,"
+ "PiccenterStorage,PiccenterUpload,ShopServer,ShopWeb,ShoppicService,ShopSearchWeb,ReviewServer,UserService";
return domains.split(",");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册