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
bblu
8 years ago
Commit
086c9053c31c74df1a180754b80313a8e2f5cc24
1 parent
b8630f20
lua切换前台功能修改
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
36 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/nginx_switch.js
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
View file @
086c905
...
...
@@ -103,6 +103,7 @@ public class HttpUriContants {
* luaswitch
*/
public
static
final
String
VIEW_LUA_CONF
=
"/luaswitch/viewConf"
;
public
static
final
String
VIEW_TOCHANGE_LUA_CONF
=
"/luaswitch/viewToChangeLuaConf"
;
public
static
final
String
SWITCH_LUA
=
"/luaswitch/switchConf"
;
/**
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/LuaSwitchCtrl.java
View file @
086c905
...
...
@@ -46,11 +46,23 @@ public class LuaSwitchCtrl {
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping
(
value
=
"
switch
Conf"
)
@RequestMapping
(
value
=
"
viewToChangeLua
Conf"
)
@ResponseBody
public
BaseResponse
switch
Conf
(
String
cloudName
)
{
public
BaseResponse
viewToChangeLua
Conf
(
String
cloudName
)
{
Map
map
=
new
HashMap
<>();
map
.
put
(
"cloudName"
,
cloudName
);
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_TOCHANGE_LUA_CONF
,
BaseResponse
.
class
,
map
);
}
/**
* 修改配置
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping
(
value
=
"switchConf"
)
@ResponseBody
public
BaseResponse
switchConf
()
{
Map
map
=
new
HashMap
<>();
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
SWITCH_LUA
,
BaseResponse
.
class
,
map
);
}
...
...
monitor-ui-web/src/main/webapp/jsp/switch/luaSwitch.jsp
View file @
086c905
...
...
@@ -28,7 +28,6 @@
<script
src=
"<%=basePath %>js/typeahead-bs2.min.js"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/ace-elements.min.js"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/ace.min.js"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>script/nginx_switch.js"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/layer/layer.js"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>/js/unicorn.js"
type=
"text/javascript"
></script>
<script
src=
"<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js"
charset=
"UTF-8"
...
...
@@ -117,9 +116,10 @@
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js"
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
>
var
dialog1
,
dialog2
;
function
initSwitch
(
cloudName
)
{
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
dialog1
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog1
.
dialog
({
title
:
"你确定切换吗"
,
backdrop
:
"static"
,
content
:
"你确定要将脚本切换至"
+
cloudName
+
"吗?"
,
...
...
@@ -127,7 +127,7 @@
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog
).
dialog
(
"hide"
);
$
(
dialog
1
).
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
...
...
@@ -136,37 +136,57 @@
var
param
=
{
cloudName
:
cloudName
};
$
.
ajax
({
type
:
'post'
,
url
:
'switchConf'
,
data
:
param
,
dataType
:
'text'
,
success
:
function
(
resp
)
{
$
(
dialog
).
dialog
(
"hide"
);
var
data
=
JSON
.
parse
(
resp
);
var
dialog2
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog2
.
dialog
({
title
:
"切换结果"
,
backdrop
:
"static"
,
content
:
data
.
data
,
buttons
:
[{
text
:
"确定"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
window
.
location
.
href
=
contextPath
+
"/luaswitch/toLuaSwitch"
;
}
}]
});
},
error
:
function
()
{
layer
.
msg
(
"异常"
,
{
icon
:
2
});
}
});
sendAjax
(
"post"
,
"viewToChangeLuaConf"
,
param
,
"text"
,
viewToChangeSuccess
,
errorFunc
);
}
}]
});
}
function
viewToChangeSuccess
(
resp
)
{
$
(
dialog1
).
dialog
(
"hide"
);
var
data
=
JSON
.
parse
(
resp
);
dialog2
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog2
.
dialog
({
title
:
"切换结果"
,
backdrop
:
"static"
,
content
:
data
.
data
,
buttons
:
[{
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog2
).
dialog
(
"hide"
);
}
},
{
text
:
"确定"
,
className
:
"btn-success"
,
onclick
:
function
()
{
sendAjax
(
"post"
,
"switchConf"
,
{},
"text"
,
switchSuccess
,
errorFunc
);
}
}]
}).
find
(
".modal-body"
).
css
({
height
:
"550px"
});
}
function
switchSuccess
()
{
window
.
location
.
href
=
contextPath
+
"/luaswitch/toLuaSwitch"
;
}
function
sendAjax
(
type
,
url
,
data
,
dataType
,
success
,
error
)
{
$
.
ajax
({
type
:
type
,
url
:
url
,
data
:
data
,
dataType
:
dataType
,
success
:
success
,
error
:
error
});
}
function
errorFunc
()
{
layer
.
msg
(
"Token异常"
,
{
icon
:
2
});
}
</script>
</body>
</html>
...
...
monitor-ui-web/src/main/webapp/script/nginx_switch.js
View file @
086c905
$
(
function
()
{});
var
dialog1
;
var
dialog2
;
var
dialog3
;
var
dialog1
,
dialog2
,
dialog3
;
function
initSwitch
(
cloudName
,
target
,
onlineOrGray
)
{
var
arr
=
getNoChangeIpArr
(
cloudName
,
onlineOrGray
);
if
(
undefined
===
arr
||
null
===
arr
||
0
===
arr
.
length
)
{
...
...
Please
register
or
login
to post a comment