This commit is contained in:
Michael Andre Pearce 2018-11-09 14:43:34 +00:00
commit b3e767caec
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() {