Authored by qinchao

nginx切换调整

... ... @@ -87,19 +87,19 @@
</button>
<div class="col-sm-8" style="display: inline">
<div class="rdio rdio-default" style="display:inline;">
<input type="radio" name="target_operate_nginx" id="az1_target_operate_az1"
<input type="radio" name="target_operate_nginx" id="az1_target_operate_az1" secondgroup="az1"
value="az1" />
<label for="az1_target_operate_az1">az1</label>
</div>
<div class="rdio rdio-default" style="display:inline;margin-left:30px;">
<input type="radio" name="target_operate_nginx" id="az1_target_operate_az2"
<input type="radio" name="target_operate_nginx" id="az1_target_operate_az2" secondgroup="az1"
value="az2" />
<label for="az1_target_operate_az2">az2</label>
</div>
<div class="rdio rdio-default" style="display:inline;margin-left:30px;">
<input type="radio" name="target_operate_nginx" id="az1_target_operate_az3"
<input type="radio" name="target_operate_nginx" id="az1_target_operate_az3" secondgroup="az1"
value="az3" />
<label for="az1_target_operate_az3">az3</label>
</div>
... ... @@ -119,19 +119,19 @@
</button>
<div class="col-sm-8" style="display: inline">
<div class="rdio rdio-default" style="display:inline;">
<input type="radio" name="target_operate_nginx" id="az2_target_operate_az1"
<input type="radio" name="target_operate_nginx" id="az2_target_operate_az1" secondgroup="az2"
value="az1" />
<label for="az2_target_operate_az1">az1</label>
</div>
<div class="rdio rdio-default" style="display:inline;margin-left:30px;">
<input type="radio" name="target_operate_nginx" id="az2_target_operate_az2"
<input type="radio" name="target_operate_nginx" id="az2_target_operate_az2" secondgroup="az2"
value="az2" />
<label for="az2_target_operate_az2">az2</label>
</div>
<div class="rdio rdio-default" style="display:inline;margin-left:30px;">
<input type="radio" name="target_operate_nginx" id="az2_target_operate_az3"
<input type="radio" name="target_operate_nginx" id="az2_target_operate_az3" secondgroup="az2"
value="az3" />
<label for="az2_target_operate_az3">az3</label>
</div>
... ... @@ -152,19 +152,19 @@
</button>
<div class="col-sm-8" style="display: inline">
<div class="rdio rdio-default" style="display:inline;">
<input type="radio" name="target_operate_nginx" id="az3_target_operate_az1"
<input type="radio" name="target_operate_nginx" id="az3_target_operate_az1" secondgroup="az3"
value="az1" />
<label for="az3_target_operate_az1">az1</label>
</div>
<div class="rdio rdio-default" style="display:inline;margin-left:30px;">
<input type="radio" name="target_operate_nginx" id="az3_target_operate_az2"
<input type="radio" name="target_operate_nginx" id="az3_target_operate_az2" secondgroup="az3"
value="az2" />
<label for="az3_target_operate_az2">az2</label>
</div>
<div class="rdio rdio-default" style="display:inline;margin-left:30px;">
<input type="radio" name="target_operate_nginx" id="az3_target_operate_az3"
<input type="radio" name="target_operate_nginx" id="az3_target_operate_az3" secondgroup="az3"
value="az3" />
<label for="az3_target_operate_az3">az3</label>
</div>
... ... @@ -186,7 +186,7 @@
</div>
<script src="<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"></script>
<script src="<%=basePath %>script/switch.js?v=20180528-003"></script>
<script src="<%=basePath %>script/switch.js?v=20180529-001"></script>
<script type="text/javascript">
$("#li_switch").addClass("active open");
... ...
... ... @@ -317,6 +317,76 @@ function resetLbNodeIp(node,data) {
}
}
/**
* "切向*"按钮点击事件,打开确认操作对话框
* @param cloudName 源中心名称
* @param target 目标中心名称
* @param onlineOrGray 切换:线上/灰度
*/
function nginxInitSwitch(cloudName) {
var target = $('input:radio[name=target_operate_nginx]:checked').val();
if(!target){
prompt("提示", "请选择目标nginx!");
return;
}
if(cloudName!=$('input:radio[name=target_operate_nginx]:checked').attr("secondgroup")){
prompt("提示", "请选择["+cloudName+"区]目标nginx!");
return;
}
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "你确定切换吗",
backdrop: "static",
content: "你确定要将 " + cloudName + " 上的lb " + "流量切向 " + target + " 吗?",
buttons: [{
text: "否",
className: "btn-danger",
onclick: function () {
dialog.dialog("hide");
}
}, {
text: "是",
className: "btn-success",
onclick: function () {
var param = {
cloudName: cloudName,
target: target
};
var layerMirror=layer.open( {
type:3,
//area: ['800px', '500px'],
content:"准备切换,请等待",
time: 0 //不自动关闭
});
$.ajax({
url: contextPath+'topoSwitch/switchLbWeight',
type: "post",
dataType: "json",
data: param ,
success: function (data) {
console.log(data);
if(data.code != 200){
layer.close(layerMirror);
alert(data.message);
}else{
window.location.href = contextPath + "topoSwitch/toTopoSwitch";
}
},
error: function (e) {
alert("系统错误");
}
});
dialog.dialog("hide");
}
}]
});
}
/**
* 创建lua切换按钮
... ... @@ -505,75 +575,7 @@ function switchSuccess() {
window.location.href = getUrlBasePath() + "/topoSwitch/toTopoSwitch";
}
/**
* "切向*"按钮点击事件,打开确认操作对话框
* @param cloudName 源中心名称
* @param target 目标中心名称
* @param onlineOrGray 切换:线上/灰度
*/
function nginxInitSwitch(cloudName, target, onlineOrGray) {
//var arr = getNoChangeIpArr(cloudName, onlineOrGray);
//if (undefined === arr || null === arr || 0 === arr.length) {
// prompt("提示", "无可切换的gateway!");
// return;
//}
var target = $('input:radio[name=target_operate_nginx]:checked').val();
if(!target){
prompt("提示", "请选择目标nginx!");
return;
}
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "你确定切换吗",
backdrop: "static",
content: "你确定要将 " + cloudName + " 上的lb " + "流量切向 " + target + " 吗?",
buttons: [{
text: "否",
className: "btn-danger",
onclick: function () {
dialog.dialog("hide");
}
}, {
text: "是",
className: "btn-success",
onclick: function () {
var param = {
cloudName: cloudName,
target: target
};
var layerMirror=layer.open( {
type:3,
//area: ['800px', '500px'],
content:"准备切换,请等待",
time: 0 //不自动关闭
});
$.ajax({
url: contextPath+'topoSwitch/switchLbWeight',
type: "post",
dataType: "json",
data: param ,
success: function (data) {
console.log(data);
if(data.code != 200){
layer.close(layerMirror);
alert(data.message);
}else{
window.location.href = contextPath + "topoSwitch/toTopoSwitch";
}
},
error: function (e) {
alert("系统错误");
}
});
dialog.dialog("hide");
}
}]
});
}
/**
* 打开对话框,展示切换后的配置
... ...