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
qinchao
7 years ago
Commit
773208ab52fa7903c04b1154880588a03bdb3877
1 parent
598c6448
nginx切换
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
164 additions
and
303 deletions
monitor-ui-ctrl/src/main/java/com/ui/ctrl/TopoSwitchCtrl.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/TopoSwitchUtil.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppTopoSwitchCtrl.java
monitor-ui-web/src/main/webapp/jsp/switch/switch_topology.jsp
monitor-ui-web/src/main/webapp/script/switch.js
monitor-ui-ctrl/src/main/java/com/ui/ctrl/TopoSwitchCtrl.java
View file @
773208a
package
com
.
ui
.
ctrl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ui.cloud.model.Host
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
...
...
@@ -11,13 +9,10 @@ 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.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -36,6 +31,9 @@ public class TopoSwitchCtrl {
@Autowired
HttpRestClient
httpRestClient
;
@Autowired
TopoSwitchUtil
topoSwitchUtil
;
@RequestMapping
(
value
=
"toTopoSwitch"
)
public
ModelAndView
toTopoSwitch
()
{
ModelAndView
mdv
=
new
ModelAndView
(
"switch/switch_topology"
);
...
...
@@ -59,100 +57,32 @@ public class TopoSwitchCtrl {
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"
;
}
}
//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
);
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"
);
List
<
String
>
grayHostIps
=(
List
<
String
>)(
map
.
get
(
"grayServerHosts"
).
get
(
0
).
get
(
"grayServerHosts"
));
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"
);
logger
.
error
(
"awsgrayapigateway is === "
+
serverList
.
get
(
0
));
boolean
grayFlag
=
false
;
for
(
String
grayIp:
grayHostIps
){
if
(
serverList
.
get
(
0
).
startsWith
(
grayIp
)){
grayFlag
=
true
;
break
;
}
}
if
(
grayFlag
){
awsGrayNginx
=
"gray"
;
}
else
{
if
(
serverList
.
get
(
0
).
startsWith
(
"10"
))
{
awsGrayNginx
=
"qq"
;
}
else
{
awsGrayNginx
=
"aws"
;
}
}
}
}
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"
);
logger
.
error
(
"qqgrayapigateway is === "
+
serverList
.
get
(
0
));
boolean
grayFlag
=
false
;
for
(
String
grayIp:
grayHostIps
){
if
(
serverList
.
get
(
0
).
startsWith
(
grayIp
)){
grayFlag
=
true
;
break
;
}
}
if
(
grayFlag
){
qqGrayNginx
=
"gray"
;
}
else
{
if
(
serverList
.
get
(
0
).
startsWith
(
"10"
))
{
qqGrayNginx
=
"qq"
;
}
else
{
qqGrayNginx
=
"aws"
;
}
}
}
}
//dns
String
defaultDns
=
httpRestClient
.
defaultGet
(
HttpUriContants
.
CENTERSWITCH_DEFAULT_DNS
,
String
.
class
);
resultMap
.
put
(
"luaType"
,
luaType
);
resultMap
.
put
(
"awsApiNginx"
,
awsApiNginx
);
resultMap
.
put
(
"awsGrayNginx"
,
awsGrayNginx
);
List
<
Map
<
String
,
Object
>>
qcloudaz2List
=
map
.
get
(
"qcloudaz2List"
);
List
<
String
>
az1HostIps
=(
List
<
String
>)(
map
.
get
(
"gatewayServerHosts"
).
get
(
0
).
get
(
"az1ServerHosts"
));
List
<
String
>
az2HostIps
=(
List
<
String
>)(
map
.
get
(
"gatewayServerHosts"
).
get
(
0
).
get
(
"az2ServerHosts"
));
List
<
String
>
grayHostIps
=(
List
<
String
>)(
map
.
get
(
"gatewayServerHosts"
).
get
(
0
).
get
(
"grayServerHosts"
));
List
<
String
>
ls
=
topoSwitchUtil
.
getNginxLocationType
(
az1HostIps
,
az2HostIps
,
grayHostIps
,
qcloudList
);
String
qqApiNginx
=
ls
.
get
(
0
);
String
qqGrayNginx
=
ls
.
get
(
1
);
ls
=
topoSwitchUtil
.
getNginxLocationType
(
az1HostIps
,
az2HostIps
,
grayHostIps
,
qcloudaz2List
);
String
az2ApiNginx
=
ls
.
get
(
0
);
String
az2GrayNginx
=
ls
.
get
(
1
);
resultMap
.
put
(
"az2ApiNginx"
,
az2ApiNginx
);
resultMap
.
put
(
"az2GrayNginx"
,
az2GrayNginx
);
resultMap
.
put
(
"qqApiNginx"
,
qqApiNginx
);
resultMap
.
put
(
"qqGrayNginx"
,
qqGrayNginx
);
resultMap
.
put
(
"defaultDns"
,
defaultDns
);
resultMap
.
put
(
"defaultDns"
,
httpRestClient
.
defaultGet
(
HttpUriContants
.
CENTERSWITCH_DEFAULT_DNS
,
String
.
class
));
resultMap
.
put
(
"luaType"
,
topoSwitchUtil
.
getLuaType
());
}
catch
(
Exception
e
){
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - err"
,
e
);
}
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/TopoSwitchUtil.java
0 → 100644
View file @
773208a
package
com
.
ui
.
ctrl
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.http.HttpRestClient
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
TopoSwitchUtil
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
HttpRestClient
httpRestClient
;
public
String
getLuaType
(){
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"
;
}
}
return
luaType
;
}
public
List
<
String
>
getNginxLocationType
(
List
<
String
>
az1HostIps
,
List
<
String
>
az2HostIps
,
List
<
String
>
grayHostIps
,
List
<
Map
<
String
,
Object
>>
qcloudList
){
List
<
String
>
ls
=
new
ArrayList
<>();
String
qqApiNginx
=
""
;
String
qqGrayNginx
=
""
;
for
(
Map
<
String
,
Object
>
apiMap
:
qcloudList
)
{
if
(
StringUtils
.
equals
(
"apigateway"
,
String
.
valueOf
(
apiMap
.
get
(
"name"
))))
{
List
<
String
>
serverList
=
(
List
<
String
>)
apiMap
.
get
(
"server"
);
if
(
az1HostIps
.
contains
(
serverList
.
get
(
0
))){
qqApiNginx
=
"qq"
;
}
else
if
(
az2HostIps
.
contains
(
serverList
.
get
(
0
))){
qqApiNginx
=
"az2"
;
}
}
if
(
StringUtils
.
equals
(
"grayapigateway"
,
String
.
valueOf
(
apiMap
.
get
(
"name"
))))
{
List
<
String
>
serverList
=
(
List
<
String
>)
apiMap
.
get
(
"server"
);
logger
.
error
(
"qqgrayapigateway is === "
+
serverList
.
get
(
0
));
boolean
grayFlag
=
false
;
for
(
String
grayIp:
grayHostIps
){
if
(
serverList
.
get
(
0
).
startsWith
(
grayIp
)){
grayFlag
=
true
;
break
;
}
}
if
(
grayFlag
){
qqGrayNginx
=
"gray"
;
}
else
{
if
(
az1HostIps
.
contains
(
serverList
.
get
(
0
))){
qqGrayNginx
=
"qq"
;
}
else
if
(
az2HostIps
.
contains
(
serverList
.
get
(
0
))){
qqApiNginx
=
"az2"
;
}
}
}
}
ls
.
add
(
qqApiNginx
);
ls
.
add
(
qqGrayNginx
);
return
ls
;
}
}
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/app/AppTopoSwitchCtrl.java
View file @
773208a
...
...
@@ -2,6 +2,7 @@ package com.ui.ctrl.app;
import
com.alibaba.fastjson.JSONObject
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.ctrl.TopoSwitchUtil
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -34,6 +35,9 @@ public class AppTopoSwitchCtrl {
@Autowired
HttpRestClient
httpRestClient
;
@Autowired
TopoSwitchUtil
topoSwitchUtil
;
@RequestMapping
(
value
=
"toAppTopoSwitch"
)
public
ModelAndView
toAppTopoSwitch
()
{
ModelAndView
mdv
=
new
ModelAndView
(
"switch/switch_topology_app"
);
...
...
@@ -51,19 +55,6 @@ public class AppTopoSwitchCtrl {
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
...
...
@@ -113,17 +104,12 @@ public class AppTopoSwitchCtrl {
}
}
//dns
String
defaultDns
=
httpRestClient
.
defaultGet
(
HttpUriContants
.
CENTERSWITCH_DEFAULT_DNS
,
String
.
class
);
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
);
resultMap
.
put
(
"defaultDns"
,
httpRestClient
.
defaultGet
(
HttpUriContants
.
CENTERSWITCH_DEFAULT_DNS
,
String
.
class
));
resultMap
.
put
(
"luaType"
,
topoSwitchUtil
.
getLuaType
());
}
catch
(
Exception
e
){
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - err"
,
e
);
}
...
...
monitor-ui-web/src/main/webapp/jsp/switch/switch_topology.jsp
View file @
773208a
...
...
@@ -122,12 +122,6 @@
<div
class=
"col-xs-12 col-sm-12 widget-container-span"
>
<div
class=
"tabbable"
>
<ul
class=
"nav nav-tabs"
id=
"myTab"
>
<li
class=
"active"
style=
"width: 110px"
>
<a
data-toggle=
"tab"
href=
"#home"
>
<em
class=
"green icon-cloud bigger-110"
></em>
aws
</a>
</li>
<li
style=
"width: 110px"
>
<a
data-toggle=
"tab"
href=
"#profile"
>
...
...
@@ -135,12 +129,20 @@
qq
</a>
</li>
<li
class=
"active"
style=
"width: 110px"
>
<a
data-toggle=
"tab"
href=
"#home"
>
<em
class=
"green icon-cloud bigger-110"
></em>
az2
</a>
</li>
</ul>
<div
class=
"tab-content"
>
<div
id=
"
home"
class=
"tab-pane in activ
e"
>
<div
id=
"
profile"
class=
"tab-pan
e"
>
<button
class=
"btn btn-sm btn-primary"
onclick=
"nginxViewConf('
aws
')"
>
onclick=
"nginxViewConf('
qcloud
')"
>
<em
class=
"icon-cogs bigger-110"
></em>
查看当前配置
</button>
...
...
@@ -151,40 +153,42 @@
线上切换
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('
aws
','qcloud','online')"
>
onclick=
"nginxInitSwitch('
qcloud
','qcloud','online')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向qcloud
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('
aws','aws
','online')"
>
onclick=
"nginxInitSwitch('
qcloud','qcloudaz2
','online')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向a
ws
切向a
z2
</button>
<br
><br
>
<br
/><br/
>
<button
class=
"btn btn-sm "
disabled=
"disabled"
>
灰度切换
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('
aws
','qcloud','gray')"
>
onclick=
"nginxInitSwitch('
qcloud
','qcloud','gray')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向qcloud
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('
aws','aws
','gray')"
>
onclick=
"nginxInitSwitch('
qcloud','qcloudaz2
','gray')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向a
ws
切向a
z2
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('
aws
','gray','gray')"
>
onclick=
"nginxInitSwitch('
qcloud
','gray','gray')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向gray
</button>
</div>
</div>
<div
id=
"
profile"
class=
"tab-pan
e"
>
<div
id=
"
home"
class=
"tab-pane in activ
e"
>
<button
class=
"btn btn-sm btn-primary"
onclick=
"nginxViewConf('qcloud')"
>
onclick=
"nginxViewConf('qcloud
az2
')"
>
<em
class=
"icon-cogs bigger-110"
></em>
查看当前配置
</button>
...
...
@@ -195,36 +199,34 @@
线上切换
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('qcloud','qcloud','online')"
>
onclick=
"nginxInitSwitch('qcloud
az2
','qcloud','online')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向qcloud
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('qcloud
','aws
','online')"
>
onclick=
"nginxInitSwitch('qcloud
az2','qcloudaz2
','online')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向a
ws
切向a
z2
</button>
<br
/><br/
>
<br
><br
>
<button
class=
"btn btn-sm "
disabled=
"disabled"
>
灰度切换
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('qcloud','qcloud','gray')"
>
onclick=
"nginxInitSwitch('qcloud
az2
','qcloud','gray')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向qcloud
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('qcloud
','aws
','gray')"
>
onclick=
"nginxInitSwitch('qcloud
az2','qcloudaz2
','gray')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向a
ws
切向a
z2
</button>
<button
class=
"btn btn-sm btn-success"
onclick=
"nginxInitSwitch('qcloud','gray','gray')"
>
onclick=
"nginxInitSwitch('qcloud
az2
','gray','gray')"
>
<em
class=
"icon-cogs bigger-110"
></em>
切向gray
</button>
</div>
</div>
</div>
...
...
@@ -251,7 +253,7 @@
</div>
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"
></script>
<script
src=
"<%=basePath %>script/switch.js?v=201
71103-50
"
></script>
<script
src=
"<%=basePath %>script/switch.js?v=201
80511
"
></script>
<script
type=
"text/javascript"
>
$
(
"#li_switch"
).
addClass
(
"active open"
);
...
...
monitor-ui-web/src/main/webapp/script/switch.js
View file @
773208a
...
...
@@ -23,23 +23,13 @@ function drawData(resp) {
var
appNodeH
=
26
;
var
appNode
=
newNode
(
scene
,
appNodeX
,
appNodeY
,
appNodeW
,
appNodeH
,
'APP'
);
//定义container for aws
var
container
=
new
JTopo
.
Container
();
//container.textPosition = 'Middle_Center';
//container.fontColor = '100,255,0';
//container.fillColor = '10,10,100';
container
.
setBound
(
appNodeX
+
100
,
appNodeY
+
200
,
300
,
280
);
scene
.
add
(
container
);
container
.
add
(
newNode
(
scene
,
appNodeX
+
120
,
appNodeY
+
180
,
1
,
1
));
container
.
add
(
newNode
(
scene
,
appNodeX
+
120
,
appNodeY
+
430
,
1
,
1
));
container
.
add
(
newNode
(
scene
,
appNodeX
+
250
,
appNodeY
+
180
,
1
,
1
));
//定义container for qq
var
container_qq
=
new
JTopo
.
Container
();
container_qq
.
setBound
(
appNodeX
+
100
,
appNodeY
+
200
,
300
,
280
);
scene
.
add
(
container_qq
);
container_qq
.
add
(
newNode
(
scene
,
appNodeX
+
300
,
appNodeY
+
180
,
1
,
1
));
container_qq
.
add
(
newNode
(
scene
,
appNodeX
+
300
,
appNodeY
+
430
,
1
,
1
));
container_qq
.
add
(
newNode
(
scene
,
appNodeX
+
120
,
appNodeY
+
180
,
1
,
1
));
container_qq
.
add
(
newNode
(
scene
,
appNodeX
+
120
,
appNodeY
+
430
,
1
,
1
));
container_qq
.
add
(
newNode
(
scene
,
appNodeX
+
590
,
appNodeY
+
180
,
1
,
1
));
var
askServer
=
newNode
(
scene
,
appNodeX
+
560
,
appNodeY
+
200
,
appNodeW
,
appNodeH
,
'问询服务器'
);
...
...
@@ -49,11 +39,11 @@ function drawData(resp) {
var
awsElb
=
newNode
(
scene
,
appNodeX
+
160
,
appNodeY
+
200
,
appNodeW
,
appNodeH
,
'awsElb'
);
container
.
add
(
awsElb
);
var
awsNginx
=
newNode
(
scene
,
appNodeX
+
165
,
appNodeY
+
300
,
appNodeW
,
appNodeH
,
'awsNginx'
);
container
.
add
(
awsNginx
);
var
link
=
newLink
(
scene
,
awsElb
,
awsNginx
);
var
az2Elb
=
newNode
(
scene
,
appNodeX
+
160
,
appNodeY
+
200
,
appNodeW
,
appNodeH
,
'az2Elb'
);
container_qq
.
add
(
az2Elb
);
var
az2Nginx
=
newNode
(
scene
,
appNodeX
+
165
,
appNodeY
+
300
,
appNodeW
,
appNodeH
,
'az2Nginx'
);
container_qq
.
add
(
az2Nginx
);
var
link
=
newLink
(
scene
,
az2Elb
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
...
...
@@ -64,8 +54,8 @@ function drawData(resp) {
var
link
=
newLink
(
scene
,
qqElb
,
qqNginx
);
link
.
arrowsRadius
=
10
;
var
awsGateway1
=
newNode
(
scene
,
appNodeX
+
180
,
appNodeY
+
400
,
appNodeW
,
appNodeH
,
'awsGateway'
);
container
.
add
(
awsGateway1
);
var
az2Gateway1
=
newNode
(
scene
,
appNodeX
+
180
,
appNodeY
+
400
,
appNodeW
,
appNodeH
,
'az2Gateway'
);
container_qq
.
add
(
az2Gateway1
);
var
qqGateway1
=
newNode
(
scene
,
appNodeX
+
350
,
appNodeY
+
400
,
appNodeW
,
appNodeH
,
'qqGateway'
);
var
grayGateway
=
newNode
(
scene
,
appNodeX
+
450
,
appNodeY
+
400
,
appNodeW
,
appNodeH
,
'grayGateway'
);
...
...
@@ -85,35 +75,35 @@ function drawData(resp) {
link
.
arrowsRadius
=
10
;
}
if
(
'aws'
==
data
.
awsApiNginx
){
//aws nginx 指向aws gateway
var
link
=
newLink
(
scene
,
awsNginx
,
awsGateway1
,
"online"
);
if
(
'az2'
==
data
.
az2ApiNginx
){
//aws nginx 指向aws gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
az2Gateway1
,
"online"
);
link
.
arrowsRadius
=
10
;
}
else
{
//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
awsNginx
,
qqGateway1
,
"online"
);
}
else
if
(
"qq"
==
data
.
az2ApiNginx
){
//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
qqGateway1
,
"online"
);
link
.
arrowsRadius
=
10
;
}
if
(
'aws'
==
data
.
awsGrayNginx
){
//aws nginx gray 指向aws gateway
var
link
=
newLink
(
scene
,
awsNginx
,
awsGateway1
,
"gray"
);
if
(
'az2'
==
data
.
az2GrayNginx
){
//aws nginx gray 指向aws gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
az2Gateway1
,
"gray"
);
link
.
arrowsRadius
=
10
;
}
else
if
(
'qq'
==
data
.
awsGrayNginx
){
//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
awsNginx
,
qqGateway1
,
"gray"
);
}
else
if
(
'qq'
==
data
.
az2GrayNginx
){
//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
qqGateway1
,
"gray"
);
link
.
arrowsRadius
=
10
;
}
else
{
//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
a
ws
Nginx
,
grayGateway
,
"gray"
);
var
link
=
newLink
(
scene
,
a
z2
Nginx
,
grayGateway
,
"gray"
);
link
.
arrowsRadius
=
10
;
}
if
(
'aws'
==
data
.
qqApiNginx
){
//qq nginx 指向aws gateway
var
link
=
newLink
(
scene
,
qqNginx
,
awsGateway1
,
"online"
);
if
(
'az2'
==
data
.
qqApiNginx
){
//qq nginx 指向aws gateway
var
link
=
newLink
(
scene
,
qqNginx
,
az2Gateway1
,
"online"
);
link
.
arrowsRadius
=
10
;
}
else
{
//qq nginx 指向qq gateway
}
else
if
(
'qq'
==
data
.
qqApiNginx
)
{
//qq nginx 指向qq gateway
var
link
=
newLink
(
scene
,
qqNginx
,
qqGateway1
,
"online"
);
link
.
arrowsRadius
=
10
;
}
if
(
'aws'
==
data
.
qqGrayNginx
){
//qq nginx gray 指向aws gateway
var
link
=
newLink
(
scene
,
qqNginx
,
awsGateway1
,
"gray"
);
if
(
'az2'
==
data
.
qqGrayNginx
){
//qq nginx gray 指向aws gateway
var
link
=
newLink
(
scene
,
qqNginx
,
az2Gateway1
,
"gray"
);
link
.
arrowsRadius
=
10
;
}
else
if
(
'qq'
==
data
.
qqGrayNginx
){
//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
qqNginx
,
qqGateway1
,
"gray"
);
...
...
@@ -123,145 +113,21 @@ function drawData(resp) {
link
.
arrowsRadius
=
10
;
}
if
(
'aws'
==
data
.
defaultDns
){
var
link
=
newFoldLink
(
scene
,
appNode
,
awsElb
,
'dns'
,
''
,
5
);
link
.
arrowsRadius
=
10
;
}
else
if
(
'qq'
==
data
.
defaultDns
){
var
link
=
newFoldLink
(
scene
,
appNode
,
qqElb
,
'dns'
,
''
,
5
);
link
.
arrowsRadius
=
10
;
}
//创建lua切换按钮
createLuaSwitchButton
(
data
.
luaType
);
//创建入口切换按钮
createDnsSwitchButton
(
data
.
luaType
);
}
/*
function drawData_bak(resp) {
var data = resp.data;
var canvas = document.getElementById('canvas');
var stage = new JTopo.Stage(canvas);
//显示工具栏
//showJTopoToobar(stage);
var scene = new JTopo.Scene();
stage.add(scene);
scene.background = contextPath + "img/bg.jpg";
var appNodeX = 100;
var appNodeY = 50;
var appNodeW = 30;
var appNodeH = 26;
var appNode = newNode(scene,appNodeX,appNodeY,appNodeW,appNodeH,'APP');
var askServer = newNode(scene,appNodeX+600,appNodeY+100,appNodeW,appNodeH,'问询服务器');
var link = newFoldLink(scene,appNode, askServer, '问询');
link.arrowsRadius = 10;
var awsElb = newNode(scene,appNodeX+160,appNodeY+200,appNodeW,appNodeH,'awsElb');
var awsNginx = newNode(scene,appNodeX+165,appNodeY+300,appNodeW,appNodeH,'awsNginx');
var link = newLink(scene,awsElb, awsNginx);
link.arrowsRadius = 10;
var qqElb = newNode(scene,appNodeX+400-5,appNodeY+200,appNodeW,appNodeH,'qqElb');
//var link = newFoldLink(scene,appNode, qqElb, '域名');
//link.arrowsRadius = 10;
var qqNginx = newNode(scene,appNodeX+400,appNodeY+300,appNodeW,appNodeH,'qqNginx');
var link = newLink(scene,qqElb, qqNginx);
link.arrowsRadius = 10;
var awsGateway1 = newNode(scene,appNodeX+180,appNodeY+400,appNodeW,appNodeH,'awsGateway');
//var awsGateway2 = newNode(scene,appNodeX+250,appNodeY+400,appNodeW,appNodeH,'awsGateway');
var qqGateway1 = newNode(scene,appNodeX+350,appNodeY+400,appNodeW,appNodeH,'qqGateway');
//var qqGateway2 = newNode(scene,appNodeX+450,appNodeY+400,appNodeW,appNodeH,'qqGateway');
var grayGateway = newNode(scene,appNodeX+450,appNodeY+400,appNodeW,appNodeH,'grayGateway');
var appServerSe1 = newNode(scene,appNodeX+100,appNodeY-100,1,1);
var appServerSe2 = newNode(scene,appNodeX+100,appNodeY+500,1,1);
newLink(scene,appServerSe1, appServerSe2,"",10);
var awsQqSe1 = newNode(scene,appNodeX+300,appNodeY-100,1,1);
var awsQqSe2 = newNode(scene,appNodeX+300,appNodeY+500,1,1);
newLink(scene,awsQqSe1, awsQqSe2,"",10);
var app = newNode(scene,appNodeX,appNodeY-50,1,1,'app');
var aws = newNode(scene,appNodeX+200,appNodeY-50,1,1,'aws');
var qq = newNode(scene,appNodeX+400,appNodeY-50,1,1,'qq');
if('aws' == data.luaType){//app全部直连到aws
var link = newLink(scene,appNode, awsElb, '直连');
link.arrowsRadius = 10;
}else if('qq' == data.luaType){//app全部直连到qq
var link = newLink(scene,appNode, qqElb, '直连');
link.arrowsRadius = 10;
}else if('aws+qq' == data.luaType){//app分散直连
var link = newLink(scene,appNode, awsElb, '直连');
link.arrowsRadius = 10;
var link = newLink(scene,appNode, qqElb, '直连');
link.arrowsRadius = 10;
}
if('aws' == data.awsApiNginx){//aws nginx 指向aws gateway
var link = newLink(scene,awsNginx, awsGateway1,"online");
link.arrowsRadius = 10;
}else{//aws nginx 指向qq gateway
var link = newLink(scene,awsNginx, qqGateway1,"online");
link.arrowsRadius = 10;
}
if('aws' == data.awsGrayNginx){//aws nginx gray 指向aws gateway
var link = newLink(scene,awsNginx, awsGateway1,"gray");
link.arrowsRadius = 10;
}else if('qq' == data.awsGrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,awsNginx, qqGateway1,"gray");
link.arrowsRadius = 10;
}else{//aws nginx 指向qq gateway
var link = newLink(scene,awsNginx, grayGateway,"gray");
link.arrowsRadius = 10;
}
if('aws' == data.qqApiNginx){//qq nginx 指向aws gateway
var link = newLink(scene,qqNginx, awsGateway1,"online");
link.arrowsRadius = 10;
}else{//qq nginx 指向qq gateway
var link = newLink(scene,qqNginx, qqGateway1,"online");
link.arrowsRadius = 10;
}
if('aws' == data.qqGrayNginx){//qq nginx gray 指向aws gateway
var link = newLink(scene,qqNginx, awsGateway1,"gray");
link.arrowsRadius = 10;
}else if('qq' == data.qqGrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,qqNginx, qqGateway1,"gray");
link.arrowsRadius = 10;
}else{//aws nginx 指向qq gateway
var link = newLink(scene,qqNginx, grayGateway,"gray");
link.arrowsRadius = 10;
}
if('aws' == data.defaultDns){
/* if('aws' == data.defaultDns){
var link = newFoldLink(scene,appNode, awsElb, 'dns','',5);
link.arrowsRadius = 10;
}else if('qq' == data.defaultDns){
var link = newFoldLink(scene,appNode, qqElb, 'dns','',5);
link.arrowsRadius = 10;
}
}
*/
//创建lua切换按钮
createLuaSwitchButton(data.luaType);
//创建入口切换按钮
createDnsSwitchButton(data.luaType);
//createDnsSwitchButton(data.luaType);
}
*/
/**
...
...
@@ -354,7 +220,7 @@ function luaViewToChangeSuccess(resp) {
* 创建Dns切换按钮
* @param luaType
*/
function
createDnsSwitchButton
(
luaType
){
/*
function createDnsSwitchButton(luaType){
if(luaType == ""){
return;
}
...
...
@@ -369,7 +235,7 @@ function createDnsSwitchButton(luaType){
}else{
$("#dns-div").html(awsButton + qqButton);
}
}
}
*/
/**
* 直接切换,由于调用的是api
...
...
Please
register
or
login
to post a comment