...
|
...
|
@@ -74,9 +74,7 @@ |
|
|
|
|
|
<style>
|
|
|
.node-container{
|
|
|
//position: relative;
|
|
|
//position: absolute;
|
|
|
z-index: 9999;
|
|
|
z-index: 10;
|
|
|
width: 300px;
|
|
|
height: 106px;
|
|
|
border: 1px solid #999;
|
...
|
...
|
@@ -102,8 +100,7 @@ |
|
|
<h5>MHA拓扑</h5>
|
|
|
</div>
|
|
|
<div class="widget-content nopadding">
|
|
|
<div class="panel-body" id="mhaTopoDiv">
|
|
|
</div>
|
|
|
<div id="mhaTopoDiv" ></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -162,15 +159,6 @@ |
|
|
|
|
|
|
|
|
if(model.serverNode){
|
|
|
/* var title = Util.createDOM('<div class="widget-title" style="background-image:none!important;background-color:#ddd;height: 36px;"></div>');
|
|
|
title.appendChild(Util.createDOM('<h5>'+model.label+'</h5>'));
|
|
|
var a = Util.createDOM('<a href="#" onclick="alert(1)" style="float:right;margin-right: 10px;"><H5 style="padding-right:0px;padding-left:0px;"><span class="glyphicon glyphicon-info-sign"></span></H5></a>');
|
|
|
title.appendChild(a);
|
|
|
if(model.seqNO==0){
|
|
|
//container.appendChild(title);
|
|
|
}*/
|
|
|
|
|
|
|
|
|
var colorBadge="#4169E1";
|
|
|
if(model.badge=="crash"){
|
|
|
colorBadge= "#D1841C";//"#F90426";
|
...
|
...
|
@@ -182,20 +170,25 @@ |
|
|
|
|
|
//header
|
|
|
var headBtnDiv=Util.createDOM('<div style="margin:0px;border:0px;padding: 3px;float:right;"></div>');
|
|
|
var btn_info = Util.createDOM('<a href="#" onclick="alert(1)" style="float:right;margin: 3px;"><span class="glyphicon glyphicon-info-sign"></span></a>');
|
|
|
|
|
|
var btn_info_str='<a href="#" onclick="nodeInfo(\''+model.cfgName+'\',\''+model.hostname+'\',\''+model.port+'\')" ' +
|
|
|
'style="float:right;margin: 3px;"><span class="glyphicon glyphicon-info-sign"></span></a>';
|
|
|
var btn_info = Util.createDOM(btn_info_str);
|
|
|
headBtnDiv.appendChild(btn_info);
|
|
|
header.appendChild(headBtnDiv);
|
|
|
if(model.seqNO==1){
|
|
|
var t=Util.createDOM('<div style="background-color:#E5E5E5;padding: 5px 10px;border-bottom: 1px solid #999"><span style="font-size:12px;font-weight:bold;">'+model.label+'</span></div>');
|
|
|
header.appendChild(t);
|
|
|
}
|
|
|
//if(model.seqNO==1){
|
|
|
var t=Util.createDOM('<div style="height:30px;background-color:#E5E5E5;padding: 5px 10px;border-bottom: 1px solid #999"><span style="font-size:12px;font-weight:bold;">'+model.label+'</span></div>');
|
|
|
header.appendChild(t);
|
|
|
//}
|
|
|
|
|
|
//content
|
|
|
/* var hostInfo = Util.createDOM(
|
|
|
'<div>'
|
|
|
+'<span class="badge" style="margin-right:5px;background-color:'+colorBadge+';font-weight:normal;">'+model.badge+'</span>'
|
|
|
+'<br/>'
|
|
|
+model.hostname+' '+model.port
|
|
|
+'</div>');*/
|
|
|
if(model.hostname){
|
|
|
var hostInfo = Util.createDOM(
|
|
|
'<span style="margin-right: 50px;">'
|
|
|
+model.hostname+':'+model.port
|
|
|
+'</span>');
|
|
|
headBtnDiv.appendChild(hostInfo);
|
|
|
}
|
|
|
|
|
|
var tags=Util.createDOM(
|
|
|
'<div>'
|
...
|
...
|
@@ -206,15 +199,12 @@ |
|
|
var healthyTag=Util.createDOM('<span class="badge" style="background-color:green;font-weight:normal;margin-left:3px;">healthy</span>');
|
|
|
tags.appendChild(healthyTag);
|
|
|
}
|
|
|
var hostInfo = Util.createDOM(
|
|
|
'<div>'
|
|
|
+model.hostname+' '+model.port
|
|
|
+'</div>');
|
|
|
content.appendChild(tags);
|
|
|
content.appendChild(hostInfo);
|
|
|
|
|
|
|
|
|
if(model.seqNO==1&&model.badge!="crash"){
|
|
|
var a = Util.createDOM('<button onclick="alert(1)" class="btn btn-danger btn-sm" style="float:right;">卸载</button>');
|
|
|
var a = Util.createDOM('<button onclick="downNode(\''+model.cfgName+'\',\''+model.hostname+'\',\''+model.port+'\')" ' +
|
|
|
'class="btn btn-danger btn-sm" style="float:right;margin-top: 16px;">卸载</button>');
|
|
|
content.appendChild(a);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -232,6 +222,52 @@ |
|
|
return container;
|
|
|
}
|
|
|
|
|
|
function nodeInfo(cfgName,ip,port) {
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
dialog.dialog({
|
|
|
height:"400px",
|
|
|
// width:"300px",
|
|
|
size : "modal-md",
|
|
|
title : cfgName+" [" + ip+":"+port + "]" ,
|
|
|
backdrop : "static",
|
|
|
//href : "toEditHostInfos",
|
|
|
buttons : [{
|
|
|
text : "关闭",
|
|
|
className : "btn-danger",
|
|
|
onclick : function() {
|
|
|
$(dialog).dialog("hide");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function downNode(cfgName,ip,port) {
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
dialog.dialog({
|
|
|
title: "确认",
|
|
|
backdrop: "static",
|
|
|
content: "你确定要将 "+cfgName+" 的当前 master [" + ip+":"+port + "] 下线吗?",
|
|
|
buttons: [{
|
|
|
text: "否",
|
|
|
className: "btn-danger",
|
|
|
onclick: function () {
|
|
|
dialog.dialog("hide");
|
|
|
}
|
|
|
}, {
|
|
|
text: "是",
|
|
|
className: "btn-success",
|
|
|
onclick: function () {
|
|
|
var param = {
|
|
|
|
|
|
};
|
|
|
alert("开发中。。。");
|
|
|
dialog.dialog("hide");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function createTopo(data) {
|
|
|
|
|
|
// 第二步:注册节点
|
...
|
...
|
|