Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
af17959a
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,发现更多精彩内容 >>
提交
af17959a
编写于
3月 21, 2014
作者:
L
leon.li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix seval bugs
上级
a45a39ed
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
511 addition
and
121 deletion
+511
-121
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Action.java
.../java/com/dianping/cat/report/page/alteration/Action.java
+1
-0
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Handler.java
...java/com/dianping/cat/report/page/alteration/Handler.java
+153
-33
cat-home/src/main/java/com/dianping/cat/report/page/alteration/JspFile.java
...java/com/dianping/cat/report/page/alteration/JspFile.java
+1
-0
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Model.java
...n/java/com/dianping/cat/report/page/alteration/Model.java
+30
-13
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Payload.java
...java/com/dianping/cat/report/page/alteration/Payload.java
+144
-65
cat-home/src/main/resources/META-INF/dal/jdbc/report-codegen.xml
...e/src/main/resources/META-INF/dal/jdbc/report-codegen.xml
+4
-3
cat-home/src/main/resources/META-INF/dal/jdbc/report-dal.xml
cat-home/src/main/resources/META-INF/dal/jdbc/report-dal.xml
+5
-4
cat-home/src/main/webapp/jsp/report/alteration/alter_query.jsp
...ome/src/main/webapp/jsp/report/alteration/alter_query.jsp
+45
-0
cat-home/src/main/webapp/jsp/report/alteration/alter_view.jsp
...home/src/main/webapp/jsp/report/alteration/alter_view.jsp
+126
-2
cat-home/src/test/java/com/dianping/cat/TestServer.java
cat-home/src/test/java/com/dianping/cat/TestServer.java
+2
-1
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Action.java
浏览文件 @
af17959a
...
...
@@ -2,6 +2,7 @@ package com.dianping.cat.report.page.alteration;
public
enum
Action
implements
org
.
unidal
.
web
.
mvc
.
Action
{
INSERT
(
"insert"
),
VIEW
(
"view"
);
private
String
m_name
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Handler.java
浏览文件 @
af17959a
package
com.dianping.cat.report.page.alteration
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
javax.servlet.ServletException
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.home.dal.report.Alteration
;
import
com.dianping.cat.home.dal.report.AlterationDao
;
import
com.dianping.cat.home.dal.report.AlterationEntity
;
import
com.dianping.cat.report.ReportPage
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.web.mvc.PageHandler
;
import
org.unidal.web.mvc.annotation.InboundActionMeta
;
import
org.unidal.web.mvc.annotation.OutboundActionMeta
;
import
org.unidal.web.mvc.annotation.PayloadMeta
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.home.dal.report.Alteration
;
import
com.dianping.cat.home.dal.report.AlterationDao
;
import
com.dianping.cat.home.dal.report.AlterationEntity
;
import
com.dianping.cat.report.ReportPage
;
public
class
Handler
implements
PageHandler
<
Context
>
{
@Inject
private
JspViewer
m_jspViewer
;
...
...
@@ -26,8 +31,6 @@ public class Handler implements PageHandler<Context> {
@Inject
private
AlterationDao
m_alterationDao
;
private
SimpleDateFormat
m_sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
@Override
@PayloadMeta
(
Payload
.
class
)
@InboundActionMeta
(
name
=
"alteration"
)
...
...
@@ -38,6 +41,7 @@ public class Handler implements PageHandler<Context> {
@Override
@OutboundActionMeta
(
name
=
"alteration"
)
public
void
handleOutbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Model
model
=
new
Model
(
ctx
);
Payload
payload
=
ctx
.
getPayload
();
Action
action
=
payload
.
getAction
();
...
...
@@ -46,14 +50,14 @@ public class Handler implements PageHandler<Context> {
String
domain
=
payload
.
getDomain
();
String
hostname
=
payload
.
getHostname
();
switch
(
action
)
{
switch
(
action
)
{
case
INSERT:
String
title
=
payload
.
getTitle
();
String
ip
=
payload
.
getIp
();
String
user
=
payload
.
getUser
();
String
content
=
payload
.
getContent
();
String
url
=
payload
.
getUrl
();
String
date
=
payload
.
getDate
();
Date
date
=
payload
.
getAlterationDate
();
Alteration
alt
=
new
Alteration
();
alt
.
setType
(
type
);
...
...
@@ -64,10 +68,9 @@ public class Handler implements PageHandler<Context> {
alt
.
setContent
(
content
);
alt
.
setUrl
(
url
);
alt
.
setHostname
(
hostname
);
alt
.
setDate
(
date
);
try
{
alt
.
setDate
(
m_sdf
.
parse
(
date
));
m_alterationDao
.
insert
(
alt
);
model
.
setStatus
(
"{\"status\":200}"
);
}
catch
(
Exception
e
)
{
...
...
@@ -76,28 +79,145 @@ public class Handler implements PageHandler<Context> {
}
break
;
case
VIEW:
String
startTime
=
payload
.
getStartTime
();
String
endTime
=
payload
.
getEndTime
();
long
granularity
=
payload
.
getGranularity
();
List
<
Alteration
>
alts
;
Date
startTime
=
payload
.
getStartTime
();
Date
endTime
=
payload
.
getEndTime
();
List
<
AltBarrel
>
barrels
=
new
ArrayList
<
AltBarrel
>();
try
{
m_alterationDao
.
findByDtdh
(
m_sdf
.
parse
(
startTime
),
m_sdf
.
parse
(
endTime
),
type
,
domain
,
hostname
,
AlterationEntity
.
READSET_FULL
);
model
.
setViewDataSuccess
(
true
);
alts
=
m_alterationDao
.
findByDtdh
(
startTime
,
endTime
,
type
,
domain
,
hostname
,
AlterationEntity
.
READSET_FULL
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
model
.
setViewDataSuccess
(
false
);
break
;
}
System
.
out
.
println
(
alts
.
size
());
/*
long startMill = startTime.getTime();
long endMill = endTime.getTime() - granularity;
List<Alteration> tmpAlts = new ArrayList<Alteration>();
int tmp = 0,
length = alts.size();
while (startMill <= endMill) {
endMill -= granularity;
for (int i = tmp; i < alts.size() && alts.get(i).getDate().getTime() > endMill; i++) {
tmp++;
tmpAlts.add(alts.get(i));
}
if (tmp >= length)
break;
if (tmpAlts.size() > 0)
barrels.add(new AltBarrel(sdf.format(new Date(endMill)), sdf.format(new Date(endMill + granularity)),
tmpAlts));
}
int l = barrels.size();
if (l > 10) {
barrels = barrels.subList(0, 10);
}
model.setBarrels(barrels);
*/
long
startMill
=
startTime
.
getTime
();
long
endMill
=
endTime
.
getTime
();
Map
<
Long
,
List
<
Alteration
>>
alterations
=
new
TreeMap
<
Long
,
List
<
Alteration
>>();
for
(
Alteration
alt_genBarrel
:
alts
)
{
long
barTime
=
alt_genBarrel
.
getDate
().
getTime
();
long
key
;
List
<
Alteration
>
tmpAlts_genBarrel
;
if
(
endMill
==
barTime
){
key
=
barTime
-
granularity
;
}
if
((
endMill
-
barTime
)/
granularity
==
0
){
key
=
barTime
;
}
else
{
key
=
endMill
-
((
endMill
-
barTime
)/
granularity
+
1
)*
granularity
;
}
if
(
alterations
.
get
(
key
)==
null
){
alterations
.
put
(
key
,
new
ArrayList
<
Alteration
>());
}
tmpAlts_genBarrel
=
alterations
.
get
(
key
);
tmpAlts_genBarrel
.
add
(
alt_genBarrel
);
}
Iterator
it
=
alterations
.
entrySet
().
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
ent
=
(
Map
.
Entry
)
it
.
next
();
long
key
=
(
Long
)
ent
.
getKey
();
List
<
Alteration
>
value
=
(
List
<
Alteration
>)
ent
.
getValue
();
barrels
.
add
(
new
AltBarrel
(
sdf
.
format
(
new
Date
(
key
-
granularity
)),
sdf
.
format
(
new
Date
(
key
)),
value
));
}
int
l
=
barrels
.
size
();
System
.
out
.
println
(
l
);
if
(
l
>
10
)
{
barrels
=
barrels
.
subList
(
0
,
10
);
}
model
.
setBarrels
(
barrels
);
break
;
}
if
(
action
!=
null
)
model
.
setAction
(
action
);
else
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
ALTERATION
);
if
(!
ctx
.
isProcessStopped
())
{
m_jspViewer
.
view
(
ctx
,
model
);
}
}
public
class
AltBarrel
{
private
List
<
Alteration
>
alterations
;
private
String
startTime
;
private
String
endTime
;
public
AltBarrel
(
String
startTime
,
String
endTime
,
List
<
Alteration
>
tmpAlts
)
{
this
.
startTime
=
startTime
;
this
.
endTime
=
endTime
;
this
.
alterations
=
tmpAlts
;
}
public
List
<
Alteration
>
getAlterations
()
{
// TODO
int
length
=
alterations
.
size
();
if
(
length
>
10
)
{
return
alterations
.
subList
(
0
,
10
);
}
return
alterations
;
}
public
void
setAlterations
(
List
<
Alteration
>
alterations
)
{
this
.
alterations
=
alterations
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/alteration/JspFile.java
浏览文件 @
af17959a
...
...
@@ -2,6 +2,7 @@ package com.dianping.cat.report.page.alteration;
public
enum
JspFile
{
INSERT
(
"/jsp/report/alteration/alter_insertResult.jsp"
),
VIEW
(
"/jsp/report/alteration/alter_view.jsp"
),
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Model.java
浏览文件 @
af17959a
package
com.dianping.cat.report.page.alteration
;
import
com.dianping.cat.report.ReportPage
;
import
org.unidal.web.mvc.ViewModel
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
public
class
Model
extends
ViewModel
<
ReportPage
,
Action
,
Context
>
{
import
com.dianping.cat.Constants
;
import
com.dianping.cat.report.page.AbstractReportModel
;
import
com.dianping.cat.report.page.alteration.Handler.AltBarrel
;
private
String
m_status
;
private
boolean
m_isViewDataSuccess
;
public
class
Model
extends
AbstractReportModel
<
Action
,
Context
>
{
public
boolean
isViewDataSuccess
()
{
return
m_isViewDataSuccess
;
}
private
String
m_status
;
public
void
setViewDataSuccess
(
boolean
isViewDataSuccess
)
{
this
.
m_isViewDataSuccess
=
isViewDataSuccess
;
}
private
List
<
AltBarrel
>
m_barrels
;
public
String
getStatus
()
{
return
m_status
;
}
public
void
setStatus
(
String
status
)
{
this
.
m_status
=
status
;
m_status
=
status
;
}
public
List
<
AltBarrel
>
getBarrels
()
{
return
m_barrels
;
}
public
void
setBarrels
(
List
<
AltBarrel
>
barrels
)
{
m_barrels
=
barrels
;
}
public
Model
(
Context
ctx
)
{
...
...
@@ -32,4 +39,14 @@ public class Model extends ViewModel<ReportPage, Action, Context> {
public
Action
getDefaultAction
()
{
return
Action
.
VIEW
;
}
@Override
public
Collection
<
String
>
getDomains
()
{
return
new
ArrayList
<
String
>();
}
@Override
public
String
getDomain
()
{
return
Constants
.
CAT
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/alteration/Payload.java
浏览文件 @
af17959a
package
com.dianping.cat.report.page.alteration
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.AbstractReportPayload
;
import
org.unidal.web.mvc.ActionContext
;
import
org.unidal.web.mvc.ActionPayload
;
import
org.unidal.web.mvc.payload.annotation.FieldMeta
;
public
class
Payload
implements
ActionPayload
<
ReportPage
,
Action
>
{
public
class
Payload
extends
AbstractReportPayload
<
Action
>
{
private
ReportPage
m_page
;
@FieldMeta
(
"frequency"
)
private
int
m_frequency
=
10
;
@FieldMeta
(
"refresh"
)
private
boolean
m_refresh
=
false
;
@FieldMeta
(
"fullScreen"
)
private
boolean
fullScreen
=
false
;
@FieldMeta
(
"op"
)
private
Action
m_action
;
...
...
@@ -23,8 +39,8 @@ public class Payload implements ActionPayload<ReportPage, Action> {
@FieldMeta
(
"ip"
)
private
String
m_ip
;
@FieldMeta
(
"
d
ate"
)
private
String
m_
d
ate
;
@FieldMeta
(
"
alterationD
ate"
)
private
String
m_
alterationD
ate
;
@FieldMeta
(
"user"
)
private
String
m_user
;
...
...
@@ -47,121 +63,184 @@ public class Payload implements ActionPayload<ReportPage, Action> {
@FieldMeta
(
"hostname"
)
private
String
m_hostname
;
public
String
getStartTime
()
{
return
m_startTime
;
}
private
SimpleDateFormat
m_sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
public
String
getType
()
{
return
m_type
;
public
Payload
()
{
super
(
ReportPage
.
ALTERATION
)
;
}
public
void
setType
(
String
type
)
{
this
.
m_type
=
type
;
@Override
public
Action
getAction
()
{
if
(
m_action
==
null
)
{
return
Action
.
VIEW
;
}
else
{
return
m_action
;
}
}
public
String
getTitle
()
{
return
m_title
;
public
Date
getAlterationDate
()
{
try
{
return
m_sdf
.
parse
(
m_alterationDate
);
}
catch
(
ParseException
e
)
{
return
new
Date
();
}
}
public
void
setTitle
(
String
title
)
{
this
.
m_title
=
title
;
public
String
getContent
(
)
{
return
m_content
;
}
public
String
getDomain
()
{
if
(
""
.
equals
(
m_domain
))
{
return
null
;
}
else
{
return
m_domain
;
}
}
public
void
setDomain
(
String
domain
)
{
this
.
m_domain
=
domain
;
public
Date
getEndTime
()
{
if
(
m_endTime
==
null
||
m_endTime
.
length
()
==
0
)
{
return
new
Date
();
}
else
{
try
{
return
m_sdf
.
parse
(
m_endTime
);
}
catch
(
ParseException
e
)
{
return
new
Date
();
}
}
}
public
int
getFrequency
()
{
return
m_frequency
;
}
public
long
getGranularity
()
{
return
m_granularity
;
}
public
String
getHostname
()
{
if
(
""
.
equals
(
m_hostname
)){
return
null
;
}
else
{
return
m_hostname
;
}
}
public
String
getIp
()
{
return
m_ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
m_ip
=
ip
;
public
ReportPage
getPage
(
)
{
return
m_page
;
}
public
String
getDate
()
{
return
m_date
;
public
Date
getStartTime
()
{
if
(
m_startTime
==
null
||
m_startTime
.
length
()
==
0
)
{
return
new
Date
(
System
.
currentTimeMillis
()
-
TimeUtil
.
ONE_HOUR
);
}
else
{
try
{
return
m_sdf
.
parse
(
m_startTime
);
}
catch
(
ParseException
e
)
{
return
new
Date
();
}
}
}
public
void
setDate
(
String
date
)
{
this
.
m_date
=
date
;
public
String
getTitle
()
{
return
m_title
;
}
public
String
getType
()
{
return
m_type
;
}
public
String
getUrl
()
{
return
m_url
;
}
public
String
getUser
()
{
return
m_user
;
}
public
void
setUser
(
String
user
)
{
this
.
m_user
=
user
;
public
boolean
isFullScreen
(
)
{
return
fullScreen
;
}
public
String
getContent
()
{
return
m_content
;
public
boolean
isRefresh
()
{
return
m_refresh
;
}
public
void
setAction
(
String
action
)
{
m_action
=
Action
.
getByName
(
action
,
Action
.
VIEW
);
}
public
void
setAlterationDate
(
String
alterationDate
)
{
m_alterationDate
=
alterationDate
;
}
public
void
setContent
(
String
content
)
{
this
.
m_content
=
content
;
m_content
=
content
;
}
public
String
getUrl
(
)
{
return
m_url
;
public
void
setDomain
(
String
domain
)
{
m_domain
=
domain
;
}
public
void
set
Url
(
String
url
)
{
this
.
m_url
=
url
;
public
void
set
EndTime
(
String
endTime
)
{
m_endTime
=
endTime
;
}
public
void
set
StartTime
(
String
m_startTime
)
{
this
.
m_startTime
=
m_startTime
;
public
void
set
Frequency
(
int
frequency
)
{
m_frequency
=
frequency
;
}
public
String
getEndTime
(
)
{
return
m_endTime
;
public
void
setFullScreen
(
boolean
fullScreen
)
{
this
.
fullScreen
=
fullScreen
;
}
public
void
set
EndTime
(
String
m_endTime
)
{
this
.
m_endTime
=
m_endTime
;
public
void
set
Granularity
(
long
granularity
)
{
m_granularity
=
granularity
;
}
public
long
getGranularity
(
)
{
return
m_granularity
;
public
void
setHostname
(
String
hostname
)
{
m_hostname
=
hostname
;
}
public
void
set
Granularity
(
long
m_granularity
)
{
this
.
m_granularity
=
m_granularity
;
public
void
set
Ip
(
String
ip
)
{
m_ip
=
ip
;
}
public
String
getHostname
(
)
{
return
m_hostnam
e
;
public
void
setPage
(
ReportPage
page
)
{
m_page
=
pag
e
;
}
public
void
setHostname
(
String
hostname
)
{
this
.
m_hostname
=
hostname
;
@Override
public
void
setPage
(
String
page
)
{
m_page
=
ReportPage
.
getByName
(
page
,
ReportPage
.
ALTERATION
);
}
public
void
setRefresh
(
boolean
refresh
)
{
m_refresh
=
refresh
;
}
public
void
set
Action
(
String
action
)
{
m_
action
=
Action
.
getByName
(
action
,
Action
.
VIEW
)
;
public
void
set
StartTime
(
String
startTime
)
{
m_
startTime
=
startTime
;
}
@Override
public
Action
getAction
()
{
return
m_action
;
public
void
setTitle
(
String
title
)
{
m_title
=
title
;
}
@Override
public
ReportPage
getPage
()
{
return
m_page
;
public
void
setType
(
String
type
)
{
m_type
=
type
;
}
@Override
public
void
setPage
(
String
page
)
{
m_page
=
ReportPage
.
getByName
(
page
,
ReportPage
.
ALTERATION
);
public
void
setUrl
(
String
url
)
{
m_url
=
url
;
}
public
void
setUser
(
String
user
)
{
m_user
=
user
;
}
@Override
...
...
cat-home/src/main/resources/META-INF/dal/jdbc/report-codegen.xml
浏览文件 @
af17959a
...
...
@@ -5,15 +5,16 @@
<member
name=
"type"
field=
"type"
value-type=
"String"
length=
"64"
nullable=
"false"
/>
<member
name=
"title"
field=
"title"
value-type=
"String"
length=
"128"
nullable=
"false"
/>
<member
name=
"domain"
field=
"domain"
value-type=
"String"
length=
"128"
nullable=
"false"
/>
<member
name=
"ip"
field=
"ip"
value-type=
"String"
length=
"128"
nullable=
"false"
/>
<member
name=
"hostname"
field=
"hostname"
value-type=
"String"
length=
"128"
nullable=
"false"
/>
<member
name=
"ip"
field=
"ip"
value-type=
"String"
length=
"128"
/>
<member
name=
"date"
field=
"date"
value-type=
"Date"
nullable=
"false"
/>
<member
name=
"user"
field=
"user"
value-type=
"String"
length=
"45"
nullable=
"false"
/>
<member
name=
"content"
field=
"content"
value-type=
"String"
length=
"65535"
/>
<member
name=
"content"
field=
"content"
value-type=
"String"
length=
"65535"
nullable=
"false"
/>
<member
name=
"url"
field=
"url"
value-type=
"String"
length=
"200"
/>
<member
name=
"creation-date"
field=
"creation_date"
value-type=
"Date"
nullable=
"false"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<primary-key
name=
"PRIMARY"
members=
"id"
/>
<index
name=
"ind_d
om_ip"
members=
"date ASC, domain ASC, ip
ASC"
/>
<index
name=
"ind_d
ate_domain_host"
members=
"date ASC, domain ASC, hostname
ASC"
/>
<readsets>
<readset
name=
"FULL"
all=
"true"
/>
</readsets>
...
...
cat-home/src/main/resources/META-INF/dal/jdbc/report-dal.xml
浏览文件 @
af17959a
...
...
@@ -4,9 +4,9 @@
<member
name=
"creation-date"
insert-expr=
"NOW()"
/>
<var
name=
"start-time"
value-type=
"Date"
/>
<var
name=
"end-time"
value-type=
"Date"
/>
<
var
name=
"type"
value-type=
"String
"
/>
<
var
name=
"domain"
value-type=
"String
"
/>
<
var
name=
"hostname"
value-type=
"String
"
/>
<
param
name=
"type
"
/>
<
param
name=
"domain
"
/>
<
param
name=
"hostname
"
/>
<query-defs>
<query
name=
"find-by-dtdh"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-time"
/>
...
...
@@ -28,6 +28,7 @@
<IF
type=
'NOT_NULL'
field=
'hostname'
>
AND
<FIELD
name=
'hostname'
/>
= ${hostname}
</IF>
ORDER BY
<FIELD
name=
'date'
/>
DESC
]]>
</statement>
</query>
</query-defs>
...
...
cat-home/src/main/webapp/jsp/report/alteration/alter_query.jsp
0 → 100644
浏览文件 @
af17959a
<%@ taglib
prefix=
"fmt"
uri=
"http://java.sun.com/jsp/jstl/fmt"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<div
class=
"text-left text-info"
></div>
时间粒度
<select
class=
"input-small"
id=
"granularity"
>
<option
value=
"1000"
>
1 sec
</option>
<option
value=
"5000"
>
5 sec
</option>
<option
value=
"60000"
>
1 min
</option>
<option
value=
"300000"
>
5 min
</option>
<option
value=
"3600000"
>
1 hour
</option>
<option
value=
"86400000"
>
1 day
</option>
</select>
开始
<input
type=
"text"
name=
"startTime"
id=
"startTime"
value=
"
<fmt:formatDate
value=
"
${
payload
.
startTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
"
style=
"height:auto"
class=
"input-medium"
placeholder=
"格式如:2014-02-02 00:00:00"
>
结束
<input
type=
"text"
name=
"endTime"
id=
"endTime"
value=
"
<fmt:formatDate
value=
"
${
payload
.
endTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
"
style=
"height:auto"
class=
"input-medium"
placeholder=
"格式如:2014-02-02 00:00:00"
>
应用名
<input
type=
"text"
name=
"domain"
id=
"domain"
value=
"${payload.domain}"
style=
"height:auto"
class=
"input-small"
>
机器名
<input
type=
"text"
name=
"hostname"
id=
"hostname"
value=
"${payload.hostname}"
style=
"height:auto"
class=
"input-small"
>
<input
class=
"btn btn-primary btn-small"
value=
"查询"
onclick=
"queryNew()"
type=
"submit"
>
<c:if
test=
"
${
!
payload
.
fullScreen
}
"
>
<a
id=
"fullScreen"
class=
'btn btn-small btn-primary'
href=
"?fullScreen=true&refresh=${payload.refresh}&frequency=${payload.frequency}&startTime=
<fmt:formatDate
value=
"
${
payload
.
startTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&endTime=
<fmt:formatDate
value=
"
${
payload
.
endTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&granularity=${payload.granularity}"
>
全屏
</a>
</c:if>
<c:if
test=
"
${
payload
.
fullScreen
}
"
>
<a
id=
"fullScreen"
class=
'btn btn-small btn-primary'
href=
"?fullScreen=false&refresh=${payload.refresh}&frequency=${payload.frequency}&startTime=
<fmt:formatDate
value=
"
${
payload
.
startTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&endTime=
<fmt:formatDate
value=
"
${
payload
.
endTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&granularity=${payload.granularity}"
>
全屏
</a>
</c:if>
<a
id=
"refresh10"
class=
'btn btn-small btn-primary'
href=
"?fullScreen=${payload.fullScreen}&refresh=true&frequency=10&startTime=
<fmt:formatDate
value=
"
${
payload
.
startTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&endTime=
<fmt:formatDate
value=
"
${
payload
.
endTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&granularity=${payload.granularity}"
>
10秒定时刷新
</a>
<a
id=
"refresh20"
class=
'btn btn-small btn-primary'
href=
"?fullScreen=${payload.fullScreen}&refresh=true&frequency=20&startTime=
<fmt:formatDate
value=
"
${
payload
.
startTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&endTime=
<fmt:formatDate
value=
"
${
payload
.
endTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&granularity=${payload.granularity}"
>
20秒定时刷新
</a>
<a
id=
"refresh30"
class=
'btn btn-small btn-primary'
href=
"?fullScreen=${payload.fullScreen}&refresh=true&frequency=30&startTime=
<fmt:formatDate
value=
"
${
payload
.
startTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&endTime=
<fmt:formatDate
value=
"
${
payload
.
endTime
}
"
pattern=
"yyyy-MM-dd HH:mm:ss"
/>
&granularity=${payload.granularity}"
>
30秒定时刷新
</a>
</div>
<script>
function
queryNew
(){
var
granularity
=
$
(
"
#granularity
"
).
val
();
var
startTime
=
$
(
"
#startTime
"
).
val
();
var
endTime
=
$
(
"
#endTime
"
).
val
();
var
domain
=
$
(
"
#domain
"
).
val
();
var
hostname
=
$
(
"
#hostname
"
).
val
();
window
.
location
.
href
=
"
?op=view&domain=
"
+
domain
+
"
&granularity=
"
+
granularity
+
"
&startTime=
"
+
startTime
+
"
&endTime=
"
+
endTime
+
"
&hostname=
"
+
hostname
;
}
</script>
cat-home/src/main/webapp/jsp/report/alteration/alter_view.jsp
浏览文件 @
af17959a
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ page
session=
"false"
language=
"java"
pageEncoding=
"UTF-8"
%>
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ taglib
prefix=
"w"
uri=
"http://www.unidal.org/web/core"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.alteration.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.alteration.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.alteration.Model"
scope=
"request"
/>
View of alteration page under report
\ No newline at end of file
<c:set
var=
"barrels"
value=
"
${
model
.
barrels
}
"
/>
<a:report
title=
"Alteration Report"
navUrlPrefix=
""
>
<jsp:body>
<res:useJs
value=
"
${
res
.
js
.
local
[
'highcharts.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'baseGraph.js'
]
}
"
target=
"head-js"
/>
<table
class=
"machines"
>
<tr>
<th>
<%@ include
file=
"alter_query.jsp"
%>
</th>
</tr>
</table>
<table
class=
"problem table table-striped table-bordered table-condensed table-hover"
style=
"width:100%"
>
<tr
class=
"text-success"
>
<th
width=
"15%"
>
时间
</th>
<th
width=
"85%"
>
详细信息
</th>
</tr>
<c:forEach
var=
"barrel"
items=
"
${
model
.
barrels
}
"
varStatus=
"typeIndex"
>
<tr
style=
"width:85%"
>
<td>
${barrel.startTime}
</br>
${barrel.endTime}
</td>
<td>
<table
class=
"table table-striped table-bordered table-condensed table-hover"
>
<tr
class=
"text-success"
>
<th
width=
"15%"
>
标题
</th>
<th
width=
"5%"
>
类型
</th>
<th
width=
"5%"
>
应用
</th>
<th
width=
"8%"
>
主机名
</th>
<th
width=
"15%"
>
变更时间
</th>
<th
width=
"5%"
>
变更用户
</th>
<th
width=
"5%"
>
详情
</th>
</tr>
<c:forEach
var=
"item"
items=
"
${
barrel
.
alterations
}
"
varStatus=
"index"
>
<tr>
<td
class=
"text-info"
>
<i
tips=
""
data-trigger=
"hover"
class=
"icon-question-sign"
data-toggle=
"popover"
data-placement=
"top"
data-content=
"${item.content}"
></i>
${item.title}
</td>
<td
class=
"alertation${item.type}"
>
${item.type}
</td>
<td
>
${item.domain}
</td>
<td
>
${item.hostname}
</td>
<td
>
${item.date}
</td>
<td
>
${item.user}
</td>
<td
>
<c:if
test=
" ${empty item.url}"
>
<a
href=
"${item.url}"
>
link
</a>
</c:if>
</td>
</tr>
</c:forEach>
</table>
</td>
</tr>
</c:forEach>
</table>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'
i[tips]
'
).
popover
();
$
(
"
.header
"
).
hide
();
<c:if
test=
"
${
payload
.
fullScreen
}
"
>
$
(
'
#fullScreen
'
).
addClass
(
'
btn-danger
'
);
$
(
'
.navbar
'
).
hide
();
$
(
'
.footer
'
).
hide
();
</c:if>
<c:if
test=
"
${
!
payload
.
fullScreen
}
"
>
$
(
'
#fullScreen
'
).
removeClass
(
'
btn-danger
'
);
$
(
'
.navbar
'
).
show
();
$
(
'
.footer
'
).
show
();
</c:if>
/*
$('#fullScreen').click(function(){
if($('#fullScreen').hasClass('btn-danger')){
$('#fullScreen').removeClass('btn-danger');
$('#fullScreen').val('full');
$('.navbar').show();
$('.footer').show();
}else{
$('#fullScreen').addClass('btn-danger');
$('#fullScreen').val('exit');
$('.navbar').hide();
$('.footer').hide();
}
});*/
var
refresh
=
$
{
payload
.
refresh
};
var
frequency
=
$
{
payload
.
frequency
};
if
(
refresh
){
$
(
'
#refresh${payload.frequency}
'
).
addClass
(
'
btn-danger
'
);
setInterval
(
function
(){
location
.
reload
();
},
frequency
*
1000
);
};
var
value
=
$
{
payload
.
granularity
};
$
(
"
#granularity
"
).
val
(
value
);
});
</script>
<res:useJs
value=
"
${
res
.
js
.
local
.
problem_js
}
"
target=
"buttom-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
.
problemHistory_js
}
"
target=
"bottom-js"
/>
</jsp:body>
</a:report>
\ No newline at end of file
cat-home/src/test/java/com/dianping/cat/TestServer.java
浏览文件 @
af17959a
...
...
@@ -32,7 +32,8 @@ public class TestServer extends JettyServer {
@Override
protected
int
getServerPort
()
{
return
2281
;
//return 2281;
return
8080
;
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录