0.11.5.source-code.base.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zbus Show documentation
Show all versions of zbus Show documentation
a lightweight yet powerful MQ and RPC to build service bus
function httpFullAddress(serverAddress){
var scheme = "http://"
if(serverAddress.sslEnabled){
scheme = "https://"
}
return scheme + serverAddress.address;
}
function containsServerAddress(serverList, address){
for(var i in serverList){
var serverAddress = serverList[i];
if(serverAddress.address == address.address && serverAddress.sslEnabled == address.sslEnabled){
return true;
}
}
return false;
}
function serverTopicList(topicTable){
var res = "";
var keys = Object.keys(topicTable);
keys.sort();
for(var i in keys){
res += "" + keys[i] + "";
}
return res;
}
function showServerTable(serverInfoTable, filterServerList, trackerAddress){
$("#server-list").find("tr:gt(0)").remove();
var serverList = [];
for(var key in serverInfoTable){
serverList.push(key);
}
serverList.sort();
for(var i in serverList){
var server = serverList[i];
var serverInfo = serverInfoTable[server];
var serverAddress = serverInfo.serverAddress;
var topicList = serverTopicList(serverInfo.topicTable);
var checked ="checked=checked";
if(!containsServerAddress(filterServerList, serverAddress)){
checked = "";
}
var tag = "";
if(trackerAddress && serverAddress.address == trackerAddress.address){
tag = "*";
}
var fullAddr = httpFullAddress(serverAddress);
$("#server-list").append(
"\
\
" + serverAddress.address + ""+ tag + "\
\
\
\
\
" + serverInfo.serverVersion + " \
" + serverInfo.infoVersion + " \
\
" + hashSize(serverInfo.topicTable) + "" + topicList + "\
\
"
);
}
}
function consumeGroupList(groupList){
groupList.sort(function(g1, g2){
if (g1.groupName < g2.groupName) return -1;
if (g1.groupName > g2.groupName) return 1;
return 0;
});
var res = "";
for(var i in groupList){
var group = groupList[i];
res += "";
res += "" + group.groupName + "\
";
var numClass = "";
if (group.messageCount > 0) {
numClass = "num";
}
res += "" + group.messageCount + " ";
res += "" + group.consumerCount + " ";
res += "" + (group.filter || "") + " ";
res += " "
}
return res;
}
function topicServerList(topicInfoList, filterServerList){
var res = "";
topicInfoList.sort(function(a,b){return a.serverAddress.address >= b.serverAddress.address;});
for(var i in topicInfoList){
var topicInfo = topicInfoList[i];
var linkAddr = topicInfo.serverAddress;
var linkFullAddr = httpFullAddress(linkAddr);
if(!containsServerAddress(filterServerList, linkAddr)){
continue;
}
var mask = topicInfo.mask;
var maskLabel = "";
if(mask & Protocol.MASK_MEMORY){
maskLabel += "mem";
} else {
maskLabel += "disk";
}
var url = httpFullAddress(topicInfo.serverAddress) + "/" + topicInfo.topicName;
if(mask & Protocol.MASK_RPC){
maskLabel += "rpc";
}
if(mask & Protocol.MASK_PROXY){
maskLabel += "proxy";
}
res += "";
//link td
res += "" + linkAddr.address + "" +
maskLabel + " ";
//message depth td
res += "" + topicInfo.messageDepth + " ";
//consume group td
res += " " + consumeGroupList(topicInfo.consumeGroupList) + "
";
res += " ";
}
return res;
}
function showTopicTable(topicTable, filterServerList){
$("#topic-list").find("tr:gt(2)").remove();
var topics = [];
for(var key in topicTable){
topics.push(key);
}
topics.sort();
for(var i in topics){
var topicName = topics[i];
var topicInfoList = topicTable[topicName];
var serverList = topicServerList(topicInfoList, filterServerList);
if(!serverList) continue;
$("#topic-list").append(
"\
" + topicName + "\
\
\
\
"+ serverList + "
\
"
);
//\
}
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy