Merge pull request #418 from cquptlujianbo/master

明月照大江的第一次提交
This commit is contained in:
温高铁
2013-08-01 08:33:09 -07:00
6 changed files with 77 additions and 74 deletions
@@ -169,3 +169,16 @@ druid.common = function () {
$(document).ready(function() {
druid.common.init();
});
function replace (data) {
if((!data)||data === undefined){
return '';
}else{
return format(data);
}
}
function format(s) {
var str=s+='';
return str.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
}
@@ -73,16 +73,16 @@
html += "<td>" + (i + 1) + "</td>";
html += "<td>" + stat.Class + "</td>";
html += "<td>" + '<a target="_blank" href="spring-detail.html?class=' + stat.Class + '&method=' + stat.Method + '">' + stat.Method + '</a>' + "</td>";
html += "<td>" + stat.ExecuteCount + "</td>";
html += "<td>" + stat.ExecuteTimeMillis + "</td>";
html += "<td>" + stat.RunningCount + "</td>";
html += "<td>" + stat.ConcurrentMax + "</td>";
html += "<td>" + stat.JdbcExecuteCount + "</td>";
html += "<td>" + stat.JdbcExecuteTimeMillis + "</td>";
html += "<td>" + stat.JdbcCommitCount + "</td>";
html += "<td>" + stat.JdbcRollbackCount + "</td>";
html += "<td>" + stat.JdbcFetchRowCount + "</td>";
html += "<td>" + stat.JdbcUpdateCount + "</td>";
html += "<td>" + replace(stat.ExecuteCount) + "</td>";
html += "<td>" + replace(stat.ExecuteTimeMillis) + "</td>";
html += "<td>" + replace(stat.RunningCount) + "</td>";
html += "<td>" + replace(stat.ConcurrentMax) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteCount) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteTimeMillis) + "</td>";
html += "<td>" + replace(stat.JdbcCommitCount) + "</td>";
html += "<td>" + replace(stat.JdbcRollbackCount) + "</td>";
html += "<td>" + replace(stat.JdbcFetchRowCount) + "</td>";
html += "<td>" + replace(stat.JdbcUpdateCount) + "</td>";
html += "</tr>";
}
$("#dataTable tbody").html(html);
@@ -108,20 +108,20 @@
html += "<tr>";
html += "<td>" + (i + 1) + "</td>";
html += "<td>" + '<a target="_blank" href="sql-detail.html?sqlId=' + stat.ID + '">' + druid.common.subSqlString(stat.SQL, 25) + '</a>' + "</td>";
html += "<td>" + stat.ExecuteCount + "</td>";
html += "<td>" + stat.TotalTime + "</td>";
html += "<td>" + replace(stat.ExecuteCount) + "</td>";
html += "<td>" + replace(stat.TotalTime) + "</td>";
var lastSlowHtml = stat.MaxTimespan;
if (stat.LastSlowParameters!=null && stat.LastSlowParameters.length>0) {
lastSlowHtml ='<a target="_blank" style="color:red" href="sql-detail.html?sqlId=' + stat.ID + '">'+stat.MaxTimespan+'</a>';
}
html += "<td>" + lastSlowHtml + "</td>";
html += "<td>" + stat.InTransactionCount + "</td>";
html += "<td>" + stat.ErrorCount + "</td>";
html += "<td>" + stat.EffectedRowCount + "</td>";
html += "<td>" + stat.FetchRowCount + "</td>";
html += "<td>" + stat.RunningCount + "</td>";
html += "<td>" + stat.ConcurrentMax + "</td>";
html += "<td>" + replace(lastSlowHtml) + "</td>";
html += "<td>" + replace(stat.InTransactionCount) + "</td>";
html += "<td>" + replace(stat.ErrorCount) + "</td>";
html += "<td>" + replace(stat.EffectedRowCount) + "</td>";
html += "<td>" + replace(stat.FetchRowCount) + "</td>";
html += "<td>" + replace(stat.RunningCount) + "</td>";
html += "<td>" + replace(stat.ConcurrentMax) + "</td>";
html += "<td>" + '[' + stat.Histogram + ']' + "</td>";
html += "<td>" + '[' + stat.ExecuteAndResultHoldTimeHistogram + ']' + "</td>";
html += "<td>" + '[' + stat.FetchRowCountHistogram + ']' + "</td>";
@@ -173,17 +173,17 @@
},
handleAjaxResult : function(data) {
$("#CheckCount").text(data.Content.checkCount)
$("#HardCheckCount").text(data.Content.hardCheckCount)
$("#ViolationCount").text(data.Content.violationCount)
$("#CheckCount").text(replace(data.Content.checkCount))
$("#HardCheckCount").text(replace(data.Content.hardCheckCount))
$("#ViolationCount").text(replace(data.Content.violationCount))
$("#BlackListHitCount")
.text(data.Content.blackListHitCount)
$("#BlackListSize").text(data.Content.blackListSize)
.text(replace(data.Content.blackListHitCount))
$("#BlackListSize").text(replace(data.Content.blackListSize))
$("#WhiteListHitCount")
.text(data.Content.whiteListHitCount)
$("#WhiteListSize").text(data.Content.whiteListSize)
.text(replace(data.Content.whiteListHitCount))
$("#WhiteListSize").text(replace(data.Content.whiteListSize))
$("#SyntaxErrrorCount")
.text(data.Content.syntaxErrrorCount)
.text(replace(data.Content.syntaxErrrorCount))
var html = "";
var tables = data.Content.tables;
@@ -193,43 +193,33 @@
html += "<tr>";
html += "<td>" + table.name + "</td>";
html += "<td>"
+ (table.selectCount ? table.selectCount : '') + "</td>";
+ replace(table.selectCount) + "</td>";
html += "<td>"
+ (table.selectIntoCount ? table.selectIntoCount
: '') + "</td>";
+ replace(table.selectIntoCount) + "</td>";
html += "<td>"
+ (table.insertCount ? table.insertCount
: '') + "</td>";
+ replace(table.insertCount) + "</td>";
html += "<td>"
+ (table.updateCount ? table.updateCount
: '') + "</td>";
+ replace(table.updateCount) + "</td>";
html += "<td>"
+ (table.deleteCount ? table.deleteCount
: '') + "</td>";
+ replace(table.deleteCount) + "</td>";
html += "<td>"
+ (table.truncateCount ? table.truncateCount
: '') + "</td>";
+ replace(table.truncateCount) + "</td>";
html += "<td>"
+ (table.createCount ? table.createCount
: '') + "</td>";
+ replace(table.createCount) + "</td>";
html += "<td>"
+ (table.alterCount ? table.alterCount : '')
+ replace(table.alterCount)
+ "</td>";
html += "<td>"
+ (table.dropCount ? table.dropCount : '')
+ replace(table.dropCount)
+ "</td>";
html += "<td>"
+ (table.replaceCount ? table.replaceCount
: '') + "</td>";
+ replace(table.replaceCount) + "</td>";
html += "<td>"
+ (table.deleteDataCount ? table.deleteDataCount
: '') + "</td>";
+ replace(table.deleteDataCount) + "</td>";
html += "<td>"
+ (table.updateDataCount ? table.updateDataCount
: '') + "</td>";
+ replace(table.updateDataCount) + "</td>";
html += "<td>"
+ (table.fetchRowCount ? table.fetchRowCount
: '') + "</td>";
+ replace(table.fetchRowCount)+ "</td>";
html += "</tr>";
}
$("#dataTable1 tbody").html(html);
@@ -80,19 +80,19 @@
} else {
html += "<td></td>";
}
html += "<td>" + stat.CreateTime + "</td>";
html += "<td>" + stat.LastAccessTime + "</td>";
html += "<td>" + stat.RemoteAddress + "</td>";
html += "<td>" + stat.RequestCount + "</td>";
html += "<td>" + stat.RequestTimeMillisTotal + "</td>";
html += "<td>" + stat.RunningCount + "</td>";
html += "<td>" + stat.ConcurrentMax + "</td>";
html += "<td>" + stat.JdbcExecuteCount + "</td>";
html += "<td>" + stat.JdbcExecuteTimeMillis + "</td>";
html += "<td>" + stat.JdbcCommitCount + "</td>";
html += "<td>" + stat.JdbcRollbackCount + "</td>";
html += "<td>" + stat.JdbcFetchRowCount + "</td>";
html += "<td>" + stat.JdbcUpdateCount + "</td>";
html += "<td>" + replace(stat.CreateTime) + "</td>";
html += "<td>" + replace(stat.LastAccessTime) + "</td>";
html += "<td>" + replace(stat.RemoteAddress) + "</td>";
html += "<td>" + replace(stat.RequestCount) + "</td>";
html += "<td>" + replace(stat.RequestTimeMillisTotal) + "</td>";
html += "<td>" + replace(stat.RunningCount) + "</td>";
html += "<td>" + replace(stat.ConcurrentMax) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteCount) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteTimeMillis) + "</td>";
html += "<td>" + replace(stat.JdbcCommitCount) + "</td>";
html += "<td>" + replace(stat.JdbcRollbackCount) + "</td>";
html += "<td>" + replace(stat.JdbcFetchRowCount) + "</td>";
html += "<td>" + replace(stat.JdbcUpdateCount) + "</td>";
html += "</tr>";
}
$("#dataTable tbody").html(html);
@@ -74,17 +74,17 @@
html += "<tr>";
html += "<td>" + (i + 1) + "</td>";
html += "<td>" + '<a target="_blank" href="weburi-detail.html?uri='+ encodeURI(stat.URI) + '">' + druid.common.subSqlString(stat.URI, 64) + '</a>' + "</td>";
html += "<td>" + stat.RequestCount + "</td>";
html += "<td>" + stat.RequestTimeMillis + "</td>";
html += "<td>" + stat.RunningCount + "</td>";
html += "<td>" + stat.ConcurrentMax + "</td>";
html += "<td>" + stat.JdbcExecuteCount + "</td>";
html += "<td>" + stat.JdbcExecuteErrorCount + "</td>";
html += "<td>" + stat.JdbcExecuteTimeMillis + "</td>";
html += "<td>" + stat.JdbcCommitCount + "</td>";
html += "<td>" + stat.JdbcRollbackCount + "</td>";
html += "<td>" + stat.JdbcFetchRowCount + "</td>";
html += "<td>" + stat.JdbcUpdateCount + "</td>";
html += "<td>" + replace(stat.RequestCount) + "</td>";
html += "<td>" + replace(stat.RequestTimeMillis) + "</td>";
html += "<td>" + replace(stat.RunningCount) + "</td>";
html += "<td>" + replace(stat.ConcurrentMax) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteCount) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteErrorCount) + "</td>";
html += "<td>" + replace(stat.JdbcExecuteTimeMillis) + "</td>";
html += "<td>" + replace(stat.JdbcCommitCount) + "</td>";
html += "<td>" + replace(stat.JdbcRollbackCount) + "</td>";
html += "<td>" + replace(stat.JdbcFetchRowCount) + "</td>";
html += "<td>" + replace(stat.JdbcUpdateCount) + "</td>";
html += "</tr>";
}
$("#dataTable tbody").html(html);