Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
buildNodeCtrlPanel:function(nodeObj) {
if(UserFilterCache.nomapping){
return;//权限设置
}
var sb=new StringBuffer();
var nodeCtrlUrl=this.getNodeCtrlUrl(nodeObj);
var nodeObjStr=StringHelper.obj2str({id:nodeObj["id"],name:nodeObj["name"],url:nodeCtrlUrl,ip:nodeObj["ip"],pid:nodeObj["node.pid"],pname:nodeObj["name"],profile:nodeObj["node.profile"],
version:nodeObj["node.version"] == undefined ? "UNKNOW" : nodeObj["node.version"],nodeRoot:nodeObj["node.root"],
dockerContainer:nodeObj["node.docker.container"] == undefined ? "{}" : nodeObj["node.docker.container"]});
//权限设置
var groupName = nodeObj.group;
var ctrlAuthor = false;
if(UserFilterCache.ctrls[groupName]!=undefined && UserFilterCache.ctrls[groupName]["nodectrl"] !=undefined && UserFilterCache.ctrls[groupName]["nodectrl"]=="T"){
ctrlAuthor=true;
}
if(UserFilterCache.all || ctrlAuthor){
//设置系统属性
sb.append("<button class="\"btn">修改属性</button>");
//重启Node
sb.append(" <button class="\"btn">配置管理</button>");
sb.append(" <button class="\"btn">重启节点</button>");
buildUContainerDetail:function(ip) {
var dObj=app.mdata("macinfo")[ip];
//node info
var nodes=app.mdata("nodeinfo");
var maNodeInfo;
var nodeObj;
for (var nodeKey in nodes) {
var aNodeObj=nodes[nodeKey];
if (aNodeObj["ip"]==ip) {
if (aNodeObj["node.profile"].indexOf("ma")==0||aNodeObj["name"]=="监控代理程序") {
maNodeInfo=aNodeObj;
continue;
}
if (aNodeObj["node.profile"].indexOf("ua")==0||aNodeObj["name"]=="Ultron代理程序") {
nodeObj=aNodeObj;
}
}
}
//detail
var divContent=this.buildUContainerDetailTopContent(nodeObj);
var handler=function(containerObj) {
//we should deliver the maNodeInfo to the process info panel as we need ctrl the process via MonitorAgent
divContent+=app.controller.buildUContainerDetailInfo(containerObj,nodeObj,maNodeInfo);
buildUContainerDetail:function(ip) {
var dObj=app.mdata("macinfo")[ip];
//node info
var nodes=app.mdata("nodeinfo");
var maNodeInfo;
var nodeObj;
for (var nodeKey in nodes) {
var aNodeObj=nodes[nodeKey];
if (aNodeObj["ip"]==ip) {
if (aNodeObj["node.profile"].indexOf("ma")==0||aNodeObj["name"]=="监控代理程序") {
maNodeInfo=aNodeObj;
continue;
}
if (aNodeObj["node.profile"].indexOf("ua")==0||aNodeObj["name"]=="Ultron代理程序") {
nodeObj=aNodeObj;
}
}
}
//detail
var divContent=this.buildUContainerDetailTopContent(nodeObj);
var handler=function(containerObj) {
//we should deliver the maNodeInfo to the process info panel as we need ctrl the process via MonitorAgent
divContent+=app.controller.buildUContainerDetailInfo(containerObj,nodeObj,maNodeInfo);
};
this.handleContainer(nodeObj,handler);
divContent+=this.buildMacDetailEndContent();
buildMacDetail:function(ip) {
var dObj=app.mdata("macinfo")[ip];
//detail
var divContent=this.buildMacDetailTopContent(dObj);
//node info
var nodes=app.mdata("nodeinfo");
//the monitoragent node info
var maNodeInfo;
for (var nodeKey in nodes) {
var nodeObj=nodes[nodeKey];
if (nodeObj["ip"]==ip) {
divContent+=this.buildMacDetailNodeInfo(nodeObj);
if (nodeObj["node.profile"].indexOf("ma")==0||nodeObj["name"]=="监控代理程序") {
maNodeInfo=nodeObj;
}
}
}
//process info
var procs=eval("("+dObj["node.procs"]+")");
var handler=function(proc) {
//we should deliver the maNodeInfo to the process info panel as we need ctrl the process via MonitorAgent
divContent+=app.controller.buildMacProcessInfo(proc,maNodeInfo);
};
this.handleProcess(procs,handler);
divContent+=this.buildMacDetailEndContent();
return divContent;
buildMacDetailNodeInfo : function(jsonObj){
var str= " <div class="\"contentDiv\""><div class="\"shine2\""></div>" +
" <span class="\"title\"">节点进程</span><span style="font-size:14px;color:#bbbbbb;">["+jsonObj["id"]+"]</span><span class="\"timeTitle\"">"+TimeHelper.getTime(jsonObj["clientTimestamp"])+"</span><br>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">名称</span><span>:</span>"+jsonObj["name"] +" <span style="font-size:14px;color:#bbbbbb;">["+jsonObj["node.pid"]+"]</span>"+
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">组</span><span>:</span>"+jsonObj["group"] +
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">配置</span><span>:</span>"+jsonObj["node.profile"] +
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">能力</span><span>:</span>"+this.formatter.feature(jsonObj["node.feature"],jsonObj) +
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">Http服务</span><span>:</span>"+this.formatter.services(jsonObj["node.services"]) +
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">所属心跳地址</span><span>:</span>"+jsonObj["node.hbserver"] +
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">路径</span><span>:</span>"+jsonObj["node.root"] +
" </div>" +
" <div class="\"kv\"">" +
" <span class="\"kvField\"">版本</span><span>:</span>"+jsonObj["node.version"] +
" </div>" +</div>