Authored by xuhui

双中心切换添加java服务重启功能

... ... @@ -172,6 +172,7 @@
//执行切换
function toDoExe(toCloud) {
switchWait = null;
$("input[name='cloud_name']").val(toCloud);
$("input[name='sms_name']").val('');
$.ajax({
... ... @@ -203,14 +204,8 @@
for (var i = 0; i < array.length; i++) {
$("#" + array[i] + "-btn").removeClass("btn-success");
}
var wait = toWait("正在切换,请耐心等候...");
doExe(array, 0, toCloud);
wait.modal('hide');
var wait1 = toWait("正在重启java,请耐心等候...");
//最后一步重启java
javaRestart(toCloud);
wait1.modal('hide');
doExe(array, 0, toCloud);
}else{
alert("短信验证码错误或者失效");
}
... ... @@ -220,8 +215,12 @@
});
}
var switchWait;
//执行切换
function doExe(array, i,commond) {
if(switchWait==null || switchWait== undefined){
switchWait = toWait("正在切换,请耐心等候...");
}
var name = array[i];
$("#"+name+"-btn").addClass("btn-warning");
$.ajax({
... ... @@ -232,7 +231,6 @@
'exe': commond
},
dataType: 'json',
async: false,
success: function (resp) {
$("#"+name+"-btn").removeClass("btn-warning");
$("#"+name+"-btn").addClass("btn-success");
... ... @@ -243,14 +241,24 @@
i++;
if(i < array.length){
doExe(array,i,commond);
}else{
switchWait.modal('hide');
//最后一步重启java
javaRestart(toCloud);
}
},
error: function () {
var div = "<div>切换请求异常</div>";
$("#detail-div").append(div);
switchWait.modal('hide');
}
});
}
function javaRestart(toCloud){
var wait = toWait("正在重启java,请耐心等候...");
var commond;
if(toCloud="toAws"){
commond="aws";
... ... @@ -267,7 +275,6 @@
'project': 'all'
},
dataType: 'json',
async: false,
success: function (data) {
$("#java-btn").removeClass("btn-warning");
$("#java-btn").addClass("btn-success");
... ... @@ -276,10 +283,14 @@
div = div + "<h4 class=\"alert-heading\">java重启:</h4>";
div = div + "成功</div>";
$("#detail-div").append(div);
wait.modal('hide');
},
error: function () {
var div = "<div>重启java请求异常</div>";
$("#detail-div").append(div);
wait.modal('hide');
}
});
}
... ... @@ -288,15 +299,15 @@
var wait = toWait("正在检查状态,请耐心等候...");
$("#detail-div").empty();
for (var i = 0; i < array.length; i++) {
var name=array[i];
$.ajax({
type: 'post',
url: contextPath + "/centerSwitch/checkStatus",
data: {
'name': array[i],
'name': name,
'exe': 'status'
},
dataType: 'json',
async: false,
success: function (data) {
if (!data || data.code != 200) {
var div = "<h4 class=\"alert-heading\">"+data.message+"</h4>";
... ... @@ -304,17 +315,20 @@
return;
}
var div = "<div class=\"alert alert-info alert-block\">";
div = div + "<h4 class=\"alert-heading\">" + array[i] + "</h4>";
div = div + "<h4 class=\"alert-heading\">" + name + "</h4>";
div = div + data.data + "</div>";
$("#detail-div").append(div);
wait.modal('hide');
},
error: function () {
var div = "<div>查看状态请求异常</div>";
$("#detail-div").append(div);
wait.modal('hide');
}
});
}
wait.modal('hide');
}
function toWait(content) {
... ...