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']; var properties = details['attributes'];
ARTEMIS.log.info("Got broker: " + objectName + " on container: " + containerId + " properties: " + angular.toJson(properties, true)); ARTEMIS.log.info("Got broker: " + objectName + " on container: " + containerId + " properties: " + angular.toJson(properties, true));
if (properties) { if (properties) {
var master = true;
var brokerId = properties["broker"] || "unknown"; 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 nodeId = val["NodeID"];
var theBroker = { var theBroker = {
brokerId: brokerId, brokerId: brokerId,
@ -318,7 +320,7 @@ var ARTEMIS = (function(ARTEMIS) {
}; };
brokers.push(theBroker); brokers.push(theBroker);
if ($scope.viewSettings.broker) { 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 { else {
var backup = remoteBroker.backup; var newBackReq = ARTEMISService.artemisConsole.isBackup(jolokia, mBean);
if (backup) { var newBackup = newBackReq.value;
getOrAddBroker(false, "\"" + remoteBroker.backup + "\"", remoteBroker.nodeID, "remote", null, properties); if (!newBackup) {
addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.backup + "\"", "network"); 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 :( //simple return unescape(name); does not work for this :(
return name.replace(/\\\\/g, "\\").replace(/\\\*/g, "*").replace(/\\\?/g, "?"); 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() { function getServerAttributes() {