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
d911417f1a0f777fa26fbe895e903de4d8517441
1 parent
73159a4d
nginx切换调整
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
266 additions
and
106 deletions
monitor-ui-ctrl/src/main/java/com/ui/ctrl/TopoSwitchCtrl.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 @
d911417
package
com
.
ui
.
ctrl
;
import
com.google.common.collect.Lists
;
import
com.ui.contants.HttpUriContants
;
import
com.ui.http.HttpRestClient
;
import
com.ui.model.BaseResponse
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -13,9 +15,7 @@ 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
;
import
java.util.*
;
/**
* 限流调整
...
...
@@ -60,41 +60,85 @@ public class TopoSwitchCtrl {
//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
);
if
(
response
==
null
||
response
.
getCode
()!=
200
){
return
new
BaseResponse
(
201
,
response
==
null
?
"获取后台数据为空"
:
response
.
getMessage
());
}
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
map
=
response
.
getData
();
List
<
Map
<
String
,
Object
>>
qcloudList
=
map
.
get
(
"qcloudList"
);
List
<
Map
<
String
,
Object
>>
qcloudaz2List
=
map
.
get
(
"qcloudaz2List"
);
//List<Map<String, Object>> qcloudList = map.get("qcloudList");
//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
>
az3HostIps
=(
List
<
String
>)(
map
.
get
(
"gatewayServerHosts"
).
get
(
0
).
get
(
"az3ServerHosts"
));
List
<
String
>
grayHostIps
=(
List
<
String
>)(
map
.
get
(
"gatewayServerHosts"
).
get
(
0
).
get
(
"grayServerHosts"
));
List
<
String
>
az1NginxIps
=(
List
<
String
>)(
map
.
get
(
"nginxServerHosts"
).
get
(
0
).
get
(
"az1NginxHosts"
));
List
<
String
>
az2NginxIps
=(
List
<
String
>)(
map
.
get
(
"nginxServerHosts"
).
get
(
0
).
get
(
"az2NginxHosts"
));
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
(
"qqApiNginx"
,
qqApiNginx
);
List
<
String
>
az3NginxIps
=(
List
<
String
>)(
map
.
get
(
"nginxServerHosts"
).
get
(
0
).
get
(
"az3NginxHosts"
));
//lb信息
Map
<
String
,
Object
>
lbMap
=
map
.
get
(
"lbMap"
).
get
(
0
);
Map
<
String
,
List
<
String
>>
forward_nginx_Map
=
new
HashMap
<>();
for
(
String
key:
lbMap
.
keySet
()){
String
[]
keys
=
key
.
split
(
","
);
resultMap
.
put
(
"elb_"
+
keys
[
0
]+
"_"
+
keys
[
1
],
keys
[
2
]);
//指定elb的ip
//计算elb指向的nginx
List
<
String
>
ipInWeight
=(
ArrayList
<
String
>)
lbMap
.
get
(
key
);
if
(
ipInWeight
!=
null
&&
ipInWeight
.
size
()>
0
){
String
forward_nginx
=
"forward_nginx_by_"
+
keys
[
0
]+
"_"
+
keys
[
1
];
if
(
forward_nginx_Map
.
get
(
forward_nginx
)==
null
){
forward_nginx_Map
.
put
(
forward_nginx
,
new
ArrayList
<
String
>());
}
if
(
CollectionUtils
.
retainAll
(
az1NginxIps
,
ipInWeight
).
size
()>
0
){
forward_nginx_Map
.
get
(
forward_nginx
).
add
(
"az1"
);
}
if
(
CollectionUtils
.
retainAll
(
az2NginxIps
,
ipInWeight
).
size
()>
0
){
forward_nginx_Map
.
get
(
forward_nginx
).
add
(
"az2"
);
}
if
(
CollectionUtils
.
retainAll
(
az3NginxIps
,
ipInWeight
).
size
()>
0
){
forward_nginx_Map
.
get
(
forward_nginx
).
add
(
"az3"
);
}
}
}
Map
<
String
,
String
>
forward_nginx_str_Map
=
new
HashMap
<>();
for
(
String
key:
forward_nginx_Map
.
keySet
()){
forward_nginx_str_Map
.
put
(
key
,
StringUtils
.
join
(
forward_nginx_Map
.
get
(
key
),
","
)
);
}
resultMap
.
put
(
"lb_forward_nginx"
,
forward_nginx_str_Map
);
resultMap
.
put
(
"lbMap"
,
lbMap
);
//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("qqApiNginx", qqApiNginx);
resultMap.put("qqGrayNginx", qqGrayNginx);
resultMap.put("az2ApiNginx", az2ApiNginx);
resultMap
.
put
(
"az2GrayNginx"
,
az2GrayNginx
);
resultMap.put("az2GrayNginx", az2GrayNginx);
*/
resultMap
.
put
(
"defaultDns"
,
httpRestClient
.
defaultGet
(
HttpUriContants
.
CENTERSWITCH_DEFAULT_DNS
,
String
.
class
));
resultMap
.
put
(
"luaType"
,
topoSwitchUtil
.
getLuaType
());
//
resultMap
.
put
(
"az1NginxIps"
,
az1NginxIps
);
resultMap
.
put
(
"az2NginxIps"
,
az2NginxIps
);
resultMap
.
put
(
"az3NginxIps"
,
az3NginxIps
);
resultMap
.
put
(
"az1GatewayIps"
,
az1HostIps
);
resultMap
.
put
(
"az2GatewayIps"
,
az2HostIps
);
resultMap
.
put
(
"az3GatewayIps"
,
az3HostIps
);
resultMap
.
put
(
"grayGatewayIps"
,
grayHostIps
);
}
catch
(
Exception
e
){
logger
.
error
(
" TopoSwitchCtrl - getNgixnStatus - err"
,
e
);
return
new
BaseResponse
(
201
,
e
.
getMessage
());
}
return
new
BaseResponse
(
resultMap
);
...
...
monitor-ui-web/src/main/webapp/jsp/switch/switch_topology.jsp
View file @
d911417
...
...
@@ -71,12 +71,14 @@
<div
class=
"container-fluid"
>
<div
class=
"widget-box"
>
<div
style=
"float: left;width: 800px;color: #D3D3D3;height: 600px;"
>
<canvas
width=
"800"
height=
"550"
id=
"canvas"
></canvas>
<div
style=
"width: 1200px;color: #D3D3D3;height: 600px;"
>
<canvas
width=
"1200"
height=
"550"
id=
"canvas"
></canvas>
</div>
<div
class=
"widget-content nopadding"
style=
"margin-left: 800px;border-left: 1px solid #E5E5E5;"
>
</div>
<div
class=
"widget-box"
>
<div
class=
"widget-content nopadding"
>
<div
class=
"widget-content nopadding"
>
<div
class=
"tree_container"
style=
"
height: 540px;
color: black;overflow:auto;"
>
<div
class=
"tree_container"
style=
"color: black;overflow:auto;"
>
<div
class=
"panel panel-default"
>
<div
class=
"widget-title"
style=
"height: 50px;"
>
<h5
style=
"display: inline"
>
入口切换
</h5>
...
...
@@ -253,7 +255,7 @@
</div>
<script
src=
"<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"
></script>
<script
src=
"<%=basePath %>script/switch.js?v=20180514-00
3
"
></script>
<script
src=
"<%=basePath %>script/switch.js?v=20180514-00
7
"
></script>
<script
type=
"text/javascript"
>
$
(
"#li_switch"
).
addClass
(
"active open"
);
...
...
monitor-ui-web/src/main/webapp/script/switch.js
View file @
d911417
...
...
@@ -25,148 +25,244 @@ function drawData(resp) {
//定义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
-
50
,
appNodeY
+
120
,
1
,
1
));
container_qq
.
add
(
newNode
(
scene
,
appNodeX
-
50
,
appNodeY
+
520
,
1
,
1
));
container_qq
.
add
(
newNode
(
scene
,
appNodeX
+
320
,
appNodeY
+
120
,
1
,
1
));
var
container_az1
=
new
JTopo
.
Container
();
scene
.
add
(
container_az1
);
container_az1
.
add
(
newNode
(
scene
,
appNodeX
-
50
,
appNodeY
+
120
,
1
,
1
));
container_az1
.
add
(
newNode
(
scene
,
appNodeX
-
50
,
appNodeY
+
520
,
1
,
1
));
container_az1
.
add
(
newNode
(
scene
,
appNodeX
+
320
,
appNodeY
+
120
,
1
,
1
));
var
container_az2
=
new
JTopo
.
Container
();
container_az2
.
setBound
(
appNodeX
+
430
,
appNodeY
+
200
,
300
,
280
);
scene
.
add
(
container_az2
);
container_az2
.
add
(
newNode
(
scene
,
appNodeX
+
340
,
appNodeY
+
120
,
1
,
1
));
container_az2
.
add
(
newNode
(
scene
,
appNodeX
+
340
,
appNodeY
+
520
,
1
,
1
));
container_az2
.
add
(
newNode
(
scene
,
appNodeX
+
650
,
appNodeY
+
120
,
1
,
1
));
var
container_az3
=
new
JTopo
.
Container
();
//container_az3.fillColor = '10,10,100';
scene
.
add
(
container_az3
);
container_az3
.
add
(
newNode
(
scene
,
appNodeX
+
340
+
340
,
appNodeY
+
120
,
1
,
1
));
container_az3
.
add
(
newNode
(
scene
,
appNodeX
+
340
+
340
,
appNodeY
+
520
,
1
,
1
));
container_az3
.
add
(
newNode
(
scene
,
appNodeX
+
650
+
340
,
appNodeY
+
120
,
1
,
1
));
var
askServer
=
newNode
(
scene
,
appNodeX
-
20
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'问询服务器'
);
container_
qq
.
add
(
askServer
);
container_
az1
.
add
(
askServer
);
var
link
=
newFoldLink
(
scene
,
appNode
,
askServer
,
'问询'
);
link
.
arrowsRadius
=
10
;
var
elb_az1_outer
=
newNode
(
scene
,
appNodeX
+
80
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'elb_az1_outer'
);
resetLbNodeIp
(
elb_az1_outer
,
data
);
var
elb_az1_inner
=
newNode
(
scene
,
appNodeX
+
80
+
120
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'elb_az1_inner'
);
resetLbNodeIp
(
elb_az1_inner
,
data
);
container_az1
.
add
(
elb_az1_outer
);
container_az1
.
add
(
elb_az1_inner
);
var
elb_az2_outer
=
newNode
(
scene
,
appNodeX
+
400
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'elb_az2_outer'
);
resetLbNodeIp
(
elb_az2_outer
,
data
);
var
elb_az2_inner
=
newNode
(
scene
,
appNodeX
+
400
+
120
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'elb_az2_inner'
);
resetLbNodeIp
(
elb_az2_inner
,
data
);
container_az2
.
add
(
elb_az2_outer
);
container_az2
.
add
(
elb_az2_inner
);
var
elb_az3_outer
=
newNode
(
scene
,
appNodeX
+
720
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'elb_az3_outer'
);
resetLbNodeIp
(
elb_az3_outer
,
data
);
var
elb_az3_inner
=
newNode
(
scene
,
appNodeX
+
720
+
120
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'elb_az3_inner'
);
resetLbNodeIp
(
elb_az3_inner
,
data
);
container_az3
.
add
(
elb_az3_outer
);
container_az3
.
add
(
elb_az3_inner
);
var
qqElb
=
newNode
(
scene
,
appNodeX
+
100
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'az1Elb'
);
container_qq
.
add
(
qqElb
);
var
qqElbIp
=
newNodeForIp
(
scene
,
appNodeX
+
100
+
90
,
appNodeY
+
150
+
15
,
1
,
1
,
'123.206.1.98'
);
qqElbIp
.
textPosition
=
'Bottom_Right'
;
container_qq
.
add
(
qqElbIp
);
var
qqNginx
=
newNode
(
scene
,
appNodeX
+
105
,
appNodeY
+
250
,
appNodeW
,
appNodeH
,
'az1Nginx'
);
container_qq
.
add
(
qqNginx
);
var
link
=
newLink
(
scene
,
qqElb
,
qqNginx
);
link
.
arrowsRadius
=
10
;
var
az1Nginx
=
newNode
(
scene
,
appNodeX
+
105
,
appNodeY
+
250
,
appNodeW
,
appNodeH
,
'az1Nginx'
);
container_az1
.
add
(
az1Nginx
);
//var link = newLink(scene,az1Elb, az1Nginx);
//link.arrowsRadius = 10;
for
(
var
i
=
0
;
i
<
data
.
az1NginxIps
.
length
;
i
++
){
var
qqNginxIp
=
newNodeForIp
(
scene
,
appNodeX
+
105
+
75
,
appNodeY
+
250
+
i
*
10
,
1
,
1
,
data
.
az1NginxIps
[
i
]);
qqNginxIp
.
textPosition
=
'Middle_Right'
;
container_qq
.
add
(
qqNginxIp
);
var
tmp
=
newNodeForIp
(
scene
,
appNodeX
+
105
+
75
,
appNodeY
+
250
+
i
*
10
,
1
,
1
,
data
.
az1NginxIps
[
i
]);
tmp
.
textPosition
=
'Middle_Right'
;
container_az1
.
add
(
tmp
);
}
var
qqGateway1
=
newNode
(
scene
,
appNodeX
+
10
,
appNodeY
+
370
,
appNodeW
,
appNodeH
,
'az1Gateway'
);
container_qq
.
add
(
qqGateway1
);
for
(
var
i
=
0
;
i
<
data
.
az1GatewayIps
.
length
;
i
++
){
var
azIp
=
newNodeForIp
(
scene
,
appNodeX
+
10
-
20
,
appNodeY
+
370
+
60
+
i
*
10
,
1
,
1
,
data
.
az1GatewayIps
[
i
]);
azIp
.
textPosition
=
'Middle_Right'
;
container_qq
.
add
(
azIp
);
}
var
az2Nginx
=
newNode
(
scene
,
appNodeX
+
425
,
appNodeY
+
250
,
appNodeW
,
appNodeH
,
'az2Nginx'
);
container_az2
.
add
(
az2Nginx
);
// var link = newLink(scene,az2Elb, az2Nginx);
// link.arrowsRadius = 10;
var
grayGateway
=
newNode
(
scene
,
appNodeX
+
230
,
appNodeY
+
390
,
appNodeW
,
appNodeH
,
'grayGateway'
);
container_qq
.
add
(
grayGateway
);
for
(
var
i
=
0
;
i
<
data
.
grayGatewayIps
.
length
;
i
++
){
var
azIp
=
newNodeForIp
(
scene
,
appNodeX
+
230
-
15
,
appNodeY
+
370
+
60
+
i
*
10
,
1
,
1
,
data
.
grayGatewayIps
[
i
]);
azIp
.
textPosition
=
'Middle_Right'
;
container_qq
.
add
(
azIp
);
for
(
var
i
=
0
;
i
<
data
.
az2NginxIps
.
length
;
i
++
){
var
tmp
=
newNodeForIp
(
scene
,
appNodeX
+
425
+
75
,
appNodeY
+
250
+
i
*
10
,
1
,
1
,
data
.
az2NginxIps
[
i
]);
tmp
.
textPosition
=
'Middle_Right'
;
container_az2
.
add
(
tmp
);
}
var
az2Elb
=
newNode
(
scene
,
appNodeX
+
420
,
appNodeY
+
150
,
appNodeW
,
appNodeH
,
'az2Elb'
);
container_az2
.
add
(
az2Elb
);
var
az3Nginx
=
newNode
(
scene
,
appNodeX
+
425
+
340
,
appNodeY
+
250
,
appNodeW
,
appNodeH
,
'az3Nginx'
);
container_az3
.
add
(
az3Nginx
);
// var link = newLink(scene,az2Elb, az2Nginx);
// link.arrowsRadius = 10;
var
az2ElbIp
=
newNodeForIp
(
scene
,
appNodeX
+
420
+
90
,
appNodeY
+
150
+
15
,
1
,
1
,
'123.206.2.50'
);
az2ElbIp
.
textPosition
=
'Bottom_Right'
;
container_az2
.
add
(
az2ElbIp
);
for
(
var
i
=
0
;
i
<
data
.
az3NginxIps
.
length
;
i
++
){
var
tmp
=
newNodeForIp
(
scene
,
appNodeX
+
425
+
75
+
340
,
appNodeY
+
250
+
i
*
10
,
1
,
1
,
data
.
az3NginxIps
[
i
]);
tmp
.
textPosition
=
'Middle_Right'
;
container_az3
.
add
(
tmp
);
}
var
az2Nginx
=
newNode
(
scene
,
appNodeX
+
425
,
appNodeY
+
250
,
appNodeW
,
appNodeH
,
'az2Nginx'
);
container_az2
.
add
(
az2Nginx
);
var
link
=
newLink
(
scene
,
az2Elb
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
for
(
var
key
in
data
.
lb_forward_nginx
){
var
valMap
=
data
.
lb_forward_nginx
[
key
];
if
(
key
.
indexOf
(
"az1"
)
>=
0
){
if
(
key
.
indexOf
(
"inner"
)
>=
0
){
if
(
valMap
.
indexOf
(
"az1"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az1_inner
,
az1Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az2"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az1_inner
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az3"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az1_inner
,
az3Nginx
);
link
.
arrowsRadius
=
10
;
}
}
else
if
(
key
.
indexOf
(
"outer"
)
>=
0
){
if
(
valMap
.
indexOf
(
"az1"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az1_outer
,
az1Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az2"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az1_outer
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az3"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az1_outer
,
az3Nginx
);
link
.
arrowsRadius
=
10
;
}
}
}
else
if
(
key
.
indexOf
(
"az2"
)
>=
0
){
if
(
key
.
indexOf
(
"inner"
)
>=
0
){
if
(
valMap
.
indexOf
(
"az1"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az2_inner
,
az1Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az2"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az2_inner
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az3"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az2_inner
,
az3Nginx
);
link
.
arrowsRadius
=
10
;
}
}
else
if
(
key
.
indexOf
(
"outer"
)
>=
0
){
if
(
valMap
.
indexOf
(
"az1"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az2_outer
,
az1Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az2"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az2_outer
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az3"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az2_outer
,
az3Nginx
);
link
.
arrowsRadius
=
10
;
}
}
}
else
if
(
key
.
indexOf
(
"az3"
)
>=
0
){
if
(
key
.
indexOf
(
"inner"
)
>=
0
){
if
(
valMap
.
indexOf
(
"az1"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az3_inner
,
az1Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az2"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az3_inner
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az3"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az3_inner
,
az3Nginx
);
link
.
arrowsRadius
=
10
;
}
}
else
if
(
key
.
indexOf
(
"outer"
)
>=
0
){
if
(
valMap
.
indexOf
(
"az1"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az3_outer
,
az1Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az2"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az3_outer
,
az2Nginx
);
link
.
arrowsRadius
=
10
;
}
else
if
(
valMap
.
indexOf
(
"az3"
)
>=
0
){
var
link
=
newLink
(
scene
,
elb_az3_outer
,
az3Nginx
);
link
.
arrowsRadius
=
10
;
}
}
}
}
for
(
var
i
=
0
;
i
<
data
.
az2NginxIps
.
length
;
i
++
){
var
az2NginxIp
=
newNodeForIp
(
scene
,
appNodeX
+
425
+
75
,
appNodeY
+
250
+
i
*
10
,
1
,
1
,
data
.
az2NginxIps
[
i
]);
az2NginxIp
.
textPosition
=
'Middle_Right'
;
container_az2
.
add
(
az2NginxIp
);
var
az1Gateway
=
newNode
(
scene
,
appNodeX
+
120
,
appNodeY
+
370
,
appNodeW
,
appNodeH
,
'az1Gateway'
);
container_az1
.
add
(
az1Gateway
);
for
(
var
i
=
0
;
i
<
data
.
az1GatewayIps
.
length
;
i
++
){
var
azIp
=
newNodeForIp
(
scene
,
appNodeX
+
120
-
20
,
appNodeY
+
370
+
60
+
i
*
10
,
1
,
1
,
data
.
az1GatewayIps
[
i
]);
azIp
.
textPosition
=
'Middle_Right'
;
container_az1
.
add
(
azIp
);
}
/*var grayGateway = newNode(scene,appNodeX+230,appNodeY+390,appNodeW,appNodeH,'grayGateway');
container_az1.add(grayGateway);
for(var i=0;i<data.grayGatewayIps.length;i++){
var azIp=newNodeForIp(scene,appNodeX+230-15,appNodeY+370+60+i*10,1,1,data.grayGatewayIps[i]);
azIp.textPosition = 'Middle_Right';
container_az1.add(azIp);
}*/
var
az2Gateway1
=
newNode
(
scene
,
appNodeX
+
550
,
appNodeY
+
370
,
appNodeW
,
appNodeH
,
'az2Gateway'
);
container_az2
.
add
(
az2Gateway1
);
var
az2Gateway
=
newNode
(
scene
,
appNodeX
+
450
,
appNodeY
+
370
,
appNodeW
,
appNodeH
,
'az2Gateway'
);
container_az2
.
add
(
az2Gateway
);
for
(
var
i
=
0
;
i
<
data
.
az2GatewayIps
.
length
;
i
++
){
var
az2NginxIp
=
newNodeForIp
(
scene
,
appNodeX
+
5
50
-
20
,
appNodeY
+
370
+
60
+
i
*
10
,
1
,
1
,
data
.
az2GatewayIps
[
i
]);
var
az2NginxIp
=
newNodeForIp
(
scene
,
appNodeX
+
4
50
-
20
,
appNodeY
+
370
+
60
+
i
*
10
,
1
,
1
,
data
.
az2GatewayIps
[
i
]);
az2NginxIp
.
textPosition
=
'Middle_Right'
;
container_az2
.
add
(
az2NginxIp
);
}
var
az3Gateway
=
newNode
(
scene
,
appNodeX
+
450
+
340
,
appNodeY
+
370
,
appNodeW
,
appNodeH
,
'az3Gateway'
);
container_az3
.
add
(
az3Gateway
);
/*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;
}*/
for
(
var
i
=
0
;
i
<
data
.
az3GatewayIps
.
length
;
i
++
){
var
tmpNginxIp
=
newNodeForIp
(
scene
,
appNodeX
+
450
+
340
-
20
,
appNodeY
+
370
+
60
+
i
*
10
,
1
,
1
,
data
.
az3GatewayIps
[
i
]);
tmpNginxIp
.
textPosition
=
'Middle_Right'
;
container_az3
.
add
(
tmpNginxIp
);
}
if
(
'az2'
==
data
.
az2ApiNginx
){
//aws nginx 指向aws gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
az2Gateway1
,
"online"
);
/*if('az2' == data.az2ApiNginx){//aws nginx 指向aws gateway
var link = newLink(scene,az2Nginx, az2Gateway,"online");
link.arrowsRadius = 10;
}else if("qq" == data.az2ApiNginx){//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
qqGateway1
,
"online"
);
var link = newLink(scene,az2Nginx,
az1Gateway
,"online");
link.arrowsRadius = 10;
}
}
*/
if
(
'az2'
==
data
.
az2GrayNginx
){
//aws nginx gray 指向aws gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
az2Gateway1
,
"gray"
);
/*if('az2' == data.az2GrayNginx){//aws nginx gray 指向aws gateway
var link = newLink(scene,az2Nginx, az2Gateway,"gray");
link.arrowsRadius = 10;
}else if('qq' == data.az2GrayNginx){//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
az2Nginx
,
qqGateway1
,
"gray"
);
var link = newLink(scene,az2Nginx,
az1Gateway
,"gray");
link.arrowsRadius = 10;
}else if('gray' == data.az2GrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,az2Nginx, grayGateway,"gray");
link.arrowsRadius = 10;
}
}
*/
if
(
'az2'
==
data
.
qqApiNginx
){
//qq nginx 指向aws gateway
var
link
=
newLink
(
scene
,
qqNginx
,
az2Gateway1
,
"online"
);
/*if('az2' == data.qqApiNginx){//qq nginx 指向aws gateway
var link = newLink(scene,az1Nginx, az2Gateway,"online");
link.arrowsRadius = 10;
}else if('qq' == data.qqApiNginx){//qq nginx 指向qq gateway
var
link
=
newLink
(
scene
,
qqNginx
,
qqGateway1
,
"online"
);
var link = newLink(scene,
az1Nginx, az1Gateway
,"online");
link.arrowsRadius = 10;
}
}
*/
if
(
'az2'
==
data
.
qqGrayNginx
){
//qq nginx gray 指向aws gateway
var
link
=
newLink
(
scene
,
qqNginx
,
az2Gateway1
,
"gray"
);
/*if('az2' == data.qqGrayNginx){//qq nginx gray 指向aws gateway
var link = newLink(scene,az1Nginx, az2Gateway,"gray");
link.arrowsRadius = 10;
}else if('qq' == data.qqGrayNginx){//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
qqNginx
,
qqGateway1
,
"gray"
);
var link = newLink(scene,
az1Nginx, az1Gateway
,"gray");
link.arrowsRadius = 10;
}else if('gray' == data.qqGrayNginx){//aws nginx 指向qq gateway
var
link
=
newLink
(
scene
,
qq
Nginx
,
grayGateway
,
"gray"
);
var link = newLink(scene,
az1
Nginx, grayGateway,"gray");
link.arrowsRadius = 10;
}
}*/
var
link
=
newLink
(
scene
,
az1Nginx
,
az1Gateway
,
""
);
link
.
arrowsRadius
=
10
;
var
link
=
newLink
(
scene
,
az2Nginx
,
az2Gateway
,
""
);
link
.
arrowsRadius
=
10
;
var
link
=
newLink
(
scene
,
az3Nginx
,
az3Gateway
,
""
);
link
.
arrowsRadius
=
10
;
//创建lua切换按钮
//createLuaSwitchButton(data.luaType);
...
...
@@ -183,6 +279,19 @@ function drawData(resp) {
//createDnsSwitchButton(data.luaType);
}
function
resetLbNodeIp
(
node
,
data
)
{
var
oldText
=
node
.
text
;
if
(
oldText
.
indexOf
(
"inner"
)
>=
0
){
// 填充颜色
node
.
fillColor
=
'85,107,47'
;
}
else
{
node
.
fillColor
=
'210,105,30'
;
}
if
(
data
[
oldText
]){
node
.
text
=
data
[
oldText
];
}
}
/**
* 创建lua切换按钮
...
...
@@ -557,13 +666,18 @@ function newNode(scene,x, y, w, h, text) {
node
.
setImage
(
contextPath
+
'img/pstn/host.png'
,
true
);
}
else
if
(
"问询服务器"
==
text
){
node
.
setImage
(
contextPath
+
'img/pstn/terminal.png'
,
true
);
}
else
if
(
"awsElb"
==
text
||
"qqElb"
==
text
||
"az1Elb"
==
text
||
"az2Elb"
==
text
){
node
.
setImage
(
contextPath
+
'img/pstn/cloud.png'
,
true
);
}
else
if
(
text
!=
null
&&
text
.
toLowerCase
().
indexOf
(
"elb"
)
>=
0
){
///node.setImage(contextPath + 'img/pstn/cloud.png', true);
node
.
setSize
(
100
,
30
);
node
.
borderRadius
=
5
;
// 圆角
node
.
borderWidth
=
1
;
// 边框的宽度
node
.
borderColor
=
'255,255,255'
;
//边框颜色
// node.alpha = 0.7; //透明度
node
.
textPosition
=
'Middle_Center'
;
// 文字居中
}
else
if
(
"awsNginx"
==
text
||
"qqNginx"
==
text
||
"az1Nginx"
==
text
||
"az2Nginx"
==
text
){
}
else
if
(
text
!=
null
&&
text
.
toLowerCase
().
indexOf
(
"nginx"
)
>=
0
){
node
.
setImage
(
contextPath
+
'img/pstn/router2.png'
,
true
);
node
.
textPosition
=
'Top_Center'
;
// 文字居中
}
else
if
(
"a
ws
Gateway"
==
text
||
"qqGateway"
==
text
||
"az1Gateway"
==
text
||
"az2Gateway"
==
text
){
}
else
if
(
"a
z3
Gateway"
==
text
||
"qqGateway"
==
text
||
"az1Gateway"
==
text
||
"az2Gateway"
==
text
){
node
.
setImage
(
contextPath
+
'img/pstn/msc.png'
,
true
);
//node.alarm = "";
//node.alarmColor = '0,255,0';
...
...
Please
register
or
login
to post a comment