提交 ae35957d 编写于 作者: U unknown

modify the page at home

上级 ba5b2f81
......@@ -111,23 +111,33 @@ public class HtmlMessageCodec implements MessageCodec, Initializable {
protected int encodeHeader(MessageTree tree, ChannelBuffer buf) {
BufferHelper helper = m_bufferHelper;
int count = 0;
count += helper.tr1(buf,"header");
count += helper.td(buf, ID);
count += helper.td(buf, tree.getDomain());
count += helper.td(buf, tree.getHostName());
count += helper.td(buf, tree.getIpAddress());
count += helper.td(buf, tree.getThreadGroupName());
count += helper.td(buf, tree.getThreadId());
count += helper.td(buf, tree.getThreadName());
count += helper.td(buf, tree.getMessageId());
count += helper.td(buf, tree.getParentMessageId());
count += helper.td(buf, tree.getRootMessageId());
count += helper.td(buf, tree.getSessionToken());
count += helper.tr2(buf);
count += helper.crlf(buf);
// int count = 0;
// count += helper.tr1(buf,"header");
// count += helper.td(buf, ID);
// count += helper.td(buf, tree.getDomain());
// count += helper.td(buf, tree.getHostName());
// count += helper.td(buf, tree.getIpAddress());
// count += helper.td(buf, tree.getThreadGroupName());
// count += helper.td(buf, tree.getThreadId());
// count += helper.td(buf, tree.getThreadName());
// count += helper.td(buf, tree.getMessageId());
// count += helper.td(buf, tree.getParentMessageId());
// count += helper.td(buf, tree.getRootMessageId());
// count += helper.td(buf, tree.getSessionToken());
// count += helper.tr2(buf);
// count += helper.crlf(buf);
StringBuilder sb = new StringBuilder();
sb.append("<tr class=\"header\" ><td colspan=5>");
sb.append(ID).append(" ").append(tree.getDomain()).append(" ");
sb.append(tree.getHostName()).append(" ").append(tree.getIpAddress()).append(" ");
sb.append(tree.getThreadGroupName()).append(" ").append(tree.getThreadId()).append(" ");
sb.append(tree.getThreadName()).append(" ").append(tree.getMessageId()).append(" ");
sb.append(tree.getParentMessageId()).append(" ").append(tree.getRootMessageId()).append(" ");
sb.append(tree.getSessionToken()).append(" ");
sb.append("</td></tr>");
int count = helper.write(buf,sb.toString());
return count;
}
......
......@@ -33,24 +33,27 @@ public class GroupLevelInfo {
}
private String getShowDetailByMinte(int minute) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
StringBuilder sb = new StringBuilder().append("<td>");
String minuteStr = Integer.toString(minute);
if (minute < 10) {
sb.append("0");
minuteStr ="0" +minute;
}
sb.append(minute).append("</td>");
sb.append(ProblemReportHelper.creatLinkString(baseUrl, "minute", params, minuteStr));
sb.append("</td>");
for (java.util.Map.Entry<String, GroupStatistics> statistics : m_groupStatistics.entrySet()) {
sb.append("<td>");
params.put("group", statistics.getKey());
GroupStatistics value = statistics.getValue();
for (String temp : value.getStatistics().get(minute)) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("group", statistics.getKey());
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
String url = ProblemReportHelper.creatLinkString(baseUrl, temp, params);
String url = ProblemReportHelper.creatLinkString(baseUrl, temp, params,"");
sb.append(url);
}
sb.append("</td>");
......
......@@ -152,7 +152,10 @@ public class Handler implements PageHandler<Context> {
String ip = getIpAddress(report, payload);
if (period.isCurrent() || period.isFuture()) {
model.setLastMinute(getLastMinute(report, ip));
Calendar cal = Calendar.getInstance();
int minute = cal.get(Calendar.MINUTE);
//model.setLastMinute(getLastMinute(report, ip));
model.setLastMinute(minute);
} else {
model.setLastMinute(59);
}
......
......@@ -28,7 +28,7 @@ public class ProblemStatistics {
m_groupName = model.getGroupName();
m_threadId = model.getThreadId();
if (isEmpty(m_threadId) && isEmpty(m_groupName)) {
// Min Level
Map<String, JavaThread> threads = machine.getThreads();
......@@ -41,7 +41,7 @@ public class ProblemStatistics {
statisticsEntries(entries);
}
} else if (isEmpty(m_groupName) && !isEmpty(m_threadId)) {
} else if (!isEmpty(m_groupName) && isEmpty(m_threadId)) {
Map<String, JavaThread> threads = machine.getThreads();
for (JavaThread thread : threads.values()) {
if (thread.getGroupName().equals(m_groupName)) {
......@@ -54,7 +54,7 @@ public class ProblemStatistics {
}
}
} else {
} else if (!isEmpty(m_groupName) && !isEmpty(m_threadId)) {
// Thread Level
JavaThread thread = machine.getThreads().get(model.getThreadId());
if (thread == null) {
......@@ -66,8 +66,10 @@ public class ProblemStatistics {
}
List<Entry> entries = segment.getEntries();
statisticsEntries(entries);
} else{
throw new RuntimeException("The url is error, it should contains thread group name at least!");
}
return this;
}
......
......@@ -60,12 +60,21 @@ public class ThreadLevelInfo {
}
private String getShowDetailByMinte(int minute) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
StringBuilder sb = new StringBuilder().append("<td>");
String minuteStr = Integer.toString(minute);
if (minute < 10) {
sb.append("0");
minuteStr ="0" +minute;
}
sb.append(minute).append("</td>");
sb.append(ProblemReportHelper.creatLinkString(baseUrl, "minute", params, minuteStr));
sb.append("</td>");
for (java.util.Map.Entry<String, GroupStatistics> statistics : m_groupStatistics.entrySet()) {
GroupStatistics value = statistics.getValue();
String groupName = statistics.getKey();
......@@ -77,17 +86,11 @@ public class ThreadLevelInfo {
HashSet<String> errors = theadStatistics.getStatistics().get(minute);
sb.append("<td>");
for (String error : errors) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("group", statistics.getKey());
if (groupName.equals(m_groupName)) {
params.put("thread", thread);
}
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
String url = ProblemReportHelper.creatLinkString(baseUrl, error, params);
String url = ProblemReportHelper.creatLinkString(baseUrl, error, params,"");
sb.append(url);
}
sb.append("</td>");
......
......@@ -10,7 +10,7 @@ import com.dianping.cat.consumer.problem.model.entity.Segment;
/* used by problem.jsp */
public class ProblemReportHelper {
public static String showLegends(JavaThread thread, int minute, String domain, String ipAddress, long date) {
Segment segment = thread.findSegment(minute);
......@@ -42,22 +42,30 @@ public class ProblemReportHelper {
sb.append("&date=").append(date);
sb.append("&minute=").append(minute);
sb.append("\" class=\"").append(name).append("\">&nbsp;&nbsp;</a>");
//sb.append("<a href=\"/cat/r/m/").append(messageId).append("/logview.html\" class=\"");
//sb.append(name);
//sb.append("\">&nbsp;&nbsp;</a>");
// sb.append("<a href=\"/cat/r/m/").append(messageId).append("/logview.html\" class=\"");
// sb.append(name);
// sb.append("\">&nbsp;&nbsp;</a>");
}
}
return sb.toString();
}
public static String creatLinkString(String baseUrl, String classStyle, Map<String, String> params) {
public static String creatLinkString(String baseUrl, String classStyle, Map<String, String> params, String text) {
StringBuilder sb = new StringBuilder();
sb.append("<a href=\"").append(baseUrl);
sb.append("<a ");
sb.append("href=\"").append(baseUrl);
for (java.util.Map.Entry<String, String> param : params.entrySet()) {
sb.append("&").append(param.getKey()).append("=").append(param.getValue());
}
sb.append("\" class=\"").append(classStyle).append("\">&nbsp;&nbsp;</a>");
sb.append("\" class=\"").append(classStyle).append("\"");
sb.append(" onclick=\"return show(this);\"" ).append(" >");
if (text.trim().length() == 0) {
sb.append("&nbsp;&nbsp");
} else {
sb.append(text);
}
sb.append("</a>");
return sb.toString();
}
......
......@@ -51,13 +51,6 @@
<tag-class>org.unidal.webres.taglib.basic.UseCssTagHandler</tag-class>
<body-content>JSP</body-content>
<attribute>
<description><![CDATA[Set the css value with EL or a css ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the link URL is secure or not.]]></description>
<name>secure</name>
<required>false</required>
......@@ -79,6 +72,13 @@
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Set the css value with EL or a css ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Target placement for this css resource to render]]></description>
<name>target</name>
<required>false</required>
......@@ -114,18 +114,18 @@
<tag-class>org.unidal.webres.taglib.basic.SetTagHandler</tag-class>
<body-content>JSP</body-content>
<attribute>
<description><![CDATA[The value]]></description>
<name>value</name>
<description><![CDATA[The name.]]></description>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[The name.]]></description>
<name>id</name>
<description><![CDATA[The value]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
<type>java.lang.Object</type>
</attribute>
<dynamic-attributes>false</dynamic-attributes>
</tag>
......@@ -135,13 +135,6 @@
<tag-class>org.unidal.webres.taglib.basic.UseJsTagHandler</tag-class>
<body-content>JSP</body-content>
<attribute>
<description><![CDATA[Set the js value with EL or a js ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the link URL is secure or not.]]></description>
<name>secure</name>
<required>false</required>
......@@ -163,6 +156,13 @@
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Set the js value with EL or a js ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Target placement for this js resource to render]]></description>
<name>target</name>
<required>false</required>
......@@ -177,13 +177,6 @@
<tag-class>org.unidal.webres.taglib.basic.LinkTagHandler</tag-class>
<body-content>JSP</body-content>
<attribute>
<description><![CDATA[The value for link, could be a expression or a link ref.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the link URL is secure or not.]]></description>
<name>secure</name>
<required>false</required>
......@@ -197,6 +190,13 @@
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[The value for link, could be a expression or a link ref.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
......@@ -205,13 +205,6 @@
<tag-class>org.unidal.webres.taglib.basic.ImageTagHandler</tag-class>
<body-content>JSP</body-content>
<attribute>
<description><![CDATA[The value for image, could be a expression or a image path.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the image URL is secure or not.]]></description>
<name>secure</name>
<required>false</required>
......@@ -232,6 +225,13 @@
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[The value for image, could be a expression or a image path.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<dynamic-attributes>true</dynamic-attributes>
</tag>
<tag>
......
......@@ -37,5 +37,6 @@ tr.link td {
.header{
display:hidden;
font-size: small;
white-space: nowrap;
}
\ No newline at end of file
function show(anchor) {
alert(anchor)
$.ajax({
type: "get",
url: anchor.href,
success : function(data, textStatus) {
alert(data);
}
});
}
\ No newline at end of file
......@@ -24,7 +24,7 @@
<res:useJs value="${res.js.local.problem_js}" target="head-js"/>
<table class="problem">
<tr><th>Type</th><th>Count</th><th>Detail</th></tr>
<c:forEach var="statistics" items="${model.statistics}">
<c:forEach var="statistics" items="${model.problemStatistics.status}">
<tr>
<td><a href="#" class="${statistics.value.type}" >&nbsp;&nbsp;</a>&nbsp;&nbsp;${statistics.value.type}
</td>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册