...
|
...
|
@@ -3,49 +3,39 @@ $(function () { |
|
|
});
|
|
|
|
|
|
function initSwitch(cloudName,target){
|
|
|
$("input[name='ticket']").val("");
|
|
|
var param = {
|
|
|
cloudName:cloudName,
|
|
|
target:target
|
|
|
}
|
|
|
$.ajax({
|
|
|
type : 'post',
|
|
|
url : 'switchbefore',
|
|
|
data : param,
|
|
|
dataType : 'text',
|
|
|
success : function(resp) {
|
|
|
var data = JSON.parse(resp);
|
|
|
if(data.code=="201"){
|
|
|
layer.msg("Token异常", {icon: 2});
|
|
|
}else{
|
|
|
$("input[name='token']").val(data.data);
|
|
|
$("#validateToken").modal('show');
|
|
|
$("#validateTokenRltInfo").hide();
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
dialog.dialog({
|
|
|
title: "你确定切换吗",
|
|
|
backdrop: "static",
|
|
|
content: "你确定要将"+cloudName +"上的流量切向"+target +"吗?",
|
|
|
buttons: [{
|
|
|
text: "否",
|
|
|
className: "btn-danger",
|
|
|
onclick: function () {
|
|
|
$(dialog).dialog("hide");
|
|
|
}
|
|
|
},
|
|
|
error : function(data) {
|
|
|
layer.msg("Token异常", {icon: 2});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function switchNginxConf(){
|
|
|
$.ajax({
|
|
|
type : 'post',
|
|
|
url : 'switchNginxConf',
|
|
|
data : $('#tokenForm').serialize(),
|
|
|
dataType : 'text',
|
|
|
success : function(resp) {
|
|
|
var data = JSON.parse(resp);
|
|
|
if(data.code=="201"){
|
|
|
$("#validateTokenRltInfo").show();
|
|
|
}else{
|
|
|
window.location.href= getUrlBasePath() + "/nginxswitch/toNginxSwitch";
|
|
|
}, {
|
|
|
text: "是",
|
|
|
className: "btn-success",
|
|
|
onclick: function () {
|
|
|
var param = {
|
|
|
cloudName:cloudName,
|
|
|
target:target
|
|
|
}
|
|
|
$.ajax({
|
|
|
type : 'post',
|
|
|
url : 'switchNginxConf',
|
|
|
data : param,
|
|
|
dataType : 'text',
|
|
|
success : function(resp) {
|
|
|
window.location.href= getUrlBasePath() + "/nginxswitch/toNginxSwitch";
|
|
|
},
|
|
|
error : function(data) {
|
|
|
layer.msg("Token异常", {icon: 2});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
error : function(data) {
|
|
|
$("#validateTokenRltInfo").hide();
|
|
|
layer.msg("切换失败", {icon: 2});
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|