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
xuhui
8 years ago
Commit
65995abafa2555056d9779d08f9aac8f90dbe5e4
1 parent
791972ac
腾讯云运维系统-nginx切换添加入口切换
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
514 additions
and
32 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-ctrl/src/main/java/com/ui/ctrl/TopoSwitchCtrl.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppLuaSwitchCtrl.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppNginxSwitchCtrl.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppTopoSwitchCtrl.java
monitor-ui-web/src/main/resources/META-INF/spring/spring-web-context.xml
monitor-ui-web/src/main/webapp/jsp/switch/switch_topology.jsp
monitor-ui-web/src/main/webapp/script/switch.js
monitor-ui-common/src/main/java/com/ui/contants/HttpUriContants.java
View file @
65995ab
...
...
@@ -117,6 +117,14 @@ public class HttpUriContants {
public
static
final
String
VIEW_CURRENT_CONF
=
"/luaswitch/viewCurrentConf"
;
/**
* nginx切换
* 之
* dnsswitch
*/
public
static
final
String
NGINX_VIEW_DNS_CONF
=
"/luaswitch/dnsViewConf"
;
public
static
final
String
NGINX_SWITCH_DNS
=
"/luaswitch/dnsSwitchConf"
;
/**
* lbswitch
*/
public
static
final
String
VIEW_LB_CONF
=
"/lbswitch/viewConf"
;
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/LuaSwitchCtrl.java
View file @
65995ab
...
...
@@ -75,7 +75,45 @@ public class LuaSwitchCtrl {
@RequestMapping
(
value
=
"viewCurrentConf"
)
@ResponseBody
public
BaseResponse
viewCurrentConf
()
{
try
{
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_CURRENT_CONF
,
BaseResponse
.
class
,
null
);
}
catch
(
Exception
e
){
logger
.
error
(
" - LuaSwitchCtrl - viewCurrentConf - err "
,
e
);
}
return
null
;
}
/**
* 查看当前流量入口配置
*
* @return BaseResponse
*/
@RequestMapping
(
value
=
"dnsViewCurrentConf"
)
@ResponseBody
public
BaseResponse
dnsViewCurrentConf
(){
try
{
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
NGINX_VIEW_DNS_CONF
,
BaseResponse
.
class
,
null
);
}
catch
(
Exception
e
){
logger
.
error
(
" - LuaSwitchCtrl - viewCurrentConf - err "
,
e
);
}
return
null
;
}
/**
* 当前流量入口切换
*
* @param cloudName toAws toQcloud
* @return BaseResponse
*/
@RequestMapping
(
value
=
"dnsSwitchConf"
)
@ResponseBody
public
BaseResponse
dnsSwitchConf
(
String
cloudName
){
try
{
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
NGINX_SWITCH_DNS
+
"?cloudName="
+
cloudName
,
BaseResponse
.
class
,
null
);
}
catch
(
Exception
e
){
logger
.
error
(
" - LuaSwitchCtrl - viewCurrentConf - err "
,
e
);
}
return
null
;
}
}
\ No newline at end of file
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/TopoSwitchCtrl.java
View file @
65995ab
...
...
@@ -69,7 +69,6 @@ public class TopoSwitchCtrl {
luaType
=
"aws"
;
}
}
//nginx
BaseResponse
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>
response
=
httpRestClient
.
exchangeForget
(
HttpUriContants
.
VIEW_NGINX_CONF
,
new
ParameterizedTypeReference
<
BaseResponse
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>>()
{
},
null
);
...
...
@@ -139,7 +138,6 @@ public class TopoSwitchCtrl {
}
catch
(
Exception
e
){
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - https://dnsapi.cn/Record.Info - err"
,
e
);
}
resultMap
.
put
(
"luaType"
,
luaType
);
resultMap
.
put
(
"awsApiNginx"
,
awsApiNginx
);
resultMap
.
put
(
"awsGrayNginx"
,
awsGrayNginx
);
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppLuaSwitchCtrl.java
0 → 100644
View file @
65995ab
package
com
.
ui
.
ctrl
.
app
;
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.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.Map
;
/**
* 中心入口切换
*
* @author bblu 2016-10-27
*/
@Controller
@RequestMapping
(
"app_luaswitch"
)
public
class
AppLuaSwitchCtrl
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
HttpRestClient
httpRestClient
;
/**
* 展示当前配置
*
* @return ModelAndView
*/
@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
;
}
/**
* 展示修改后配置文件内容
*
* @param cloudName 目标中心名称
* @return BaseResponse
*/
@RequestMapping
(
value
=
"viewToChangeLuaConf"
)
@ResponseBody
public
BaseResponse
viewToChangeLuaConf
(
String
cloudName
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cloudName"
,
cloudName
);
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_TOCHANGE_LUA_CONF
,
BaseResponse
.
class
,
map
);
}
/**
* 切换配置,并重启nginx
*
* @return BaseResponse
*/
@RequestMapping
(
value
=
"switchConf"
)
@ResponseBody
public
BaseResponse
switchConf
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
SWITCH_LUA
,
BaseResponse
.
class
,
map
);
}
/**
* 查看当前配置
*
* @return BaseResponse
*/
@RequestMapping
(
value
=
"viewCurrentConf"
)
@ResponseBody
public
BaseResponse
viewCurrentConf
()
{
try
{
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_CURRENT_CONF
,
BaseResponse
.
class
,
null
);
}
catch
(
Exception
e
){
logger
.
error
(
" - LuaSwitchCtrl - viewCurrentConf - err "
,
e
);
}
return
null
;
}
/**
* 查看当前流量入口配置
*
* @return BaseResponse
*/
@RequestMapping
(
value
=
"dnsViewCurrentConf"
)
@ResponseBody
public
BaseResponse
dnsViewCurrentConf
(){
try
{
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
NGINX_VIEW_DNS_CONF
,
BaseResponse
.
class
,
null
);
}
catch
(
Exception
e
){
logger
.
error
(
" - LuaSwitchCtrl - viewCurrentConf - err "
,
e
);
}
return
null
;
}
/**
* 当前流量入口切换
*
* @param cloudName toAws toQcloud
* @return BaseResponse
*/
@RequestMapping
(
value
=
"dnsSwitchConf"
)
@ResponseBody
public
BaseResponse
dnsSwitchConf
(
String
cloudName
){
try
{
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
NGINX_SWITCH_DNS
+
"?cloudName="
+
cloudName
,
BaseResponse
.
class
,
null
);
}
catch
(
Exception
e
){
logger
.
error
(
" - LuaSwitchCtrl - viewCurrentConf - err "
,
e
);
}
return
null
;
}
}
\ No newline at end of file
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppNginxSwitchCtrl.java
0 → 100644
View file @
65995ab
package
com
.
ui
.
ctrl
.
app
;
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
;
/**
* nginx->gateway切换
*
* @author bblu 2016-10-27
*/
@Controller
@RequestMapping
(
"app_nginxswitch"
)
public
class
AppNginxSwitchCtrl
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
HttpRestClient
httpRestClient
;
/**
* 展示当前配置
*
* @return ModelAndView
*/
@RequestMapping
(
value
=
"toNginxSwitch"
)
public
ModelAndView
viewNginxConf
()
{
BaseResponse
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>
response
=
httpRestClient
.
exchangeForget
(
HttpUriContants
.
VIEW_NGINX_CONF
,
new
ParameterizedTypeReference
<
BaseResponse
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>>()
{
},
null
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
map
=
response
.
getData
();
ModelAndView
mdv
=
new
ModelAndView
(
"switch/nginxSwitch"
);
mdv
.
addObject
(
"awsList"
,
map
.
get
(
"awsList"
));
mdv
.
addObject
(
"qcloudList"
,
map
.
get
(
"qcloudList"
));
return
mdv
;
}
/**
* 修改配置,并重启nginx
*
* @param cloudName 源中心名称
* @return BaseResponse
*/
@RequestMapping
(
value
=
"switchNginxConf"
)
@ResponseBody
public
BaseResponse
switchNginxConf
(
String
cloudName
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"cloudName"
,
cloudName
);
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
SWITCH_NGINX
,
BaseResponse
.
class
,
map
);
}
/**
* 展示修改后配置文件内容
*
* @param cloudName 源中心名称
* @param target 目标中心名称
* @param onlineOrGray 线上/灰度切换
* @param noChangeIps 不变更配置的ip
* @return BaseResponse
*/
@RequestMapping
(
value
=
"viewToChangeNginxConf"
)
@ResponseBody
public
BaseResponse
viewToChangeNginxConf
(
String
cloudName
,
String
target
,
String
onlineOrGray
,
String
noChangeIps
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"cloudName"
,
cloudName
);
map
.
put
(
"target"
,
target
);
map
.
put
(
"onlineOrGray"
,
onlineOrGray
);
map
.
put
(
"ips"
,
noChangeIps
);
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_TOCHANGE_NGINX_CONF
,
BaseResponse
.
class
,
map
);
}
/**
* 查看 当前配置
*
*/
@RequestMapping
(
value
=
"viewCurrentConf"
)
@ResponseBody
public
BaseResponse
viewCurrentConf
(
String
cloudName
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"cloudName"
,
cloudName
);
return
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_NGINX_CURRENT_CONF
,
BaseResponse
.
class
,
map
);
}
}
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppTopoSwitchCtrl.java
0 → 100644
View file @
65995ab
package
com
.
ui
.
ctrl
.
app
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
import
org.apache.commons.lang.StringUtils
;
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.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
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 bblu 2016-10-26
*/
@Controller
@RequestMapping
(
"app_topoSwitch"
)
public
class
AppTopoSwitchCtrl
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
HttpRestClient
httpRestClient
;
@RequestMapping
(
value
=
"toAppTopoSwitch"
)
public
ModelAndView
toAppTopoSwitch
()
{
ModelAndView
mdv
=
new
ModelAndView
(
"switch/switch_topology_app"
);
return
mdv
;
}
/**
* 展示当前配置
*
* @return ModelAndView
*/
@RequestMapping
(
value
=
"getNgixnStatus"
)
@ResponseBody
public
BaseResponse
getNgixnStatus
()
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
try
{
//lua
String
luaResponse
=
httpRestClient
.
defaultGet
(
HttpUriContants
.
VIEW_LUA_CONF
,
String
.
class
,
null
);
String
luaType
=
""
;
if
(
StringUtils
.
isNotBlank
(
luaResponse
)){
if
(
luaResponse
.
matches
(
".*context.cloud_flag\\s*=\\s*2.*"
))
{
luaType
=
"qq"
;
}
else
if
(
luaResponse
.
matches
(
".*context.cloud_flag\\s*=\\s*3.*"
))
{
luaType
=
"aws+qq"
;
}
else
{
luaType
=
"aws"
;
}
}
logger
.
info
(
"getNgixnStatus 1..."
);
//nginx
BaseResponse
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>
response
=
httpRestClient
.
exchangeForget
(
HttpUriContants
.
VIEW_NGINX_CONF
,
new
ParameterizedTypeReference
<
BaseResponse
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>>()
{
},
null
);
logger
.
info
(
"getNgixnStatus 2..."
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
map
=
response
.
getData
();
List
<
Map
<
String
,
Object
>>
awsList
=
map
.
get
(
"awsList"
);
List
<
Map
<
String
,
Object
>>
qcloudList
=
map
.
get
(
"qcloudList"
);
String
awsApiNginx
=
"aws"
;
String
awsGrayNginx
=
"aws"
;
String
qqApiNginx
=
"qq"
;
String
qqGrayNginx
=
"qq"
;
for
(
Map
<
String
,
Object
>
apiMap
:
awsList
)
{
if
(
StringUtils
.
equals
(
"apigateway"
,
String
.
valueOf
(
apiMap
.
get
(
"name"
))))
{
List
<
String
>
serverList
=
(
List
<
String
>)
apiMap
.
get
(
"server"
);
if
(
serverList
.
get
(
0
).
startsWith
(
"10"
))
{
awsApiNginx
=
"qq"
;
}
}
if
(
StringUtils
.
equals
(
"grayapigateway"
,
String
.
valueOf
(
apiMap
.
get
(
"name"
))))
{
List
<
String
>
serverList
=
(
List
<
String
>)
apiMap
.
get
(
"server"
);
if
(
serverList
.
get
(
0
).
startsWith
(
"10"
))
{
awsGrayNginx
=
"qq"
;
}
}
}
for
(
Map
<
String
,
Object
>
apiMap
:
qcloudList
)
{
if
(
StringUtils
.
equals
(
"apigateway"
,
String
.
valueOf
(
apiMap
.
get
(
"name"
))))
{
List
<
String
>
serverList
=
(
List
<
String
>)
apiMap
.
get
(
"server"
);
if
(
serverList
.
get
(
0
).
startsWith
(
"172"
))
{
qqApiNginx
=
"aws"
;
}
}
if
(
StringUtils
.
equals
(
"grayapigateway"
,
String
.
valueOf
(
apiMap
.
get
(
"name"
))))
{
List
<
String
>
serverList
=
(
List
<
String
>)
apiMap
.
get
(
"server"
);
if
(
serverList
.
get
(
0
).
startsWith
(
"172"
))
{
qqApiNginx
=
"aws"
;
}
}
}
//dns
String
defaultDns
=
""
;
MultiValueMap
<
String
,
String
>
requestEntity
=
new
LinkedMultiValueMap
<>();
requestEntity
.
add
(
"login_token"
,
"31578,5f5402160468dc375159e2e94eeef1da"
);
requestEntity
.
add
(
"format"
,
"json"
);
requestEntity
.
add
(
"domain_id"
,
"16862974"
);
requestEntity
.
add
(
"record_id"
,
"293178513"
);
try
{
String
requestResponse
=
httpRestClient
.
post
(
"https://dnsapi.cn/Record.Info"
,
requestEntity
,
String
.
class
);
JSONObject
responseJSON
=
JSONObject
.
parseObject
(
requestResponse
);
JSONObject
responseStatus
=
JSONObject
.
parseObject
(
responseJSON
.
getString
(
"status"
));
if
(
"1"
.
equals
(
responseStatus
.
getString
(
"code"
))){
if
(
requestResponse
.
indexOf
(
"amazonaws"
)
==
-
1
){
defaultDns
=
"qq"
;
}
else
{
defaultDns
=
"aws"
;
}
}
else
{
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - JSON - err:"
+
responseJSON
.
getString
(
"message"
));
}
}
catch
(
Exception
e
){
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - https://dnsapi.cn/Record.Info - err"
,
e
);
}
logger
.
info
(
"getNgixnStatus 3..."
);
resultMap
.
put
(
"luaType"
,
luaType
);
resultMap
.
put
(
"awsApiNginx"
,
awsApiNginx
);
resultMap
.
put
(
"awsGrayNginx"
,
awsGrayNginx
);
resultMap
.
put
(
"qqApiNginx"
,
qqApiNginx
);
resultMap
.
put
(
"qqGrayNginx"
,
qqGrayNginx
);
resultMap
.
put
(
"defaultDns"
,
defaultDns
);
}
catch
(
Exception
e
){
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - err"
,
e
);
}
return
new
BaseResponse
(
resultMap
);
}
}
\ No newline at end of file
...
...
monitor-ui-web/src/main/resources/META-INF/spring/spring-web-context.xml
View file @
65995ab
...
...
@@ -86,9 +86,6 @@
<mvc:exclude-mapping
path=
"/systemTest/**"
/>
<mvc:exclude-mapping
path=
"/recvMonitAlarm"
/>
<mvc:exclude-mapping
path=
"/awsapi/sns"
/>
<mvc:exclude-mapping
path=
"/luaswitch/**"
/>
<mvc:exclude-mapping
path=
"/nginxswitch/**"
/>
<mvc:exclude-mapping
path=
"/topoSwitch/**"
/>
<mvc:exclude-mapping
path=
"/testcommon/testUpLoadData"
/>
<bean
class=
"com.ui.interceptor.AuthInterceptor"
/>
</mvc:interceptor>
...
...
monitor-ui-web/src/main/webapp/jsp/switch/switch_topology.jsp
View file @
65995ab
...
...
@@ -78,6 +78,21 @@
<div
class=
"tree_container"
style=
"height: 540px;color: black;overflow:auto;"
>
<div
class=
"panel panel-default"
>
<div
class=
"widget-title"
style=
"height: 50px;"
>
<h5
style=
"display: inline"
>
入口切换
</h5>
</div>
<div
class=
"panel-body"
>
<button
class=
"btn btn-sm btn-primary"
onclick=
"dnsViewConf()"
>
<em
class=
"icon-cogs bigger-110"
></em>
查看当前入口配置
</button>
<h3
class=
"header smaller red"
></h3>
<div
id=
"dns-div"
class=
"btn-group"
>
</div>
</div>
<div
class=
"widget-title"
style=
"height: 50px;"
>
<h5
style=
"display: inline"
>
直连切换
</h5>
</div>
<div
class=
"panel-body"
>
...
...
monitor-ui-web/src/main/webapp/script/switch.js
View file @
65995ab
...
...
@@ -116,6 +116,8 @@ function drawData(resp) {
//创建lua切换按钮
createLuaSwitchButton
(
data
.
luaType
);
//创建入口切换按钮
createDnsSwitchButton
(
data
.
luaType
);
}
/**
...
...
@@ -165,6 +167,7 @@ function luaInitSwitch(cloudName) {
};
sendAjax
(
"post"
,
getUrlBasePath
()
+
"/luaswitch/viewToChangeLuaConf"
,
param
,
"text"
,
luaViewToChangeSuccess
,
errorFunc
);
dialog
.
dialog
(
"hide"
);
toWait
();
}
}]
});
...
...
@@ -204,6 +207,86 @@ function luaViewToChangeSuccess(resp) {
}
/**
* 创建Dns切换按钮
* @param luaType
*/
function
createDnsSwitchButton
(
luaType
){
if
(
luaType
==
""
){
return
;
}
var
awsButton
=
"<button class=\"btn btn-sm btn-success\" onclick=\"dnsSwitch(\'toAws\')\"> <em class=\"icon-cogs bigger-110\"></em>切向aws</button>"
;
var
qqButton
=
"<button class=\"btn btn-sm btn-success\" onclick=\"dnsSwitch(\'toQcloud\')\"> <em class=\"icon-cogs bigger-110\"></em>切向qcloud</button>"
;
var
mixButton
=
"<button class=\"btn btn-sm btn-success\" onclick=\"dnsSwitch(\'mix\')\"> <em class=\"icon-cogs bigger-110\"></em>切向双云</button>"
;
if
(
luaType
==
'aws'
){
$
(
"#dns-div"
).
html
(
qqButton
+
mixButton
);
}
else
if
(
luaType
==
'qq'
){
$
(
"#dns-div"
).
html
(
awsButton
+
mixButton
);
}
else
{
$
(
"#dns-div"
).
html
(
awsButton
+
qqButton
);
}
}
/**
* 直接切换,由于调用的是api
* @param cloud
*/
function
dnsSwitch
(
cloud
){
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"你确定切换吗"
,
backdrop
:
"static"
,
content
:
"由于切换dns是调用的dnspod提供的api,因此当点击确定就直接切换!!!!!!"
,
buttons
:
[{
text
:
"否"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
dialog
.
dialog
(
"hide"
);
}
},
{
text
:
"是"
,
className
:
"btn-success"
,
onclick
:
function
()
{
sendAjax
(
"post"
,
getUrlBasePath
()
+
"/luaswitch/dnsSwitchConf?cloudName="
+
cloud
,
{},
"text"
,
switchSuccess
,
errorFunc
);
dialog
.
dialog
(
"hide"
);
toWait
();
}
}]
});
}
/**
* 查看当前入口配置
*/
function
dnsViewConf
(){
sendAjax
(
"post"
,
getUrlBasePath
()
+
"/luaswitch/dnsViewCurrentConf"
,
{},
"text"
,
dnsViewCurrentConf
,
errorFunc
);
}
/**
* 打开对话框,查看当前dns配置
* @param resp 当前响应数据
*/
function
dnsViewCurrentConf
(
resp
)
{
var
data
=
JSON
.
parse
(
resp
);
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
"当前配置"
,
backdrop
:
"static"
,
content
:
"<pre style='width:568px'>"
+
data
.
data
+
"</pre>"
,
buttons
:
[{
text
:
"确定"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
dialog
.
dialog
(
"hide"
);
}
}]
}).
find
(
".modal-body"
).
css
({
height
:
"280px"
,
width
:
"600px"
});
}
/**
* 查看当前lua配置
*/
function
luaViewConf
(){
...
...
@@ -401,33 +484,6 @@ function toWait() {
});
}
// 节点
function
newNode
(
scene
,
x
,
y
,
w
,
h
,
text
)
{
var
node
=
new
JTopo
.
Node
(
text
);
...
...
Please
register
or
login
to post a comment