Authored by zhengyouwei

update centerswitch

... ... @@ -14,6 +14,4 @@ public class CenterSwitchModel {
private String exe;
private String toCloud;
}
... ...
... ... @@ -78,6 +78,36 @@
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog" style="margin-top: 5%;
margin-left: auto;
height:50.333%;
width: 60%;
overflow:scroll;
overflow-x:auto;
overflow-y:auto ">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body">
<div id="check_result_div" style="">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script type="text/javascript">
$("#li_switch").addClass("active open");
... ... @@ -99,36 +129,54 @@
columns: [{
title: "切换项",
field: "cName",
width: "20%"
width: "15%"
}, {
title: "切向QQ",
field: "name",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
$("<button onclick=\"doExe(\'" + value + "\',\'qcloud\')\">").addClass("btn btn-primary").html("切换").appendTo(div);
$("<button onclick=\"doExe(\'" + value + "\',\'beforeCheck\')\">").addClass("btn btn-xs btn-success").html("前检测").appendTo(div);
div.append("&nbsp;");
$("<button onclick=\"toDoExe(\'" + value + "\',\'toQcloud\')\">").addClass("btn btn-primary").html("切换").appendTo(div);
div.append("&nbsp;");
$("<button onclick=\"doExe(\'" + value + "\',\'afterCheck\')\">").addClass("btn btn-xs btn-success").html("后检测").appendTo(div);
return div;
},
width: "40%"
width: "35%"
},{
title: "切回AWS",
field: "name",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
$("<button onclick=\"doExe(\'" + value + "\',\'aws\')\">").addClass("btn btn-primary").html("切换").appendTo(div);
$("<button onclick=\"doExe(\'" + value + "\',\'afterCheck\')\">").addClass("btn btn-xs btn-success").html("前检测").appendTo(div);
div.append("&nbsp;");
$("<button onclick=\"toDoExe(\'" + value + "\',\'toAws\')\">").addClass("btn btn-primary").html("切换").appendTo(div);
div.append("&nbsp;");
$("<button onclick=\"doExe(\'" + value + "\',\'beforeCheck\')\">").addClass("btn btn-xs btn-success").html("后检测").appendTo(div);
return div;
},
width: "40%"
width: "35%"
},{
title: "状态查看",
field: "name",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
$("<button onclick=\"doExe(\'" + value + "\',\'status\')\">").addClass("btn btn-primary").html("当前状态").appendTo(div);
return div;
},
width: "35%"
}]
});
});
//执行切换
function doExe(name, toCloud) {
function toDoExe(name, toCloud) {
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "切换确定",
backdrop: "static",
content: "name:"+name+" 切向:"+toCloud,
content: "name:"+name+" exe:"+toCloud,
buttons: [{
text: "否",
className: "btn-danger",
... ... @@ -140,11 +188,51 @@
className: "btn-success",
onclick: function () {
$(dialog).dialog("hide");
window.open(contextPath + "centerSwitch/todoExe?name=" + name + "&toCloud=" + toCloud, "_self");
doExe(name,toCloud);
}
}]
});
}
//执行切换
function doExe(name, exe) {
var jq = $("#switchTable");
$.ajax({
type: 'post',
url: contextPath + "/centerSwitch/doExe",
data:{
'name':name,
'exe':exe
},
dataType: 'json',
beforeSend:function(){
var div = $("<div>").attr("tableSelector", jq.selector).addClass("modal-backdrop fade in").appendTo($("body")).hide();
var tableOffset = jq.offset();
var tableWidth = jq.outerWidth(true), tableHeight = jq.outerHeight(true);
div.append($("<div>").addClass("table-loading").css({
left : (tableWidth - 124) / 2,
top : (tableHeight - 124) / 2
}));
div.css({
width : tableWidth,
height : tableHeight,
left : tableOffset.left,
top : tableOffset.top
});
div.show();
},
success: function (resp) {
$("body").find("div[tableSelector='"+ jq.selector +"']").remove();
$("#check_result_div").html(resp.data);
$("#myModalLabel").text("name:"+name+" exe:"+exe);
$("#myModal").modal('show');
},
error: function (resp) {
}
});
}
</script>
 
\ No newline at end of file
... ...
... ... @@ -100,10 +100,10 @@
url: contextPath + "/centerSwitch/doExe",
data:{
'name':name,
'toCloud':toCloud
'exe':toCloud
},
dataType: 'json',
beforeSend:function(XMLHttpRequest){
beforeSend:function(){
var div = $("<div>").attr("tableSelector", jq.selector).addClass("modal-backdrop fade in").appendTo($("body")).hide();
var tableOffset = jq.offset();
var tableWidth = jq.outerWidth(true), tableHeight = jq.outerHeight(true);
... ... @@ -129,12 +129,12 @@
});
// document.onkeydown = function()
// {
// if(event.keyCode==116 || event.keyCode==8 || (event.ctrlKey && event.keyCode==82) || event.keyCode == 13) {
// event.keyCode=0;
// event.returnValue = false;
// }
// }
// document.oncontextmenu = function() {event.returnValue = false;}
document.onkeydown = function()
{
if(event.keyCode==116 || event.keyCode==8 || (event.ctrlKey && event.keyCode==82) || event.keyCode == 13) {
event.keyCode=0;
event.returnValue = false;
}
}
document.oncontextmenu = function() {event.returnValue = false;}
</script>
\ No newline at end of file
... ...
... ... @@ -62,7 +62,7 @@ innerHTML += "<li id='li_projectHistory'><a id='li_projectHistory_a' href=''><i
innerHTML += "</ul></li>";
/*switch*/
innerHTML += "<li class='submenu' id='li_switch'><a id='li_switch_a' href='#'><i class='icon icon-th-list'></i> <span>关键切换</span><span class='label'>3</span></a>";
innerHTML += "<li class='submenu' id='li_switch'><a id='li_switch_a' href='#'><i class='icon icon-th-list'></i> <span>关键切换</span><span class='label'>4</span></a>";
innerHTML += "<ul><li id='li_nginxswitch'><a id='li_nginxswitch_a' href=''>nginx切换</a></li>";
innerHTML += "<li id='li_luaswitch'><a id='li_luaswitch_a' href='#'>LUA切换</a></li>";
innerHTML += "<li id='li_javarestart'><a id='li_javarestart_a' href='#'>java重启</a></li>";
... ...