Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
19abe526
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
19abe526
编写于
1月 13, 2012
作者:
U
unknown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the failure.js
上级
e651ce9c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
91 addition
and
342 deletion
+91
-342
cat-consumer/src/test/resources/com/dianping/cat/consumer/failure/Failure.html
.../resources/com/dianping/cat/consumer/failure/Failure.html
+0
-247
cat-home/src/main/webapp/js/failure.js
cat-home/src/main/webapp/js/failure.js
+91
-95
未找到文件。
cat-consumer/src/test/resources/com/dianping/cat/consumer/failure/Failure.html
已删除
100644 → 0
浏览文件 @
e651ce9c
<!DOCTYPE HTML>
<html>
<head>
<meta
charset=
"utf-8"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"../jquery/jquery-ui-1.8.16.custom.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"../jquery/ui.jqgrid.css"
/>
<script
type=
"text/javascript"
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"
></script>
<script
type=
"text/javascript"
src=
"../jquery/grid.locale-en.js"
></script>
<script
type=
"text/javascript"
src=
"../jquery/jquery.jqGrid.min.js"
></script>
</head>
<body>
<script
type=
"text/javascript"
>
var
test
=
{
"
Minute
"
:
"
2012-01-10 13:00
"
,
"
Thread0
"
:
"
<a target='_blank' href='http://www.dianping.com/messageId=MessageId0'> E</a>
"
,
"
Thread1
"
:
"
<a target='_blank' href='http://www.dianping.com/messageId=MessageId0'> R</a>
"
,
"
Thread2
"
:
"
<a target='_blank' href='http://www.dianping.com/messageId=MessageId0'> L</a>
"
,
"
Thread3
"
:
""
,
"
Thread4
"
:
""
}
var
jsonDate
=
{
"
domain
"
:
"
domain1
"
,
"
startTime
"
:
"
2012-1-10 13:00:00
"
,
"
endTime
"
:
"
2012-1-10 13:59:00
"
,
"
machines
"
:
{
"
machines
"
:
[
"
192.168.8.0
"
,
"
192.168.8.1
"
,
"
192.168.8.2
"
,
"
192.168.8.3
"
]
},
"
threads
"
:
{
"
threads
"
:
[
"
Thread0
"
,
"
Thread1
"
,
"
Thread2
"
,
"
Thread3
"
,
"
Thread4
"
]
},
"
segments
"
:
[
{
"
2012-01-10 13:00
"
:
{
"
id
"
:
"
2012-01-10 13:00
"
,
"
entries
"
:
[
{
"
type
"
:
"
Exception
"
,
"
messageId
"
:
"
MessageId0
"
,
"
threadId
"
:
"
Thread0
"
,
"
text
"
:
"
java.lang.NullPointException
"
},
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId0
"
,
"
threadId
"
:
"
Thread1
"
,
"
text
"
:
"
java.lang.RuntimeError
"
},
{
"
type
"
:
"
LongUrl
"
,
"
messageId
"
:
"
MessageId0
"
,
"
threadId
"
:
"
Thread2
"
,
"
text
"
:
"
AAA:BBBB
"
}
]
},
"
2012-01-10 13:01
"
:
{
"
id
"
:
"
2012-01-10 13:01
"
,
"
entries
"
:
[
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId1
"
,
"
threadId
"
:
"
Thread1
"
,
"
text
"
:
"
java.lang.RuntimeError
"
},
{
"
type
"
:
"
RuntimeException
"
,
"
messageId
"
:
"
MessageId1
"
,
"
threadId
"
:
"
Thread1
"
,
"
text
"
:
"
java.lang.RuntimeException
"
},
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId1
"
,
"
threadId
"
:
"
Thread1
"
,
"
text
"
:
"
java.lang.RuntimeError
"
}
]
},
"
2012-01-10 13:02
"
:
{
"
id
"
:
"
2012-01-10 13:02
"
,
"
entries
"
:
[
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId2
"
,
"
threadId
"
:
"
Thread2
"
,
"
text
"
:
"
java.lang.RuntimeError
"
},
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId2
"
,
"
threadId
"
:
"
Thread2
"
,
"
text
"
:
"
java.lang.RuntimeError
"
},
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId2
"
,
"
threadId
"
:
"
Thread4
"
,
"
text
"
:
"
java.lang.RuntimeError
"
}
]
},
"
2012-01-10 13:03
"
:
{
"
id
"
:
"
2012-01-10 13:03
"
,
"
entries
"
:
[
{
"
type
"
:
"
Exception
"
,
"
messageId
"
:
"
MessageId3
"
,
"
threadId
"
:
"
Thread3
"
,
"
text
"
:
"
java.lang.Exception
"
},
{
"
type
"
:
"
Exception
"
,
"
messageId
"
:
"
MessageId3
"
,
"
threadId
"
:
"
Thread4
"
,
"
text
"
:
"
java.lang.Exception
"
},
{
"
type
"
:
"
Exception
"
,
"
messageId
"
:
"
MessageId3
"
,
"
threadId
"
:
"
Thread1
"
,
"
text
"
:
"
java.lang.Exception
"
}
]
},
"
2012-01-10 13:04
"
:
{
"
id
"
:
"
2012-01-10 13:04
"
,
"
entries
"
:
[
{
"
type
"
:
"
RuntimeException
"
,
"
messageId
"
:
"
MessageId4
"
,
"
threadId
"
:
"
Thread4
"
,
"
text
"
:
"
java.lang.RuntimeException
"
},
{
"
type
"
:
"
Error
"
,
"
messageId
"
:
"
MessageId4
"
,
"
threadId
"
:
"
Thread1
"
,
"
text
"
:
"
java.lang.RuntimeError
"
},
{
"
type
"
:
"
Exception
"
,
"
messageId
"
:
"
MessageId4
"
,
"
threadId
"
:
"
Thread2
"
,
"
text
"
:
"
java.lang.RuntimeException
"
}
]
}
}
]
};
var
jsObject
=
eval
(
jsonDate
);
var
threadArray
=
new
Array
();
threadArray
.
push
(
'
Minute
'
);
for
(
i
=
0
;
i
<
jsObject
.
threads
.
threads
.
length
;
i
++
)
{
threadArray
.
push
(
jsObject
.
threads
.
threads
[
i
]);
}
var
colModelArray
=
new
Array
();
for
(
i
=
0
;
i
<
threadArray
.
length
;
i
++
)
{
var
object
=
{
"
name
"
:
threadArray
[
i
],
"
index
"
:
threadArray
[
i
],
"
sorttype
"
:
"
string
"
};
colModelArray
.
push
(
object
);
}
$
(
function
()
{
$
(
"
#failureTable
"
).
jqGrid
({
datatype
:
"
local
"
,
colNames
:
threadArray
,
colModel
:
colModelArray
,
viewrecords
:
true
,
caption
:
"
Failure Report
"
,
height
:
250
,
loadComplete
:
function
()
{
var
grid
=
$
(
"
#failureTable
"
);
var
ids
=
grid
.
getDataIDs
();
for
(
var
i
=
0
;
i
<
ids
.
length
;
i
++
)
{
grid
.
setRowData
(
ids
[
i
],
false
,
{
height
:
25
});
}
grid
.
setGridHeight
(
'
auto
'
);
}
}).
navGrid
(
'
#pager2
'
,
{
edit
:
false
,
add
:
false
,
del
:
false
});
jQuery
(
"
#failureTable
"
).
jqGrid
(
'
setGridWidth
'
,
'
1500
'
);
for
(
var
i
=
0
;
i
<
jsObject
.
segments
.
length
;
i
++
)
{
var
segments
=
jsObject
.
segments
[
i
];
for
(
var
minute
in
segments
)
{
var
threadResult
=
creatNewArray
(
threadArray
.
length
);
threadResult
[
0
]
=
minute
;
var
segment
=
segments
[
minute
];
for
(
var
j
=
0
;
j
<
segment
.
entries
.
length
;
j
++
)
{
var
entry
=
segment
.
entries
[
j
];
var
threadId
=
entry
.
threadId
;
var
type
=
entry
.
type
;
var
messageId
=
entry
.
messageId
;
var
text
=
entry
.
text
;
var
index
=
getIndex
(
threadId
,
threadArray
);
var
url
=
getUrl
(
type
,
text
,
messageId
);
if
(
threadResult
[
index
]
==
""
){
threadResult
[
index
]
=
threadResult
[
index
]
+
url
;
}
else
{
threadResult
[
index
]
=
threadResult
[
index
]
+
'
</br>
'
+
url
;
}
}
var
minuteData
=
{};
for
(
var
i
=
0
;
i
<
threadArray
.
length
;
i
++
)
{
minuteData
[
threadArray
[
i
]]
=
threadResult
[
i
];
}
jQuery
(
"
#failureTable
"
).
jqGrid
(
'
addRowData
'
,
i
+
1
,
minuteData
);
}
}
});
function
creatNewArray
(
length
)
{
var
array
=
new
Array
();
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
array
.
push
(
""
);
}
return
array
;
}
function
getIndex
(
object
,
array
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
array
[
i
]
==
object
)
return
i
;
}
}
function
getUrl
(
type
,
text
,
messageId
)
{
if
(
type
==
'
RuntimeException
'
)
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:red;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
else
if
(
type
==
'
Exception
'
)
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:#FFFF00;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
else
if
(
type
==
'
Error
'
)
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:#FF00FF;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
else
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:#CC99FF;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
}
</script>
<div
style=
"align:center;width:90%;text-align:center"
>
<table
id=
"gridTable"
></table>
<table
id=
"failureTable"
></table>
</div>
</body>
</html>
\ No newline at end of file
cat-home/src/main/webapp/js/failure.js
浏览文件 @
19abe526
var
jsObject
=
eval
(
jsonDate
);
var
threadArray
=
new
Array
();
threadArray
.
push
(
'
Minute
'
);
var
jsObject
=
eval
(
jsonDate
);
var
threadArray
=
new
Array
();
threadArray
.
push
(
'
Minute
'
);
for
(
i
=
0
;
i
<
jsObject
.
threads
.
threads
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
jsObject
.
threads
.
threads
.
length
;
i
++
)
{
threadArray
.
push
(
jsObject
.
threads
.
threads
[
i
]);
}
}
var
colModelArray
=
new
Array
();
var
colModelArray
=
new
Array
();
for
(
i
=
0
;
i
<
threadArray
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
threadArray
.
length
;
i
++
)
{
var
object
=
{
"
name
"
:
threadArray
[
i
],
"
index
"
:
threadArray
[
i
],
"
sorttype
"
:
"
string
"
};
colModelArray
.
push
(
object
);
}
}
$
(
function
()
{
$
(
"
#failureTable
"
).
jqGrid
(
{
$
(
function
()
{
$
(
"
#failureTable
"
).
jqGrid
(
{
datatype
:
"
local
"
,
colNames
:
threadArray
,
colModel
:
colModelArray
,
viewrecords
:
true
,
caption
:
"
Failure Report
"
,
height
:
25
0
,
caption
:
"
From
"
+
jsObject
.
startTime
+
"
To
"
+
jsObject
.
endTime
+
"
Failure Report
"
+
"
Domain:
"
+
jsObject
.
domain
,
height
:
50
0
,
loadComplete
:
function
()
{
var
grid
=
$
(
"
#failureTable
"
);
var
ids
=
grid
.
getDataIDs
();
...
...
@@ -41,17 +41,11 @@
del
:
false
});
jQuery
(
"
#failureTable
"
).
jqGrid
(
'
setGridWidth
'
,
'
1500
'
);
for
(
var
i
=
0
;
i
<
jsObject
.
segments
.
length
;
i
++
)
{
var
segments
=
jsObject
.
segments
[
i
];
for
(
var
j
=
0
;
j
<
segments
.
length
;
j
++
){
//for ( var minute in segments) {
jQuery
(
"
#failureTable
"
).
jqGrid
(
'
setGridWidth
'
,
'
90%
'
);
for
(
var
i
=
0
;
i
<
jsObject
.
segments
.
length
;
i
++
)
{
var
segment
=
jsObject
.
segments
[
i
];
var
threadResult
=
creatNewArray
(
threadArray
.
length
);
threadResult
[
0
]
=
minute
;
var
segment
=
segments
[
j
];
// var segment = segments[minute];
threadResult
[
0
]
=
jsObject
.
segments
[
i
].
id
;
for
(
var
j
=
0
;
j
<
segment
.
entries
.
length
;
j
++
)
{
var
entry
=
segment
.
entries
[
j
];
var
threadId
=
entry
.
threadId
;
...
...
@@ -60,46 +54,48 @@
var
text
=
entry
.
text
;
var
index
=
getIndex
(
threadId
,
threadArray
);
var
url
=
getUrl
(
type
,
text
,
messageId
);
if
(
threadResult
[
index
]
==
""
)
{
var
url
=
getUrl
(
type
,
text
,
messageId
);
if
(
threadResult
[
index
]
==
""
)
{
threadResult
[
index
]
=
threadResult
[
index
]
+
url
;
}
else
{
threadResult
[
index
]
=
threadResult
[
index
]
+
'
</br>
'
+
url
;
}
else
{
threadResult
[
index
]
=
threadResult
[
index
]
+
'
</br>
'
+
url
;
}
}
var
minuteData
=
{};
for
(
var
i
=
0
;
i
<
threadArray
.
length
;
i
++
)
{
minuteData
[
threadArray
[
i
]]
=
threadResult
[
i
];
for
(
var
m
=
0
;
m
<
threadArray
.
length
;
m
++
)
{
minuteData
[
threadArray
[
m
]]
=
threadResult
[
m
];
}
jQuery
(
"
#failureTable
"
).
jqGrid
(
'
addRowData
'
,
i
+
1
,
minuteData
);
jQuery
(
"
#failureTable
"
).
jqGrid
(
'
addRowData
'
,
m
+
1
,
minuteData
);
}
}
});
function
creatNewArray
(
length
)
{
});
function
creatNewArray
(
length
)
{
var
array
=
new
Array
();
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
array
.
push
(
""
);
}
return
array
;
}
}
function
getIndex
(
object
,
array
)
{
function
getIndex
(
object
,
array
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
array
[
i
]
==
object
)
return
i
;
}
}
}
function
getUrl
(
type
,
text
,
messageId
)
{
function
getUrl
(
type
,
text
,
messageId
)
{
if
(
type
==
'
RuntimeException
'
)
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:red;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
return
'
<a target=
\'
_blank
\'
style=
\'
background:red;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
else
if
(
type
==
'
Exception
'
)
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:#FFFF00;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
return
'
<a target=
\'
_blank
\'
style=
\'
background:#FFFF00;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
else
if
(
type
==
'
Error
'
)
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:#FF00FF;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
return
'
<a target=
\'
_blank
\'
style=
\'
background:#FF00FF;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
else
{
return
'
<a target=
\'
_blank
\'
style=
\'
background:#CC99FF;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
return
'
<a target=
\'
_blank
\'
style=
\'
background:#CC99FF;
\'
href=
\'
www.dianping.com/messageId=
'
+
messageId
+
'
\'
>
'
+
text
+
'
</a>
'
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录