Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
cd250035
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,发现更多精彩内容 >>
提交
cd250035
编写于
10月 28, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #580 from jialinsun/master
web,app,appconfig json download & cross font size change
上级
65c1e88d
63b47b3c
变更
30
显示空白变更内容
内联
并排
Showing
30 changed file
with
289 addition
and
90 deletion
+289
-90
cat-home/src/main/java/com/dianping/cat/report/page/app/Action.java
...rc/main/java/com/dianping/cat/report/page/app/Action.java
+2
-0
cat-home/src/main/java/com/dianping/cat/report/page/app/Handler.java
...c/main/java/com/dianping/cat/report/page/app/Handler.java
+74
-25
cat-home/src/main/java/com/dianping/cat/report/page/app/JspFile.java
...c/main/java/com/dianping/cat/report/page/app/JspFile.java
+1
-0
cat-home/src/main/java/com/dianping/cat/report/page/app/JspViewer.java
...main/java/com/dianping/cat/report/page/app/JspViewer.java
+3
-0
cat-home/src/main/java/com/dianping/cat/report/page/app/Model.java
...src/main/java/com/dianping/cat/report/page/app/Model.java
+11
-0
cat-home/src/main/java/com/dianping/cat/report/page/app/graph/AppGraphCreator.java
...m/dianping/cat/report/page/app/graph/AppGraphCreator.java
+0
-1
cat-home/src/main/java/com/dianping/cat/report/page/app/graph/PieChartDetailInfo.java
...ianping/cat/report/page/app/graph/PieChartDetailInfo.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/app/graph/Sorter.java
...n/java/com/dianping/cat/report/page/app/graph/Sorter.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/web/Action.java
...rc/main/java/com/dianping/cat/report/page/web/Action.java
+2
-1
cat-home/src/main/java/com/dianping/cat/report/page/web/Handler.java
...c/main/java/com/dianping/cat/report/page/web/Handler.java
+48
-20
cat-home/src/main/java/com/dianping/cat/report/page/web/JspFile.java
...c/main/java/com/dianping/cat/report/page/web/JspFile.java
+2
-1
cat-home/src/main/java/com/dianping/cat/report/page/web/JspViewer.java
...main/java/com/dianping/cat/report/page/web/JspViewer.java
+2
-0
cat-home/src/main/java/com/dianping/cat/report/page/web/Model.java
...src/main/java/com/dianping/cat/report/page/web/Model.java
+10
-0
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
...main/java/com/dianping/cat/system/page/config/Action.java
+2
-0
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
...ain/java/com/dianping/cat/system/page/config/Handler.java
+16
-2
cat-home/src/main/java/com/dianping/cat/system/page/config/JspFile.java
...ain/java/com/dianping/cat/system/page/config/JspFile.java
+2
-0
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
...n/java/com/dianping/cat/system/page/config/JspViewer.java
+2
-0
cat-home/src/main/java/com/dianping/cat/system/page/config/Model.java
.../main/java/com/dianping/cat/system/page/config/Model.java
+29
-19
cat-home/src/main/java/com/dianping/cat/system/page/config/process/AppConfigProcessor.java
...ng/cat/system/page/config/process/AppConfigProcessor.java
+39
-1
cat-home/src/main/webapp/jsp/report/app/appLinechart.jsp
cat-home/src/main/webapp/jsp/report/app/appLinechart.jsp
+2
-0
cat-home/src/main/webapp/jsp/report/app/json.jsp
cat-home/src/main/webapp/jsp/report/app/json.jsp
+3
-0
cat-home/src/main/webapp/jsp/report/cross/cross.jsp
cat-home/src/main/webapp/jsp/report/cross/cross.jsp
+3
-3
cat-home/src/main/webapp/jsp/report/cross/crossHistoryHost.jsp
...ome/src/main/webapp/jsp/report/cross/crossHistoryHost.jsp
+3
-3
cat-home/src/main/webapp/jsp/report/cross/crossHistoryMethod.jsp
...e/src/main/webapp/jsp/report/cross/crossHistoryMethod.jsp
+3
-3
cat-home/src/main/webapp/jsp/report/cross/crossHistoryProject.jsp
.../src/main/webapp/jsp/report/cross/crossHistoryProject.jsp
+3
-3
cat-home/src/main/webapp/jsp/report/cross/crossHost.jsp
cat-home/src/main/webapp/jsp/report/cross/crossHost.jsp
+3
-3
cat-home/src/main/webapp/jsp/report/cross/crossMethod.jsp
cat-home/src/main/webapp/jsp/report/cross/crossMethod.jsp
+3
-3
cat-home/src/main/webapp/jsp/report/web/json.jsp
cat-home/src/main/webapp/jsp/report/web/json.jsp
+9
-0
cat-home/src/main/webapp/jsp/report/web/web.jsp
cat-home/src/main/webapp/jsp/report/web/web.jsp
+0
-0
cat-home/src/main/webapp/jsp/system/appConfig/appConfigJson.jsp
...me/src/main/webapp/jsp/system/appConfig/appConfigJson.jsp
+10
-0
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/app/Action.java
浏览文件 @
cd250035
...
...
@@ -2,7 +2,9 @@ package com.dianping.cat.report.page.app;
public
enum
Action
implements
org
.
unidal
.
web
.
mvc
.
Action
{
VIEW
(
"view"
),
LINECHART_JSON
(
"linechartJson"
),
PIECHART
(
"piechart"
),
PIECHART_JSON
(
"piechartJson"
),
APP_ADD
(
"appAdd"
),
APP_DELETE
(
"appDelete"
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/Handler.java
浏览文件 @
cd250035
...
...
@@ -3,7 +3,9 @@ package com.dianping.cat.report.page.app;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.ServletException
;
...
...
@@ -23,10 +25,13 @@ import com.dianping.cat.config.app.AppDataSpreadInfo;
import
com.dianping.cat.config.app.QueryEntity
;
import
com.dianping.cat.configuration.app.entity.Command
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.JsonBuilder
;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.page.PayloadNormalizer
;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.app.graph.AppGraphCreator
;
import
com.dianping.cat.report.page.app.graph.PieChartDetailInfo
;
import
com.dianping.cat.report.page.app.graph.Sorter
;
import
com.dianping.cat.system.config.AppRuleConfigManager
;
public
class
Handler
implements
PageHandler
<
Context
>
{
...
...
@@ -90,34 +95,41 @@ public class Handler implements PageHandler<Context> {
switch
(
action
)
{
case
VIEW:
QueryEntity
linechartEntity1
=
payload
.
getQueryEntity1
();
QueryEntity
linechartEntity2
=
payload
.
getQueryEntity2
();
String
type
=
payload
.
getType
();
try
{
filterCommands
(
model
,
payload
.
isShowActivity
());
Pair
<
LineChart
,
List
<
AppDataSpreadInfo
>>
lineChartPair
=
buildLineChart
(
model
,
payload
,
field
,
sortBy
);
LineChart
lineChart
=
m_appGraphCreator
.
buildLineChart
(
linechartEntity1
,
linechartEntity2
,
type
);
List
<
AppDataSpreadInfo
>
appDataSpreadInfos
=
m_appDataService
.
buildAppDataSpreadInfo
(
linechartEntity1
,
field
);
Collections
.
sort
(
appDataSpreadInfos
,
new
Sorter
(
sortBy
).
buildLineChartInfoComparator
());
if
(
lineChartPair
!=
null
)
{
model
.
setLineChart
(
lineChartPair
.
getKey
());
model
.
setAppDataSpreadInfos
(
lineChartPair
.
getValue
());
}
break
;
case
LINECHART_JSON:
Pair
<
LineChart
,
List
<
AppDataSpreadInfo
>>
lineChartJsonPair
=
buildLineChart
(
model
,
payload
,
field
,
sortBy
);
model
.
setLineChart
(
lineChart
);
model
.
setAppDataSpreadInfos
(
appDataSpreadInfos
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
if
(
lineChartJsonPair
!=
null
)
{
Map
<
String
,
Object
>
lineChartObjs
=
new
HashMap
<
String
,
Object
>();
lineChartObjs
.
put
(
"lineCharts"
,
lineChartJsonPair
.
getKey
());
lineChartObjs
.
put
(
"lineChartDetails"
,
lineChartJsonPair
.
getValue
());
model
.
setJson
(
new
JsonBuilder
().
toJson
(
lineChartObjs
));
}
break
;
case
PIECHART:
try
{
Pair
<
PieChart
,
List
<
PieChartDetailInfo
>>
pair
=
m_appGraphCreator
.
buildPieChart
(
payload
.
getQueryEntity1
(),
field
);
List
<
PieChartDetailInfo
>
infos
=
pair
.
getValue
();
Collections
.
sort
(
infos
,
new
Sorter
().
buildPieChartInfoComparator
());
Pair
<
PieChart
,
List
<
PieChartDetailInfo
>>
pieChartPair
=
buildPieChart
(
model
,
payload
,
field
);
model
.
setPieChart
(
pair
.
getKey
());
model
.
setPieChartDetailInfos
(
infos
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
if
(
pieChartPair
!=
null
)
{
model
.
setPieChart
(
pieChartPair
.
getKey
());
model
.
setPieChartDetailInfos
(
pieChartPair
.
getValue
());
}
break
;
case
PIECHART_JSON:
Pair
<
PieChart
,
List
<
PieChartDetailInfo
>>
pieChartJsonPair
=
buildPieChart
(
model
,
payload
,
field
);
if
(
pieChartJsonPair
!=
null
)
{
Map
<
String
,
Object
>
pieChartObjs
=
new
HashMap
<
String
,
Object
>();
pieChartObjs
.
put
(
"pieCharts"
,
pieChartJsonPair
.
getKey
());
pieChartObjs
.
put
(
"pieChartDetails"
,
pieChartJsonPair
.
getValue
());
model
.
setJson
(
new
JsonBuilder
().
toJson
(
pieChartObjs
));
}
break
;
case
APP_ADD:
...
...
@@ -165,6 +177,43 @@ public class Handler implements PageHandler<Context> {
}
}
private
Pair
<
PieChart
,
List
<
PieChartDetailInfo
>>
buildPieChart
(
Model
model
,
Payload
payload
,
AppDataGroupByField
field
)
{
try
{
Pair
<
PieChart
,
List
<
PieChartDetailInfo
>>
pair
=
m_appGraphCreator
.
buildPieChart
(
payload
.
getQueryEntity1
(),
field
);
List
<
PieChartDetailInfo
>
infos
=
pair
.
getValue
();
Collections
.
sort
(
infos
,
new
Sorter
().
buildPieChartInfoComparator
());
return
pair
;
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
null
;
}
private
Pair
<
LineChart
,
List
<
AppDataSpreadInfo
>>
buildLineChart
(
Model
model
,
Payload
payload
,
AppDataGroupByField
field
,
String
sortBy
)
{
QueryEntity
linechartEntity1
=
payload
.
getQueryEntity1
();
QueryEntity
linechartEntity2
=
payload
.
getQueryEntity2
();
String
type
=
payload
.
getType
();
try
{
filterCommands
(
model
,
payload
.
isShowActivity
());
LineChart
lineChart
=
m_appGraphCreator
.
buildLineChart
(
linechartEntity1
,
linechartEntity2
,
type
);
List
<
AppDataSpreadInfo
>
appDataSpreadInfos
=
m_appDataService
.
buildAppDataSpreadInfo
(
linechartEntity1
,
field
);
Collections
.
sort
(
appDataSpreadInfos
,
new
Sorter
(
sortBy
).
buildLineChartInfoComparator
());
model
.
setLineChart
(
lineChart
);
model
.
setAppDataSpreadInfos
(
appDataSpreadInfos
);
return
new
Pair
<
LineChart
,
List
<
AppDataSpreadInfo
>>(
lineChart
,
appDataSpreadInfos
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
null
;
}
private
void
normalize
(
Model
model
,
Payload
payload
)
{
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
APP
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/JspFile.java
浏览文件 @
cd250035
...
...
@@ -4,6 +4,7 @@ public enum JspFile {
VIEW
(
"/jsp/report/app/appLinechart.jsp"
),
PIECHART
(
"/jsp/report/app/appPiechart.jsp"
),
APP_MODIFY_RESULT
(
"/jsp/report/app/result.jsp"
),
JSON
(
"/jsp/report/app/json.jsp"
)
;
private
String
m_path
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/JspViewer.java
浏览文件 @
cd250035
...
...
@@ -17,6 +17,9 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
case
APP_ADD:
case
APP_DELETE:
return
JspFile
.
APP_MODIFY_RESULT
.
getPath
();
case
LINECHART_JSON:
case
PIECHART_JSON:
return
JspFile
.
JSON
.
getPath
();
}
throw
new
RuntimeException
(
"Unknown action: "
+
action
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/Model.java
浏览文件 @
cd250035
...
...
@@ -17,6 +17,7 @@ import com.dianping.cat.report.page.AbstractReportModel;
import
com.dianping.cat.report.page.JsonBuilder
;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.app.graph.PieChartDetailInfo
;
public
class
Model
extends
AbstractReportModel
<
Action
,
Context
>
{
...
...
@@ -46,6 +47,8 @@ public class Model extends AbstractReportModel<Action, Context> {
private
String
m_content
;
private
String
m_json
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
}
...
...
@@ -119,6 +122,10 @@ public class Model extends AbstractReportModel<Action, Context> {
return
new
JsonBuilder
().
toJson
(
map
);
}
public
String
getJson
()
{
return
m_json
;
}
public
LineChart
getLineChart
()
{
return
m_lineChart
;
}
...
...
@@ -167,6 +174,10 @@ public class Model extends AbstractReportModel<Action, Context> {
m_content
=
content
;
}
public
void
setJson
(
String
json
)
{
m_json
=
json
;
}
public
void
setLineChart
(
LineChart
lineChart
)
{
m_lineChart
=
lineChart
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/graph/AppGraphCreator.java
浏览文件 @
cd250035
...
...
@@ -23,7 +23,6 @@ import com.dianping.cat.report.chart.AbstractGraphCreator;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.PieChart.Item
;
import
com.dianping.cat.report.page.app.PieChartDetailInfo
;
public
class
AppGraphCreator
extends
AbstractGraphCreator
{
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/PieChartDetailInfo.java
→
cat-home/src/main/java/com/dianping/cat/report/page/app/
graph/
PieChartDetailInfo.java
浏览文件 @
cd250035
package
com.dianping.cat.report.page.app
;
package
com.dianping.cat.report.page.app
.graph
;
public
class
PieChartDetailInfo
{
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/Sorter.java
→
cat-home/src/main/java/com/dianping/cat/report/page/app/
graph/
Sorter.java
浏览文件 @
cd250035
package
com.dianping.cat.report.page.app
;
package
com.dianping.cat.report.page.app
.graph
;
import
java.util.Comparator
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/Action.java
浏览文件 @
cd250035
package
com.dianping.cat.report.page.web
;
public
enum
Action
implements
org
.
unidal
.
web
.
mvc
.
Action
{
VIEW
(
"view"
);
VIEW
(
"view"
),
JSON
(
"json"
);
private
String
m_name
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/Handler.java
浏览文件 @
cd250035
...
...
@@ -4,6 +4,7 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -23,6 +24,7 @@ import com.dianping.cat.config.url.UrlPatternConfigManager;
import
com.dianping.cat.configuration.url.pattern.entity.PatternItem
;
import
com.dianping.cat.helper.TimeHelper
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.JsonBuilder
;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.page.PayloadNormalizer
;
import
com.dianping.cat.report.page.PieChart
;
...
...
@@ -87,10 +89,14 @@ public class Handler implements PageHandler<Context> {
pars
.
put
(
"channel"
,
channel
);
pars
.
put
(
"city"
,
city
);
Action
action
=
payload
.
getAction
();
switch
(
action
)
{
case
VIEW:
if
(
url
!=
null
)
{
if
(
Monitor
.
TYPE_INFO
.
equals
(
type
))
{
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
charts
=
m_graphCreator
.
queryBaseInfo
(
startDate
,
endDate
,
url
,
pars
);
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
charts
=
m_graphCreator
.
queryBaseInfo
(
startDate
,
endDate
,
url
,
pars
);
Map
<
String
,
LineChart
>
lineCharts
=
charts
.
getKey
();
List
<
PieChart
>
pieCharts
=
charts
.
getValue
();
...
...
@@ -109,6 +115,28 @@ public class Handler implements PageHandler<Context> {
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
WEB
);
model
.
setCityInfo
(
m_cityManager
.
getCityInfo
());
break
;
case
JSON:
if
(
url
!=
null
)
{
Map
<
String
,
Object
>
jsonObjs
=
new
HashMap
<
String
,
Object
>();
if
(
Monitor
.
TYPE_INFO
.
equals
(
type
))
{
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
charts
=
m_graphCreator
.
queryBaseInfo
(
startDate
,
endDate
,
url
,
pars
);
jsonObjs
.
put
(
"lineCharts"
,
charts
.
getKey
());
jsonObjs
.
put
(
"pieCharts"
,
charts
.
getValue
());
}
else
{
Pair
<
LineChart
,
PieChart
>
pair
=
m_graphCreator
.
queryErrorInfo
(
startDate
,
endDate
,
url
,
pars
);
jsonObjs
.
put
(
"lineChart"
,
pair
.
getKey
());
jsonObjs
.
put
(
"pieChart"
,
pair
.
getValue
());
}
model
.
setJson
(
new
JsonBuilder
().
toJson
(
jsonObjs
));
}
break
;
}
if
(!
ctx
.
isProcessStopped
())
{
m_jspViewer
.
view
(
ctx
,
model
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/JspFile.java
浏览文件 @
cd250035
package
com.dianping.cat.report.page.web
;
public
enum
JspFile
{
VIEW
(
"/jsp/report/web.jsp"
),
VIEW
(
"/jsp/report/web/web.jsp"
),
JSON
(
"/jsp/report/web/json.jsp"
),
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/JspViewer.java
浏览文件 @
cd250035
...
...
@@ -12,6 +12,8 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
switch
(
action
)
{
case
VIEW:
return
JspFile
.
VIEW
.
getPath
();
case
JSON:
return
JspFile
.
JSON
.
getPath
();
}
throw
new
RuntimeException
(
"Unknown action: "
+
action
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/Model.java
浏览文件 @
cd250035
...
...
@@ -33,6 +33,8 @@ public class Model extends AbstractReportModel<Action, Context> {
private
String
m_cityInfo
;
private
String
m_json
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
}
...
...
@@ -79,6 +81,10 @@ public class Model extends AbstractReportModel<Action, Context> {
return
new
JsonBuilder
().
toJson
(
maps
);
}
public
String
getJson
()
{
return
m_json
;
}
public
LineChart
getLineChart
()
{
return
m_lineChart
;
}
...
...
@@ -119,6 +125,10 @@ public class Model extends AbstractReportModel<Action, Context> {
m_end
=
end
;
}
public
void
setJson
(
String
json
)
{
m_json
=
json
;
}
public
void
setLineChart
(
LineChart
lineChart
)
{
m_lineChart
=
lineChart
;
}
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
浏览文件 @
cd250035
...
...
@@ -141,6 +141,8 @@ public enum Action implements org.unidal.web.mvc.Action {
APP_CONFIG_UPDATE
(
"appConfigUpdate"
),
APP_CONFIG_DOWNLOAD
(
"appConfigDownload"
),
APP_COMPARISON_CONFIG_UPDATE
(
"appComparisonConfigUpdate"
),
THIRD_PARTY_CONFIG_UPDATE
(
"thirdPartyConfigUpdate"
),
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
浏览文件 @
cd250035
...
...
@@ -6,6 +6,7 @@ import java.util.Date;
import
javax.servlet.ServletException
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletResponse
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.web.mvc.PageHandler
;
...
...
@@ -83,6 +84,7 @@ public class Handler implements PageHandler<Context> {
model
.
setPage
(
SystemPage
.
CONFIG
);
Action
action
=
payload
.
getAction
();
HttpServletResponse
response
=
ctx
.
getHttpServletResponse
();
storeModifyInfo
(
ctx
,
payload
);
model
.
setAction
(
action
);
...
...
@@ -177,12 +179,13 @@ public class Handler implements PageHandler<Context> {
case
APP_SUBMIT:
case
APP_PAGE_DELETE:
case
APP_CONFIG_UPDATE:
case
APP_CONFIG_DOWNLOAD:
case
APP_RULE:
case
APP_RULE_ADD_OR_UPDATE:
case
APP_RULE_ADD_OR_UPDATE_SUBMIT:
case
APP_RULE_DELETE:
case
APP_COMPARISON_CONFIG_UPDATE:
m_appConfigProcessor
.
process
(
action
,
payload
,
model
);
m_appConfigProcessor
.
process
(
action
,
payload
,
model
,
response
);
break
;
case
ALERT_DEFAULT_RECEIVERS:
...
...
@@ -190,8 +193,19 @@ public class Handler implements PageHandler<Context> {
m_alertConfigProcessor
.
process
(
action
,
payload
,
model
);
break
;
}
if
(
needJspViewer
(
action
,
payload
))
{
m_jspViewer
.
view
(
ctx
,
model
);
}
}
private
boolean
needJspViewer
(
Action
action
,
Payload
payload
)
{
if
(
Action
.
APP_CONFIG_DOWNLOAD
.
equals
(
action
)
&&
"xml"
.
equalsIgnoreCase
(
payload
.
getType
()))
{
return
false
;
}
else
{
return
true
;
}
}
public
void
store
(
String
userName
,
String
accountName
,
Payload
payload
)
{
ConfigModification
modification
=
m_configModificationDao
.
createLocal
();
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspFile.java
浏览文件 @
cd250035
...
...
@@ -97,6 +97,8 @@ public enum JspFile {
APP_CONFIG_UPDATE
(
"/jsp/system/appConfig/appConfig.jsp"
),
APP_CONFIG_DWONLOAD
(
"/jsp/system/appConfig/appConfigJson.jsp"
),
APP_COMPARISON_CONFIG_UPDATE
(
"/jsp/system/appComparison/appComparison.jsp"
),
ROUTER_CONFIG_UPDATE
(
"/jsp/system/router/routerConfig.jsp"
),
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
浏览文件 @
cd250035
...
...
@@ -146,6 +146,8 @@ public class JspViewer extends BaseJspViewer<SystemPage, Action, Context, Model>
return
JspFile
.
APP_RULE_UPDATE
.
getPath
();
case
APP_CONFIG_UPDATE:
return
JspFile
.
APP_CONFIG_UPDATE
.
getPath
();
case
APP_CONFIG_DOWNLOAD:
return
JspFile
.
APP_CONFIG_DWONLOAD
.
getPath
();
case
APP_COMPARISON_CONFIG_UPDATE:
return
JspFile
.
APP_COMPARISON_CONFIG_UPDATE
.
getPath
();
case
THIRD_PARTY_CONFIG_UPDATE:
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Model.java
浏览文件 @
cd250035
...
...
@@ -33,6 +33,25 @@ import com.dianping.cat.system.page.config.process.BaseProcesser.RuleItem;
public
class
Model
extends
ViewModel
<
SystemPage
,
Action
,
Context
>
{
public
static
class
Edge
{
private
List
<
EdgeConfig
>
m_edgeConfigs
;
private
NodeConfig
m_nodeConfig
;
public
Edge
(
List
<
EdgeConfig
>
edgeConfigs
,
NodeConfig
nodeConfig
)
{
m_edgeConfigs
=
edgeConfigs
;
m_nodeConfig
=
nodeConfig
;
}
public
List
<
EdgeConfig
>
getEdgeConfigs
()
{
return
m_edgeConfigs
;
}
public
NodeConfig
getNodeConfig
()
{
return
m_nodeConfig
;
}
}
private
Project
m_project
;
private
List
<
Project
>
m_projects
;
...
...
@@ -77,6 +96,8 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
private
String
m_content
;
private
String
m_appConfigJson
;
private
String
m_metricItemConfigRule
;
private
Map
<
String
,
Domain
>
m_productLineToDomains
;
...
...
@@ -147,6 +168,10 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
return
m_aggregationRules
;
}
public
String
getAppConfigJson
()
{
return
m_appConfigJson
;
}
public
String
getBug
()
{
return
m_bug
;
}
...
...
@@ -400,6 +425,10 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
m_aggregationRules
=
aggregationRules
;
}
public
void
setAppConfigJson
(
String
appConfigJson
)
{
m_appConfigJson
=
appConfigJson
;
}
public
void
setBug
(
String
bug
)
{
m_bug
=
bug
;
}
...
...
@@ -559,23 +588,4 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
public
void
setVersions
(
Map
<
Integer
,
Item
>
versions
)
{
m_versions
=
versions
;
}
public
static
class
Edge
{
private
List
<
EdgeConfig
>
m_edgeConfigs
;
private
NodeConfig
m_nodeConfig
;
public
Edge
(
List
<
EdgeConfig
>
edgeConfigs
,
NodeConfig
nodeConfig
)
{
m_edgeConfigs
=
edgeConfigs
;
m_nodeConfig
=
nodeConfig
;
}
public
List
<
EdgeConfig
>
getEdgeConfigs
()
{
return
m_edgeConfigs
;
}
public
NodeConfig
getNodeConfig
()
{
return
m_nodeConfig
;
}
}
}
cat-home/src/main/java/com/dianping/cat/system/page/config/process/AppConfigProcessor.java
浏览文件 @
cd250035
package
com.dianping.cat.system.page.config.process
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.zip.GZIPOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.config.app.AppComparisonConfigManager
;
import
com.dianping.cat.config.app.AppConfigManager
;
import
com.dianping.cat.configuration.app.entity.Command
;
import
com.dianping.cat.report.page.JsonBuilder
;
import
com.dianping.cat.system.config.AppRuleConfigManager
;
import
com.dianping.cat.system.page.config.Action
;
import
com.dianping.cat.system.page.config.Model
;
...
...
@@ -34,7 +42,7 @@ public class AppConfigProcessor extends BaseProcesser {
model
.
setCommands
(
appConfigManager
.
queryCommands
());
}
public
void
process
(
Action
action
,
Payload
payload
,
Model
model
)
{
public
void
process
(
Action
action
,
Payload
payload
,
Model
model
,
HttpServletResponse
httpResponse
)
{
int
id
;
switch
(
action
)
{
...
...
@@ -92,6 +100,28 @@ public class AppConfigProcessor extends BaseProcesser {
}
model
.
setContent
(
m_appConfigManager
.
getConfig
().
toString
());
break
;
case
APP_CONFIG_DOWNLOAD:
String
type
=
payload
.
getType
();
if
(
StringUtils
.
isEmpty
(
type
))
{
type
=
"json"
;
}
try
{
if
(
"xml"
.
equalsIgnoreCase
(
type
))
{
ServletOutputStream
outputStream
=
httpResponse
.
getOutputStream
();
byte
[]
compress
=
compress
(
m_appConfigManager
.
getConfig
().
toString
());
httpResponse
.
setContentType
(
"application/xml;charset=utf-8"
);
httpResponse
.
addHeader
(
"Content-Encoding"
,
"gzip"
);
outputStream
.
write
(
compress
);
}
else
if
(
"json"
.
equalsIgnoreCase
(
type
))
{
model
.
setAppConfigJson
(
new
JsonBuilder
().
toJson
(
m_appConfigManager
.
getConfig
()));
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
break
;
case
APP_RULE:
buildAppConfigInfo
(
m_appConfigManager
,
model
);
model
.
setRules
(
m_appRuleConfigManager
.
getMonitorRules
().
getRules
().
values
());
...
...
@@ -122,6 +152,14 @@ public class AppConfigProcessor extends BaseProcesser {
}
}
private
byte
[]
compress
(
String
str
)
throws
IOException
{
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
(
1024
*
32
);
GZIPOutputStream
gzip
=
new
GZIPOutputStream
(
out
);
gzip
.
write
(
str
.
getBytes
());
gzip
.
close
();
return
out
.
toByteArray
();
}
private
void
generateCommandsForModel
(
Model
model
)
{
List
<
Command
>
commands
=
m_appConfigManager
.
queryCommands
();
model
.
setCommands
(
commands
);
...
...
cat-home/src/main/webapp/jsp/report/app/appLinechart.jsp
浏览文件 @
cd250035
...
...
@@ -20,6 +20,8 @@
if
(
value
==
true
)
{
$
(
'
#history
'
).
slideDown
();
$
(
"
#domains2
"
).
val
(
$
(
"
#domains
"
).
val
());
$
(
"
#domains2
"
).
change
();
$
(
"
#command2
"
).
val
(
$
(
"
#command
"
).
val
());
command2Change
();
$
(
"
#code2
"
).
val
(
$
(
"
#code
"
).
val
());
...
...
cat-home/src/main/webapp/jsp/report/app/json.jsp
0 → 100644
浏览文件 @
cd250035
<%@ page
contentType=
"text/html; charset=utf-8"
session=
"false"
%>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.app.Model"
scope=
"request"
/>
${model.json}
\ No newline at end of file
cat-home/src/main/webapp/jsp/report/cross/cross.jsp
浏览文件 @
cd250035
...
...
@@ -44,7 +44,7 @@
</script>
<table
class=
"table table-striped table-condensed "
>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
调用其他Pigeon服务
</h4
></td></tr>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
调用其他Pigeon服务
</strong
></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=name"
>
RemoteProject
</a></th>
...
...
@@ -68,10 +68,10 @@
</c:if>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4
></td>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 服务器端数据 ]
</strong
></td>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 客户端数据 ]
</h4
></td>
<td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 客户端数据 ]
</strong
></td>
</c:if>
</tr>
<tr>
...
...
cat-home/src/main/webapp/jsp/report/cross/crossHistoryHost.jsp
浏览文件 @
cd250035
...
...
@@ -46,7 +46,7 @@
</script>
<table
class=
'table table-striped table-condensed'
>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
调用其他Pigeon服务
</h4
></td></tr>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
调用其他Pigeon服务
</strong
></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&serviceSort=${model.serviceSort}&callSort=name${model.customDate}"
>
RemoteIp
</a></th>
...
...
@@ -69,10 +69,10 @@
</c:forEach>
</c:if>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4
></td>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 服务器端数据 ]
</strong
></td>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 客户端数据 ]
</h4
></td>
<td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 客户端数据 ]
</strong
></td>
</c:if>
</tr>
<tr>
...
...
cat-home/src/main/webapp/jsp/report/cross/crossHistoryMethod.jsp
浏览文件 @
cd250035
...
...
@@ -63,7 +63,7 @@
}
</script>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
h4>
调用其他Pigeon服务
</h4
></td></tr>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
strong>
调用其他Pigeon服务
</strong
></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
...
...
@@ -89,10 +89,10 @@
</c:if>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4
></td>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 服务器端数据 ]
</strong
></td>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"8"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 客户端数据 ]
</h4
></td>
<td
colspan=
"8"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 客户端数据 ]
</strong
></td>
</c:if>
</tr>
<tr>
...
...
cat-home/src/main/webapp/jsp/report/cross/crossHistoryProject.jsp
浏览文件 @
cd250035
...
...
@@ -46,7 +46,7 @@
</script>
<table
class=
'table table-striped table-condensed '
>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
调用其他Pigeon服务
</h4
></td></tr>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
调用其他Pigeon服务
</strong
></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=name${model.customDate}"
>
RemoteProject
</a></th>
...
...
@@ -69,10 +69,10 @@
</c:forEach>
</c:if>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4
></td>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 服务器端数据 ]
</strong
></td>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 客户端数据 ]
</h4
></td>
<td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 客户端数据 ]
</strong
></td>
</c:if>
</tr>
<tr>
...
...
cat-home/src/main/webapp/jsp/report/cross/crossHost.jsp
浏览文件 @
cd250035
...
...
@@ -46,7 +46,7 @@
</script>
<table
class=
'table table-striped table-condensed '
>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
调用其他Pigeon服务
</h4
></td></tr>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
调用其他Pigeon服务
</strong
></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&serviceSort=${model.serviceSort}&callSort=name"
>
RemoteIp
</a></th>
...
...
@@ -70,10 +70,10 @@
</c:if>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4
></td>
<tr><td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 服务器端数据 ]
</strong
></td>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 客户端数据 ]
</h4
></td>
<td
colspan=
"7"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 客户端数据 ]
</strong
></td>
</c:if>
</tr>
<tr>
...
...
cat-home/src/main/webapp/jsp/report/cross/crossMethod.jsp
浏览文件 @
cd250035
...
...
@@ -84,7 +84,7 @@
}
</script>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
h4>
调用其他Pigeon服务
</h4
></td></tr>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
strong>
调用其他Pigeon服务
</strong
></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
...
...
@@ -110,10 +110,10 @@
</c:if>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4
></td>
<tr><td
colspan=
"8"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 服务器端数据 ]
</strong
></td>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"8"
style=
"text-align:center"
><
h4>
提供Pigeon服务 [ 客户端数据 ]
</h4
></td>
<td
colspan=
"8"
style=
"text-align:center"
><
strong>
提供Pigeon服务 [ 客户端数据 ]
</strong
></td>
</c:if>
</tr>
<tr>
...
...
cat-home/src/main/webapp/jsp/report/web/json.jsp
0 → 100644
浏览文件 @
cd250035
<%@ 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.web.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.web.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.web.Model"
scope=
"request"
/>
${model.json}
\ No newline at end of file
cat-home/src/main/webapp/jsp/report/web.jsp
→
cat-home/src/main/webapp/jsp/report/web
/web
.jsp
浏览文件 @
cd250035
文件已移动
cat-home/src/main/webapp/jsp/system/appConfig/appConfigJson.jsp
0 → 100644
浏览文件 @
cd250035
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<%@ taglib
prefix=
"w"
uri=
"http://www.unidal.org/web/core"
%>
<%@taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.system.page.config.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.system.page.config.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.system.page.config.Model"
scope=
"request"
/>
${model.appConfigJson}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录