Authored by qinchao

nginx切换

... ... @@ -41,9 +41,11 @@ public class TopoSwitchUtil {
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))){
String tmpServerRecord=serverList.get(0);
String tmpServerIp=tmpServerRecord.substring(0,tmpServerRecord.indexOf(":"));
if(az1HostIps.contains(tmpServerIp)){
qqApiNginx = "qq";
}else if(az2HostIps.contains(serverList.get(0))){
}else if(az2HostIps.contains(tmpServerIp)){
qqApiNginx = "az2";
}
}
... ... @@ -51,9 +53,11 @@ public class TopoSwitchUtil {
if (StringUtils.equals("grayapigateway", String.valueOf(apiMap.get("name")))) {
List<String> serverList = (List<String>) apiMap.get("server");
logger.error("qqgrayapigateway is === "+serverList.get(0));
String tmpServerRecord=serverList.get(0);
String tmpServerIp=tmpServerRecord.substring(0,tmpServerRecord.indexOf(":"));
boolean grayFlag=false;
for(String grayIp:grayHostIps){
if(serverList.get(0).startsWith(grayIp)){
if(tmpServerIp.startsWith(grayIp)){
grayFlag=true;
break;
}
... ... @@ -61,9 +65,9 @@ public class TopoSwitchUtil {
if(grayFlag){
qqGrayNginx = "gray";
}else{
if(az1HostIps.contains(serverList.get(0))){
if(az1HostIps.contains(tmpServerIp)){
qqGrayNginx = "qq";
}else if(az2HostIps.contains(serverList.get(0))){
}else if(az2HostIps.contains(tmpServerIp)){
qqApiNginx = "az2";
}
}
... ...
... ... @@ -253,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=20180511"></script>
<script src="<%=basePath %>script/switch.js?v=20180511-003"></script>
<script type="text/javascript">
$("#li_switch").addClass("active open");
... ...
... ... @@ -39,29 +39,34 @@ function drawData(resp) {
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;
var qqElb = newNode(scene,appNodeX+400,appNodeY+200,appNodeW,appNodeH,'qqElb');
var qqElb = newNode(scene,appNodeX+160,appNodeY+200,appNodeW,appNodeH,'qqElb');
container_qq.add(qqElb);
var qqNginx = newNode(scene,appNodeX+405,appNodeY+300,appNodeW,appNodeH,'qqNginx');
var qqNginx = newNode(scene,appNodeX+165,appNodeY+300,appNodeW,appNodeH,'qqNginx');
container_qq.add(qqNginx);
var link = newLink(scene,qqElb, qqNginx);
link.arrowsRadius = 10;
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');
var qqGateway1 = newNode(scene,appNodeX+180,appNodeY+400,appNodeW,appNodeH,'qqGateway');
var grayGateway = newNode(scene,appNodeX+300,appNodeY+420,appNodeW,appNodeH,'grayGateway');
container_qq.add(qqGateway1);
container_qq.add(grayGateway);
var az2Elb = newNode(scene,appNodeX+400,appNodeY+200,appNodeW,appNodeH,'az2Elb');
container_qq.add(az2Elb);
var az2Nginx = newNode(scene,appNodeX+405,appNodeY+300,appNodeW,appNodeH,'az2Nginx');
container_qq.add(az2Nginx);
var link = newLink(scene,az2Elb, az2Nginx);
link.arrowsRadius = 10;
var az2Gateway1 = newNode(scene,appNodeX+450,appNodeY+400,appNodeW,appNodeH,'az2Gateway');
container_qq.add(az2Gateway1);
if('aws' == data.luaType){//app全部直连到aws
var link = newLink(scene,appNode, awsElb, '直连');
link.arrowsRadius = 10;
... ... @@ -89,7 +94,7 @@ function drawData(resp) {
}else if('qq' == data.az2GrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,az2Nginx, qqGateway1,"gray");
link.arrowsRadius = 10;
}else{//aws nginx 指向qq gateway
}else if('gray' == data.az2GrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,az2Nginx, grayGateway,"gray");
link.arrowsRadius = 10;
}
... ... @@ -108,7 +113,7 @@ function drawData(resp) {
}else if('qq' == data.qqGrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,qqNginx, qqGateway1,"gray");
link.arrowsRadius = 10;
}else{//aws nginx 指向qq gateway
}else if('gray' == data.qqGrayNginx){//aws nginx 指向qq gateway
var link = newLink(scene,qqNginx, grayGateway,"gray");
link.arrowsRadius = 10;
}
... ... @@ -503,18 +508,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){
}else if("awsElb"==text||"qqElb"==text||"az2Elb"==text){
node.setImage(contextPath + 'img/pstn/cloud.png', true);
node.textPosition = 'Middle_Center';// 文字居中
}else if("awsNginx"==text||"qqNginx"==text){
}else if("awsNginx"==text||"qqNginx"==text||"az2Nginx"==text){
node.setImage(contextPath + 'img/pstn/router2.png', true);
node.textPosition = 'Top_Center';// 文字居中
}else if("awsGateway"==text||"qqGateway"==text){
}else if("awsGateway"==text||"qqGateway"==text||"az2Gateway"==text){
node.setImage(contextPath + 'img/pstn/msc.png', true);
//node.alarm = "";
//node.alarmColor = '0,255,0';
}else if("grayGateway"==text){
node.setImage(contextPath + 'img/pstn/msc.png', true);
node.setImage(contextPath + 'img/pstn/router.png', true);
}
scene.add(node);
return node;
... ...