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
zhengyouwei
9 years ago
Commit
3bb458f22951f881ef0df9eb90ccecec2c930048
1 parent
75b232b4
lua
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
226 additions
and
2 deletions
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/LuaSwitchCtrl.java
monitor-ui-web/src/main/webapp/jsp/switch/luaSwitch.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 @
3bb458f
...
...
@@ -97,9 +97,13 @@ public class HttpUriContants {
* nginxswitch
*/
public
static
final
String
VIEW_NGINX_CONF
=
"/nginxswitch/viewNginxConf"
;
public
static
final
String
SWITCH_BEFORE
=
"/nginxswitch/switchbefore"
;
public
static
final
String
SWITCH_NGINX
=
"/nginxswitch/switchNginxConf"
;
/**
* luaswitch
*/
public
static
final
String
VIEW_LUA_CONF
=
"/luaswitch/viewConf"
;
public
static
final
String
SWITCH_LUA
=
"/luaswitch/switchConf"
;
/**
* dnspod
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/LuaSwitchCtrl.java
0 → 100644
View file @
3bb458f
package
com
.
ui
.
ctrl
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.ParameterizedTypeReference
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author zhengyouwei 2016年5月12日 下午1:49:55
*/
@Controller
@RequestMapping
(
"luaswitch"
)
public
class
LuaSwitchCtrl
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
HttpRestClient
httpRestClient
;
/**
* 查看nginx配置
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping
(
value
=
"toLuaSwitch"
)
public
ModelAndView
viewNginxConf
()
{
String
response
=
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_LUA_CONF
,
String
.
class
,
null
);
ModelAndView
mdv
=
new
ModelAndView
(
"switch/luaSwitch"
);
mdv
.
addObject
(
"conf"
,
response
);
return
mdv
;
}
/**
* 修改配置
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping
(
value
=
"switchConf"
)
@ResponseBody
public
BaseResponse
switchConf
(
String
cloudName
)
{
Map
map
=
new
HashMap
<>();
map
.
put
(
"cloudName"
,
cloudName
);
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
SWITCH_LUA
,
BaseResponse
.
class
,
map
);
}
}
...
...
monitor-ui-web/src/main/webapp/jsp/switch/luaSwitch.jsp
0 → 100644
View file @
3bb458f
<
%@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/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/bootstrap-responsive.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/uniform.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/select2.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/font-awesome.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/dnspod_switch.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/ace.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/ace-rtl.min.css"
/>
<link
rel=
"stylesheet"
href=
"<%=basePath %>css/ace-skins.min.css"
/>
<script
src=
"<%=basePath %>js/jquery-2.1.4.min.js"
></script>
<script
src=
"<%=basePath %>js/bootstrap.min.js"
></script>
<script
src=
"<%=basePath %>js/typeahead-bs2.min.js"
></script>
<script
src=
"<%=basePath %>js/ace-elements.min.js"
></script>
<script
src=
"<%=basePath %>js/ace.min.js"
></script>
<script
src=
"<%=basePath %>script/nginx_switch.js"
></script>
<script
src=
"<%=basePath %>js/layer/layer.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/bootstrap-plugin/bootstrap.select.js"
charset=
"UTF-8"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/jquery.toaster.js"
></script>
<script>
var
contextPath
=
'<%=basePath %>'
;
</script>
<title>
YOHO!运维
</title>
</head>
<body
style=
"background-color: #444444;font-size: 14px"
>
<!-- 头部 -->
<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"
>
lua切换
</a>
</div>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<!-- PAGE CONTENT BEGINS -->
<div
class=
"row"
>
<div
class=
"col-xs-12 col-sm-12 widget-container-span"
>
<div
class=
"tabbable"
>
<div
class=
"tab-content"
>
<div
id=
"home"
>
<div
style=
"padding:50px 200px"
>
<
${conf}
</div>
<h3
class=
"header smaller red"
></h3>
<div
class=
"btn-group"
style=
"padding:5px 20px"
>
<button
class=
"btn btn-sm btn-success"
onclick=
"initSwitch('aws')"
>
<i
class=
"icon-cogs bigger-110"
></i>
aws切换
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"initSwitch('qcloud')"
>
<i
class=
"icon-cogs bigger-110"
></i>
qq切换
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"initSwitch('mix')"
>
<i
class=
"icon-cogs bigger-110"
></i>
混合切换
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /span -->
<div
class=
"vspace-xs-6"
></div>
</div>
<!-- /row -->
<script
type=
"text/javascript"
>
var
$path_assets
=
"assets"
;
//this will be used in gritter alerts containing images
</script>
<!-- PAGE CONTENT ENDS -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js"
></script>
<script>
$
(
"#li_switch"
).
addClass
(
"active open"
);
$
(
"#li_luaswitch"
).
addClass
(
"active"
);
function
initSwitch
(
cloudName
)
{
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"你确定切换吗"
,
backdrop
:
"static"
,
content
:
"你确定要将脚本切换至"
+
cloudName
+
"吗?"
,
buttons
:
[{
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog
).
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
className
:
"btn-success"
,
onclick
:
function
()
{
var
param
=
{
cloudName
:
cloudName
,
}
$
.
ajax
({
type
:
'post'
,
url
:
'switchConf'
,
data
:
param
,
dataType
:
'text'
,
success
:
function
(
resp
)
{
window
.
location
.
href
=
contextPath
+
"/luaswitch/toLuaSwitch"
;
},
error
:
function
(
data
)
{
layer
.
msg
(
"异常"
,
{
icon
:
2
});
}
});
}
}]
});
}
</script>
</body>
</html>
...
...
monitor-ui-web/src/main/webapp/script/common/genarate_left_panel.js
View file @
3bb458f
...
...
@@ -37,7 +37,7 @@ innerHTML += "</ul></li>";
/*switch*/
innerHTML
+=
"<li class='submenu' id='li_switch'><a id='li_switch_a' href='#'><i class='icon icon-th-list'></i> <span>关键切换</span><span class='label'>2</span></a>"
;
innerHTML
+=
"<ul><li id='li_nginxswitch'><a id='li_nginxswitch_a' href=''>nginx切换</a></li>"
;
innerHTML
+=
"<li id='li_
dnsswitch'><a id='li_dnsswitch_a' href='#'>DNS
切换</a></li>"
;
innerHTML
+=
"<li id='li_
luaswitch'><a id='li_luaswitch_a' href='#'>LUA
切换</a></li>"
;
innerHTML
+=
"</ul></li>"
;
/*manage*/
...
...
@@ -72,6 +72,7 @@ document.getElementById("li_zkMonitor_a").setAttribute("href", path + "/zkTree/t
document
.
getElementById
(
"li_user_a"
).
setAttribute
(
"href"
,
path
+
"/manage/toUser"
);
document
.
getElementById
(
"li_module_a"
).
setAttribute
(
"href"
,
path
+
"/manage/toModule"
);
document
.
getElementById
(
"li_nginxswitch_a"
).
setAttribute
(
"href"
,
path
+
"/nginxswitch/toNginxSwitch"
);
document
.
getElementById
(
"li_luaswitch_a"
).
setAttribute
(
"href"
,
path
+
"/luaswitch/toLuaSwitch"
);
document
.
getElementById
(
"li_projectHistory_a"
).
setAttribute
(
"href"
,
path
+
"/project/toHistory"
);
document
.
getElementById
(
"a_hystrix_aws"
).
setAttribute
(
"href"
,
path
+
"/hystrix/aws"
);
document
.
getElementById
(
"a_hystrix_qcloud"
).
setAttribute
(
"href"
,
path
+
"/hystrix/qcloud"
);
...
...
Please
register
or
login
to post a comment