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
Plain Diff
Browse Files
Authored by
bblu
8 years ago
Commit
b29404fbfb9f734e57804ccd4f74573a54f409dd
2 parents
65bafa13
d39145f4
Merge branch 'master' into switch_conf
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
373 additions
and
1 deletions
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
monitor-ui-common/src/main/java/com/ui/model/domain/CenterSwitchModel.java
monitor-ui-common/src/main/resources/META-INF/spring/spring-config-common.xml
monitor-ui-ctrl/src/main/java/com/ui/ctrl/CenterSwitchCtrl.java
monitor-ui-web/src/main/webapp/jsp/switch/center_switch.jsp
monitor-ui-web/src/main/webapp/jsp/switch/center_switch_exe.jsp
monitor-ui-web/src/main/webapp/script/common/genarate_left_panel.js
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
View file @
b29404f
...
...
@@ -161,4 +161,8 @@ public class HttpUriContants {
public
static
final
String
JAVA_STOP_RESTART
=
"/javaRestart/stopOrRestart"
;
public
static
final
String
JAVA_GET_MESSAGE
=
"/javaRestart/getMessage"
;
//双中心切换
public
static
final
String
CENTERSWITCH_GET
=
"/centerSwitch/getSwitchList"
;
public
static
final
String
CENTERSWITCH_SWITCH
=
"/centerSwitch/doExe"
;
}
...
...
monitor-ui-common/src/main/java/com/ui/model/domain/CenterSwitchModel.java
0 → 100644
View file @
b29404f
package
com
.
ui
.
model
.
domain
;
import
lombok.Data
;
/**
* Created by zhengyouwei on 2016/10/24.
*/
@Data
public
class
CenterSwitchModel
{
private
String
name
;
private
String
cName
;
private
String
exe
;
private
String
toCloud
;
}
...
...
monitor-ui-common/src/main/resources/META-INF/spring/spring-config-common.xml
View file @
b29404f
...
...
@@ -22,7 +22,7 @@
class=
"org.springframework.http.client.HttpComponentsClientHttpRequestFactory"
>
<constructor-arg
ref=
"httpClient"
/>
<property
name=
"connectTimeout"
value=
"30000"
/>
<property
name=
"readTimeout"
value=
"30000"
/>
<property
name=
"readTimeout"
value=
"30000
0
"
/>
</bean>
<bean
id=
"restTemplate"
class=
"org.springframework.web.client.RestTemplate"
>
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/CenterSwitchCtrl.java
0 → 100644
View file @
b29404f
package
com
.
ui
.
ctrl
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
import
com.ui.model.domain.CenterSwitchModel
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.servlet.ModelAndView
;
import
java.util.List
;
/**
* Created by zhengyouwei on 2016/10/24.
*/
@RestController
@RequestMapping
(
value
=
"/centerSwitch"
)
public
class
CenterSwitchCtrl
{
Logger
log
=
LoggerFactory
.
getLogger
(
JavaRestartCtrl
.
class
);
@Autowired
private
HttpRestClient
httpClient
;
@RequestMapping
(
"/toCenterSwitch"
)
public
ModelAndView
toCenterSwitch
(){
return
new
ModelAndView
(
"switch/center_switch"
);
}
@RequestMapping
(
"/getSwitchList"
)
@ResponseBody
public
BaseResponse
getSwitchList
(){
return
httpClient
.
defaultPost
(
HttpUriContants
.
CENTERSWITCH_GET
,
null
,
BaseResponse
.
class
);
}
@RequestMapping
(
"/todoExe"
)
public
ModelAndView
todoExe
(
String
name
,
String
toCloud
,
Model
model
){
model
.
addAttribute
(
"name"
,
name
);
model
.
addAttribute
(
"toCloud"
,
toCloud
);
return
new
ModelAndView
(
"switch/center_switch_exe"
);
}
@RequestMapping
(
"/doExe"
)
public
BaseResponse
doExe
(
CenterSwitchModel
centerSwitchModel
){
BaseResponse
baseResponse
=
httpClient
.
defaultPost
(
HttpUriContants
.
CENTERSWITCH_SWITCH
,
centerSwitchModel
,
BaseResponse
.
class
);
return
baseResponse
;
}
}
...
...
monitor-ui-web/src/main/webapp/jsp/switch/center_switch.jsp
0 → 100644
View file @
b29404f
<
%@page language="java" contentType="text/html;charset=utf-8" %>
<
%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<
%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/bootstrap.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/bootstrap-datetimepicker.css"
/>
<link
href=
"<%=basePath %>js/bootstrap-plugin/css/bootstrap.table.css"
rel=
"stylesheet"
media=
"screen"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/bootstrap-responsive.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/fullcalendar.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/unicorn.main.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/unicorn.grey.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/jquery-ui.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/uniform.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/select2.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>js/jstree/themes/proton/style.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/select2.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/yoho.css"
/>
<script
src=
"<%=basePath %>js/excanvas.min.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jquery-1.12.0.min.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jquery-ui.custom.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>/js/bootstrap.min.js"
></script>
<script
src=
"<%=basePath %>/js/unicorn.js"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/global.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.table.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.form.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.form.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/layer/layer.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.select.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jstree/jstree.min.js"
></script>
<script
src=
"<%=basePath %>js/jquery.toaster.js"
></script>
<script>
var
contextPath
=
'<%=basePath %>'
;
</script>
<title>
YOHO!运维
</title>
</head>
<body>
<!-- 头部 -->
<div
id=
"head"
>
</div>
<!-- 右侧具体内容 -->
<div
id=
"content"
>
<div
id=
"breadcrumb"
>
<a
href=
"#"
title=
"Go to Home"
class=
"tip-bottom"
><i
class=
"icon-home"
></i>
Home
</a>
<a
href=
"#"
class=
"current"
>
双中心切换
</a>
</div>
<div
class=
"container-fluid"
>
<div
class=
"widget-box"
>
<div
id=
"switchTable"
>
</div>
</div>
</div>
</div>
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js"
></script>
<script
type=
"text/javascript"
>
$
(
"#li_switch"
).
addClass
(
"active open"
);
$
(
"#li_centerswitch"
).
addClass
(
"active"
);
</script>
</body>
</html>
<script>
$
(
function
()
{
//加载表格
$
(
"#switchTable"
).
table
({
columnAutoWidth
:
false
,
url
:
contextPath
+
"centerSwitch/getSwitchList"
,
striped
:
true
,
title
:
"切换列表"
,
loadFilter
:
function
(
data
)
{
return
defaultLoadFilter
(
data
);
},
columns
:
[{
title
:
"切换项"
,
field
:
"cName"
,
width
:
"20%"
},
{
title
:
"切向QQ"
,
field
:
"name"
,
formatter
:
function
(
value
,
rowData
,
rowIndex
)
{
var
div
=
$
(
"<div>"
);
$
(
"<button onclick=\"doExe(\'"
+
value
+
"\',\'qcloud\')\">"
).
addClass
(
"btn btn-primary"
).
html
(
"切换"
).
appendTo
(
div
);
return
div
;
},
width
:
"40%"
},{
title
:
"切回AWS"
,
field
:
"name"
,
formatter
:
function
(
value
,
rowData
,
rowIndex
)
{
var
div
=
$
(
"<div>"
);
$
(
"<button onclick=\"doExe(\'"
+
value
+
"\',\'aws\')\">"
).
addClass
(
"btn btn-primary"
).
html
(
"切换"
).
appendTo
(
div
);
return
div
;
},
width
:
"40%"
}]
});
});
//执行切换
function
doExe
(
name
,
toCloud
)
{
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"切换确定"
,
backdrop
:
"static"
,
content
:
"name:"
+
name
+
" 切向:"
+
toCloud
,
buttons
:
[{
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog
).
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
className
:
"btn-success"
,
onclick
:
function
()
{
$
(
dialog
).
dialog
(
"hide"
);
window
.
open
(
contextPath
+
"centerSwitch/todoExe?name="
+
name
+
"&toCloud="
+
toCloud
,
"_self"
);
}
}]
});
}
</script>
\ No newline at end of file
...
...
monitor-ui-web/src/main/webapp/jsp/switch/center_switch_exe.jsp
0 → 100644
View file @
b29404f
<
%@page language="java" contentType="text/html;charset=utf-8" %>
<
%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<
%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/bootstrap.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/bootstrap-datetimepicker.css"
/>
<link
href=
"<%=basePath %>js/bootstrap-plugin/css/bootstrap.table.css"
rel=
"stylesheet"
media=
"screen"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/bootstrap-responsive.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/fullcalendar.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/unicorn.main.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/unicorn.grey.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/jquery-ui.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/uniform.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/select2.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>js/jstree/themes/proton/style.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/select2.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/yoho.css"
/>
<script
src=
"<%=basePath %>js/excanvas.min.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jquery-1.12.0.min.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jquery-ui.custom.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>/js/bootstrap.min.js"
></script>
<script
src=
"<%=basePath %>/js/unicorn.js"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/global.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.table.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.form.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.form.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/layer/layer.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/bootstrap.select.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jstree/jstree.min.js"
></script>
<script
src=
"<%=basePath %>js/jquery.toaster.js"
></script>
<script>
var
contextPath
=
'<%=basePath %>'
;
</script>
<title>
YOHO!运维
</title>
</head>
<body>
<!-- 头部 -->
<div
id=
"head"
>
</div>
<!-- 右侧具体内容 -->
<div
id=
"content"
>
<div
id=
"breadcrumb"
>
<a
href=
"#"
title=
"Go to Home"
class=
"tip-bottom"
><i
class=
"icon-home"
></i>
Home
</a>
<a
href=
"#"
class=
"current"
>
双中心切换
</a>
</div>
<div
class=
"container-fluid"
>
<div
class=
"widget-box"
>
<div
id=
"switchTable"
>
<textarea
id=
"resultArea"
rows=
"25"
style=
"background-color: black; color: white;width: 100%"
readonly=
"readonly"
>
${message}
</textarea>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
id=
"name"
value=
"${name}"
>
<input
type=
"hidden"
id=
"toCloud"
value=
"${toCloud}"
>
</div>
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js"
></script>
<script
type=
"text/javascript"
>
$
(
"#li_switch"
).
addClass
(
"active open"
);
$
(
"#li_centerswitch"
).
addClass
(
"active"
);
</script>
</body>
</html>
<script>
$
(
function
()
{
var
name
=
$
(
"#name"
).
val
();
var
toCloud
=
$
(
"#toCloud"
).
val
();
var
jq
=
$
(
"#switchTable"
);
$
.
ajax
({
type
:
'post'
,
url
:
contextPath
+
"/centerSwitch/doExe"
,
data
:{
'name'
:
name
,
'toCloud'
:
toCloud
},
dataType
:
'json'
,
beforeSend
:
function
(
XMLHttpRequest
){
var
div
=
$
(
"<div>"
).
attr
(
"tableSelector"
,
jq
.
selector
).
addClass
(
"modal-backdrop fade in"
).
appendTo
(
$
(
"body"
)).
hide
();
var
tableOffset
=
jq
.
offset
();
var
tableWidth
=
jq
.
outerWidth
(
true
),
tableHeight
=
jq
.
outerHeight
(
true
);
div
.
append
(
$
(
"<div>"
).
addClass
(
"table-loading"
).
css
({
left
:
(
tableWidth
-
124
)
/
2
,
top
:
(
tableHeight
-
124
)
/
2
}));
div
.
css
({
width
:
tableWidth
,
height
:
tableHeight
,
left
:
tableOffset
.
left
,
top
:
tableOffset
.
top
});
div
.
show
();
},
success
:
function
(
resp
)
{
$
(
"body"
).
find
(
"div[tableSelector='"
+
jq
.
selector
+
"']"
).
remove
();
$
(
"#resultArea"
).
val
(
resp
.
data
);
},
error
:
function
(
resp
)
{
}
});
});
// document.onkeydown = function()
// {
// if(event.keyCode==116 || event.keyCode==8 || (event.ctrlKey && event.keyCode==82) || event.keyCode == 13) {
// event.keyCode=0;
// event.returnValue = false;
// }
// }
// document.oncontextmenu = function() {event.returnValue = false;}
</script>
\ No newline at end of file
...
...
monitor-ui-web/src/main/webapp/script/common/genarate_left_panel.js
View file @
b29404f
...
...
@@ -68,6 +68,7 @@ innerHTML += "<li id='li_luaswitch'><a id='li_luaswitch_a' href='#'>LUA切换</a
innerHTML
+=
"<li id='li_limitswitch'><a id='li_limitswitch_a' href='#'>限流调整</a></li>"
;
innerHTML
+=
"<li id='li_lbswitch'><a id='li_lbswitch_a' href='#'>直连开关</a></li>"
;
innerHTML
+=
"<li id='li_javarestart'><a id='li_javarestart_a' href='#'>java重启</a></li>"
;
innerHTML
+=
"<li id='li_centerswitch'><a id='li_centerswitch_a' href='#'>双中心切换</a></li>"
;
innerHTML
+=
"</ul></li>"
;
/*manage*/
...
...
@@ -122,6 +123,7 @@ document.getElementById("li_om_new_a").setAttribute("href", path + "/project/toN
document
.
getElementById
(
"li_newRedisMonitor_a"
).
setAttribute
(
"href"
,
path
+
"/redisMonitor/toNewRedis"
);
document
.
getElementById
(
"li_memcachedMonitor_a"
).
setAttribute
(
"href"
,
path
+
"/memcachedMonitor/toMemcached"
);
document
.
getElementById
(
"li_javarestart_a"
).
setAttribute
(
"href"
,
path
+
"/javaRestart/toJavaRestart"
);
document
.
getElementById
(
"li_centerswitch_a"
).
setAttribute
(
"href"
,
path
+
"/centerSwitch/toCenterSwitch"
);
document
.
getElementById
(
"li_ips_compare_a"
).
setAttribute
(
"href"
,
path
+
"/compareIps/toCompareIps"
);
document
.
getElementById
(
"li_limitswitch_a"
).
setAttribute
(
"href"
,
path
+
"/limitSwitch/toLimitSwitch"
);
document
.
getElementById
(
"li_lbswitch_a"
).
setAttribute
(
"href"
,
path
+
"/lbSwitch/toLbSwitch"
);
...
...
Please
register
or
login
to post a comment