Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-ui
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
simba
9 years ago
Commit
8898d63b5ff99980c67cdfd6f5dc07794edfc7f2
1 parent
c2ea7def
update
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
372 additions
and
3 deletions
.gitignore
monitor-ui-common/pom.xml
monitor-ui-common/src/main/java/com/ui/model/BaseResponse.java
monitor-ui-common/src/main/java/com/ui/model/ErrorCode.java
monitor-ui-common/src/main/java/com/ui/model/rep/PageBean.java
monitor-ui-common/src/main/java/com/ui/model/rep/PageResponse.java
monitor-ui-common/src/main/java/com/ui/model/req/HostInfoReq.java
monitor-ui-common/src/main/java/com/ui/model/req/PageRequest.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/HostInfoCtrl.java
monitor-ui-web/src/main/webapp/index.jsp
.gitignore
View file @
8898d63
...
...
@@ -11,3 +11,5 @@ monitor-ui-ctrl/.gitignore
monitor-ui-ctrl/.project
.project
monitor-ui-common/.classpath
monitor-ui-ctrl/src/main/java/com/ui/ctrl/host/HostInfoCtrl.java
monitor-ui-ctrl/src/main/resources/META-INF/spring/spring-config-cmdb.xml
...
...
monitor-ui-common/pom.xml
View file @
8898d63
...
...
@@ -71,6 +71,10 @@
<artifactId>
commons-lang
</artifactId>
<version>
2.6
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
...
...
monitor-ui-common/src/main/java/com/ui/model/BaseResponse.java
0 → 100644
View file @
8898d63
package
com
.
ui
.
model
;
/**
* service返回信息对象
* @author hp
* 2014-03-11
*/
public
class
BaseResponse
<
T
>
{
private
int
code
=
200
;
private
String
message
=
"success"
;
private
T
data
;
public
BaseResponse
()
{}
public
BaseResponse
(
ErrorCode
errorCode
)
{
this
.
code
=
errorCode
.
getCode
();
this
.
message
=
errorCode
.
getMessage
();
}
public
BaseResponse
(
int
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
BaseResponse
(
T
data
)
{
this
.
data
=
data
;
}
public
BaseResponse
(
int
code
,
String
message
,
T
data
)
{
this
(
code
,
message
);
this
.
data
=
data
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
T
getData
()
{
return
data
;
}
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
}
}
...
...
monitor-ui-common/src/main/java/com/ui/model/ErrorCode.java
0 → 100644
View file @
8898d63
/**
*
*/
package
com
.
ui
.
model
;
import
lombok.Data
;
/**
* 描述:
*
* @author ping.huang
* 2016年3月31日
*/
@Data
public
class
ErrorCode
extends
BaseModel
{
public
ErrorCode
(
int
code
,
String
message
)
{
super
();
this
.
code
=
code
;
this
.
message
=
message
;
}
/**
*
*/
private
static
final
long
serialVersionUID
=
1665066362288658528L
;
private
int
code
;
private
String
message
;
}
...
...
monitor-ui-common/src/main/java/com/ui/model/rep/PageBean.java
0 → 100644
View file @
8898d63
package
com
.
ui
.
model
.
rep
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 分页对象
* @author ping.huang
*
*/
public
class
PageBean
{
private
int
pageNo
=
1
;
// 页码,默认是第一页
private
int
pageSize
=
10
;
// 每页显示的记录数,默认是10
private
int
totalRecord
;
// 总记录数
private
int
totalPage
;
// 总页数
private
int
startIndex
=
0
;
//查询的开始行数
private
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
// 其他的参数我们把它分装成一个Map对象
/**
* 初始化分页信息
*
* @param pageNo
* @param pageSize
* @param o
* @return
*/
public
static
PageBean
initPageInfo
(
int
pageNo
,
int
pageSize
,
Object
o
)
{
PageBean
page
=
new
PageBean
();
if
(
pageNo
>
0
)
{
page
.
setPageNo
(
pageNo
);
}
if
(
pageSize
>
0
)
{
page
.
setPageSize
(
pageSize
);
}
page
.
setStartIndex
((
page
.
getPageNo
()
-
1
)
*
page
.
getPageSize
());
if
(
o
!=
null
)
{
try
{
Field
[]
declaredFields
=
o
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
declaredFields
)
{
field
.
setAccessible
(
true
);
// 过滤内容为空的
if
(
field
.
get
(
o
)
==
null
)
{
continue
;
}
page
.
getParams
().
put
(
field
.
getName
(),
field
.
get
(
o
));
}
}
catch
(
IllegalAccessException
e
)
{
}
}
return
page
;
}
public
int
getPageNo
()
{
return
pageNo
;
}
public
void
setPageNo
(
int
pageNo
)
{
this
.
pageNo
=
pageNo
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
public
int
getTotalRecord
()
{
return
totalRecord
;
}
public
void
setTotalRecord
(
int
totalRecord
)
{
this
.
totalRecord
=
totalRecord
;
// 在设置总页数的时候计算出对应的总页数
int
totalPage
=
totalRecord
%
pageSize
==
0
?
totalRecord
/
pageSize
:
totalRecord
/
pageSize
+
1
;
this
.
setTotalPage
(
totalPage
);
}
public
int
getTotalPage
()
{
return
totalPage
;
}
public
void
setTotalPage
(
int
totalPage
)
{
this
.
totalPage
=
totalPage
;
}
public
int
getStartIndex
()
{
return
startIndex
;
}
public
void
setStartIndex
(
int
startIndex
)
{
this
.
startIndex
=
startIndex
;
}
public
Map
<
String
,
Object
>
getParams
()
{
return
params
;
}
public
void
setParams
(
Map
<
String
,
Object
>
params
)
{
this
.
params
=
params
;
}
}
...
...
monitor-ui-common/src/main/java/com/ui/model/rep/PageResponse.java
0 → 100644
View file @
8898d63
package
com
.
ui
.
model
.
rep
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 统一的分页响应对象 描述:
*
* @author ping.huang 2016年1月25日
*/
public
class
PageResponse
<
T
>
{
private
int
total
;
private
int
currentPage
;
private
int
pageSize
;
private
int
totalPage
;
private
List
<
T
>
rows
=
new
ArrayList
<>();
public
PageResponse
()
{
}
public
int
getTotal
()
{
return
total
;
}
public
void
setTotal
(
int
total
)
{
this
.
total
=
total
;
// 在设置总页数的时候计算出对应的总页数
dealTotalPage
();
}
private
void
dealTotalPage
()
{
if
(
total
>
0
&&
pageSize
>
0
)
{
int
totalPage
=
total
%
pageSize
==
0
?
total
/
pageSize
:
total
/
pageSize
+
1
;
this
.
setTotalPage
(
totalPage
);
}
}
public
int
getTotalPage
()
{
return
totalPage
;
}
public
void
setTotalPage
(
int
totalPage
)
{
this
.
totalPage
=
totalPage
;
}
public
List
<
T
>
getRows
()
{
return
rows
;
}
public
void
setRows
(
List
<
T
>
rows
)
{
this
.
rows
=
rows
;
}
public
int
getCurrentPage
()
{
return
currentPage
;
}
public
void
setCurrentPage
(
int
currentPage
)
{
this
.
currentPage
=
currentPage
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
}
...
...
monitor-ui-common/src/main/java/com/ui/model/req/HostInfoReq.java
0 → 100644
View file @
8898d63
package
com
.
ui
.
model
.
req
;
import
lombok.Data
;
/**
* Created by yoho on 2016/6/14.
*/
@Data
public
class
HostInfoReq
extends
PageRequest
{
private
String
alias
;
private
String
hostIp
;
private
int
groupId
;
private
String
tags
;
}
...
...
monitor-ui-common/src/main/java/com/ui/model/req/PageRequest.java
0 → 100644
View file @
8898d63
package
com
.
ui
.
model
.
req
;
/**
* 统一的分页请求对象 描述:
*
* @author ping.huang 2016年1月25日
*/
public
class
PageRequest
{
private
int
currentPage
=
1
;
private
int
pageSize
=
10
;
public
int
getCurrentPage
()
{
return
currentPage
;
}
public
void
setCurrentPage
(
int
currentPage
)
{
if
(
currentPage
<=
1
)
{
currentPage
=
1
;
}
this
.
currentPage
=
currentPage
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
}
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/HostInfoCtrl.java
0 → 100644
View file @
8898d63
package
com
.
ui
.
ctrl
;
import
com.alibaba.fastjson.JSON
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
import
com.ui.model.req.HostInfoReq
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* Created by yoho on 2016/6/14.
* 查询机器信息
*/
@Controller
@RequestMapping
(
"hostInfo"
)
public
class
HostInfoCtrl
{
Logger
log
=
LoggerFactory
.
getLogger
(
HostInfoCtrl
.
class
);
@Autowired
HttpRestClient
httpRestClient
;
@RequestMapping
(
"/getHostInfos"
)
@ResponseBody
public
BaseResponse
getHostInfos
(
HostInfoReq
req
)
throws
Exception
{
BaseResponse
response
=
httpRestClient
.
defaultPost
(
"/hostInfo/getHostInfos"
,
req
,
BaseResponse
.
class
);
System
.
out
.
println
(
"*****************************"
+
JSON
.
toJSON
(
response
));
return
response
;
}
}
...
...
monitor-ui-web/src/main/webapp/index.jsp
View file @
8898d63
...
...
@@ -38,7 +38,8 @@
<div
id=
"sidebar"
>
<ul>
<li
class=
"active"
><a
href=
"#"
><i
class=
"icon icon-home"
></i>
<span>
Dashboard
</span></a></li>
<li><a
href=
"#"
onclick=
"aa(this)"
><i
class=
"icon icon-th"
></i>
<span>
Tables
</span></a></li>
<li><a
href=
"#"
onclick=
"clickMenuToPage(this)"
><i
class=
"icon icon-th"
></i>
<span>
Tables
</span></a></li>
<li><a
href=
"#"
onclick=
"clickMenuToPage('/jsp/host/hostInfoList.jsp')"
><i
class=
"icon icon-th"
></i>
<span>
主机信息
</span></a></li>
</ul>
</div>
<!-- 右侧具体内容 -->
...
...
@@ -47,9 +48,9 @@
</div>
<script
type=
"text/javascript"
>
function
aa
(
){
function
clickMenuToPage
(
page
){
//加载左侧内容
$
(
"#content"
).
load
(
"<%=basePath %>
/jsp/table.jsp"
);
$
(
"#content"
).
load
(
"<%=basePath %>
"
+
page
);
}
</script>
</body>
...
...
Please
register
or
login
to post a comment