Authored by qinchao

重绘关键切换拓扑图

... ... @@ -77,11 +77,8 @@ public class TopoSwitchCtrl {
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<Host> grayHostLists=(List<Host>)map.get("grayServerHosts").get(0).get("grayServerHosts");
List<String> grayHostIps=new ArrayList<>();
for(Host host:grayHostLists){
grayHostIps.add(host.getIp());
}*/
List<String> grayHostIps=(List<String>)(map.get("grayServerHosts").get(0).get("grayServerHosts"));
String awsApiNginx = "aws";
String awsGrayNginx = "aws";
String qqApiNginx = "qq";
... ... @@ -97,11 +94,22 @@ public class TopoSwitchCtrl {
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";
logger.error("awsgrayapigateway is === "+serverList.get(0));
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{
awsGrayNginx="aws";
if (serverList.get(0).startsWith("10")) {
awsGrayNginx = "qq";
}else{
awsGrayNginx="aws";
}
}
}
}
... ... @@ -116,10 +124,22 @@ public class TopoSwitchCtrl {
if (StringUtils.equals("grayapigateway", String.valueOf(apiMap.get("name")))) {
List<String> serverList = (List<String>) apiMap.get("server");
if (serverList.get(0).startsWith("172")) {
qqGrayNginx = "aws";
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{
logger.error("qqgrayapigateway is === "+serverList.get(0));
if (serverList.get(0).startsWith("10")) {
qqGrayNginx = "qq";
}else{
qqGrayNginx="aws";
}
}
}
}
... ...
... ... @@ -250,7 +250,7 @@
</div>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script src="<%=basePath %>script/switch.js?v=20171025"></script>
<script src="<%=basePath %>script/switch.js?v=20171025-2"></script>
<script type="text/javascript">
$("#li_switch").addClass("active open");
... ...
... ... @@ -6,7 +6,7 @@ $(document).ready(function () {
* 展示画布 和 数据
* @param resp
*/
function drawData_bbbbbbbak(resp) {
/*function drawData_bbbbbbbak(resp) {
var data = resp.data;
var canvas = document.getElementById('canvas');
... ... @@ -118,7 +118,7 @@ function drawData_bbbbbbbak(resp) {
//创建入口切换按钮
createDnsSwitchButton(data.luaType);
}
}*/
/**
* 展示画布 和 数据
... ... @@ -205,6 +205,9 @@ function drawData(resp) {
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;
... ... @@ -221,6 +224,9 @@ function drawData(resp) {
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;
... ...