ARTEMIS-1825 Live-backup topology not correctly displayed on console

This commit is contained in:
Howard Gao 2018-04-26 22:31:46 +08:00 committed by Michael Andre Pearce
parent bd1777799a
commit ae320c14a5
2 changed files with 21 additions and 6 deletions

View File

@ -309,8 +309,10 @@ var ARTEMIS = (function(ARTEMIS) {
var properties = details['attributes'];
ARTEMIS.log.info("Got broker: " + objectName + " on container: " + containerId + " properties: " + angular.toJson(properties, true));
if (properties) {
var master = true;
var brokerId = properties["broker"] || "unknown";
var brokerName = artemisJmxDomain + ":broker=" + brokerId;
var backupRes = ARTEMISService.artemisConsole.isBackup(jolokia, brokerName);
var isBackup = backupRes.value;
var nodeId = val["NodeID"];
var theBroker = {
brokerId: brokerId,
@ -318,7 +320,7 @@ var ARTEMIS = (function(ARTEMIS) {
};
brokers.push(theBroker);
if ($scope.viewSettings.broker) {
var broker = getOrAddBroker(master, brokerId, nodeId, containerId, container, properties);
var broker = getOrAddBroker(!isBackup, brokerId, nodeId, containerId, container, properties);
}
}
}
@ -461,10 +463,18 @@ var ARTEMIS = (function(ARTEMIS) {
}
}
else {
var backup = remoteBroker.backup;
if (backup) {
getOrAddBroker(false, "\"" + remoteBroker.backup + "\"", remoteBroker.nodeID, "remote", null, properties);
addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.backup + "\"", "network");
var newBackReq = ARTEMISService.artemisConsole.isBackup(jolokia, mBean);
var newBackup = newBackReq.value;
if (!newBackup) {
if (remoteBroker.backup) {
getOrAddBroker(false, "\"" + remoteBroker.backup + "\"", remoteBroker.nodeID, "remote", null, properties);
addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.backup + "\"", "network");
}
}
else {
//I am backup
getOrAddBroker(true, "\"" + remoteBroker.live + "\"", remoteBroker.nodeID, "remote", null, properties);
addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.live + "\"", "network");
}
}
}

View File

@ -75,6 +75,11 @@ function ArtemisConsole() {
//simple return unescape(name); does not work for this :(
return name.replace(/\\\\/g, "\\").replace(/\\\*/g, "*").replace(/\\\?/g, "?");
};
this.isBackup = function (jolokia, mBean) {
var req1 = { type: "read", mbean: mBean, attribute: "Backup"};
return jolokia.request(req1, {method: "get"});
};
}
function getServerAttributes() {