Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
71dd59ee
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,发现更多精彩内容 >>
提交
71dd59ee
编写于
4月 14, 2015
作者:
J
jialinsun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor database alteration jsp
上级
21ea5bb0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
46 deletion
+29
-46
cat-home/src/main/java/com/dianping/cat/report/page/storage/Handler.java
...in/java/com/dianping/cat/report/page/storage/Handler.java
+4
-15
cat-home/src/main/java/com/dianping/cat/report/page/storage/Model.java
...main/java/com/dianping/cat/report/page/storage/Model.java
+3
-3
cat-home/src/main/webapp/jsp/report/storage/dashboard.jsp
cat-home/src/main/webapp/jsp/report/storage/dashboard.jsp
+22
-28
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/storage/Handler.java
浏览文件 @
71dd59ee
package
com.dianping.cat.report.page.storage
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
...
...
@@ -77,8 +77,6 @@ public class Handler implements PageHandler<Context> {
@Inject
private
AlterationDao
m_alterationDao
;
private
SimpleDateFormat
m_sdf
=
new
SimpleDateFormat
(
"HH:mm"
);
private
Map
<
String
,
Map
<
String
,
List
<
String
>>>
buildAlertLinks
(
Map
<
String
,
StorageAlertInfo
>
alertInfos
,
String
type
)
{
Map
<
String
,
Map
<
String
,
List
<
String
>>>
links
=
new
LinkedHashMap
<
String
,
Map
<
String
,
List
<
String
>>>();
String
format
=
m_storageGroupConfigManager
.
queryLinkFormat
(
type
);
...
...
@@ -114,34 +112,25 @@ public class Handler implements PageHandler<Context> {
return
links
;
}
private
Map
<
String
,
List
<
Alteration
>
>
buildAlterations
(
Payload
payload
,
Model
model
)
{
private
List
<
Alteration
>
buildAlterations
(
Payload
payload
,
Model
model
)
{
int
minuteCounts
=
payload
.
getMinuteCounts
();
int
minute
=
model
.
getMinute
();
long
end
=
payload
.
getDate
()
+
(
minute
+
1
)
*
TimeHelper
.
ONE_MINUTE
-
TimeHelper
.
ONE_SECOND
;
long
start
=
payload
.
getDate
()
+
(
minute
+
1
-
minuteCounts
)
*
TimeHelper
.
ONE_MINUTE
;
Map
<
String
,
List
<
Alteration
>>
results
=
new
LinkedHashMap
<
String
,
List
<
Alteration
>
>();
List
<
Alteration
>
results
=
new
LinkedList
<
Alteration
>();
try
{
List
<
Alteration
>
alterations
=
m_alterationDao
.
findByTypeDruation
(
new
Date
(
start
),
new
Date
(
end
),
payload
.
getType
(),
AlterationEntity
.
READSET_FULL
);
for
(
Alteration
alteration
:
alterations
)
{
String
date
=
m_sdf
.
format
(
alteration
.
getDate
());
List
<
Alteration
>
alts
=
results
.
get
(
date
);
if
(
alts
==
null
)
{
alts
=
new
ArrayList
<
Alteration
>();
results
.
put
(
date
,
alts
);
}
alts
.
add
(
alteration
);
results
.
add
(
alteration
);
}
}
catch
(
DalNotFoundException
e
)
{
// ignore it
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
results
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/storage/Model.java
浏览文件 @
71dd59ee
...
...
@@ -54,7 +54,7 @@ public class Model extends AbstractReportModel<Action, ReportPage, Context> {
private
Map
<
String
,
Map
<
String
,
List
<
String
>>>
m_links
;
private
Map
<
String
,
List
<
Alteration
>
>
m_alterations
;
private
List
<
Alteration
>
m_alterations
;
private
String
m_distributionChart
;
...
...
@@ -74,7 +74,7 @@ public class Model extends AbstractReportModel<Action, ReportPage, Context> {
return
m_alertInfos
;
}
public
Map
<
String
,
List
<
Alteration
>
>
getAlterations
()
{
public
List
<
Alteration
>
getAlterations
()
{
return
m_alterations
;
}
...
...
@@ -184,7 +184,7 @@ public class Model extends AbstractReportModel<Action, ReportPage, Context> {
m_alertInfos
=
alertInfos
;
}
public
void
setAlterations
(
Map
<
String
,
List
<
Alteration
>
>
alterations
)
{
public
void
setAlterations
(
List
<
Alteration
>
alterations
)
{
m_alterations
=
alterations
;
}
...
...
cat-home/src/main/webapp/jsp/report/storage/dashboard.jsp
浏览文件 @
71dd59ee
...
...
@@ -5,6 +5,7 @@
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<%@ taglib
prefix=
"fn"
uri=
"http://java.sun.com/jsp/jstl/functions"
%>
<%@ taglib
prefix=
"fmt"
uri=
"http://java.sun.com/jsp/jstl/fmt"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.storage.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.storage.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.storage.Model"
scope=
"request"
/>
...
...
@@ -134,36 +135,29 @@
<th
class=
"center"
>
主机名
</th>
<th
class=
"center"
>
IP
</th>
<th
class=
"center"
>
标题
</th>
<th
class=
"
center
"
>
内容
</th>
<th
class=
"
left
"
>
内容
</th>
<th
class=
"center"
>
状态
</th>
</tr>
<c:forEach
var=
"entry"
items=
"
${
model
.
alterations
}
"
>
<tr><td
rowspan=
"${w:size(entry.value)}"
class=
"text-danger center"
style=
"vertical-align:middle;"
>
${entry.key}
</td>
<c:forEach
var=
"alt"
items=
"
${
entry
.
value
}
"
varStatus=
"index"
>
<c:if
test=
"
${
index
.
index
!=
0
}
"
>
<tr>
</c:if>
<td>
${alt.domain}
</td>
<td>
${alt.hostname}
</td>
<td>
${alt.ip}
</td>
<td>
${alt.title}
</td>
<td>
${alt.content}
</td>
<td>
<c:if
test=
"
${
alt
.
status
==
0
}
"
>
<button
class=
"btn btn-xs btn-success"
>
<i
class=
"ace-icon glyphicon glyphicon-ok bigger-120 btn-success"
></i>
</button>
</c:if>
<c:if
test=
"
${
alt
.
status
!=
0
}
"
>
<button
class=
"btn btn-xs btn-danger"
>
<i
class=
"ace-icon glyphicon glyphicon-remove bigger-120 btn-danger"
></i>
</button>
</c:if>
</td>
<c:if
test=
"
${
index
.
index
!=
0
}
"
>
</tr>
</c:if>
</c:forEach>
<c:forEach
var=
"alt"
items=
"
${
model
.
alterations
}
"
>
<tr>
<td><fmt:formatDate
value=
"
${
alt
.
date
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/></td>
<td>
${alt.domain}
</td>
<td>
${alt.hostname}
</td>
<td>
${alt.ip}
</td>
<td>
${alt.title}
</td>
<td
class=
"left"
>
${alt.content}
</td>
<td>
<c:if
test=
"
${
alt
.
status
==
0
}
"
>
<button
class=
"btn btn-xs btn-success"
>
<i
class=
"ace-icon glyphicon glyphicon-ok bigger-120 btn-success"
></i>
</button>
</c:if>
<c:if
test=
"
${
alt
.
status
!=
0
}
"
>
<button
class=
"btn btn-xs btn-danger"
>
<i
class=
"ace-icon glyphicon glyphicon-remove bigger-120 btn-danger"
></i>
</button>
</c:if>
</td>
</tr>
</c:forEach>
</c:if>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录