Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#790 added a link to the destination so folks can quickly browse it o…
…r look at its attributes etc
  • Loading branch information
jstrachan committed Dec 11, 2013
1 parent 32011a1 commit 02490d7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
37 changes: 33 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/js/brokerDiagram.ts
Expand Up @@ -76,6 +76,21 @@ module Fabric {
}
};

$scope.connectToDestination = () => {
var selectedNode = $scope.selectedNode;
if (selectedNode) {
var container = selectedNode["brokerContainer"] || selectedNode;
var brokerName = selectedNode["brokerName"];
var destinationType = selectedNode["destinationType"];
var destinationName = selectedNode["destinationName"];
var postfix: string = null;
if (brokerName && destinationType && destinationName) {
postfix = "nid=root-org.apache.activemq-Broker-" + brokerName + "-" + destinationType + "-" + destinationName;
}
Fabric.connectToBroker($scope, container, postfix);
}
};

$scope.$on('$destroy', function (event) {
stopOldJolokia();
});
Expand Down Expand Up @@ -175,17 +190,20 @@ module Fabric {
}

var destinationName = value["DestinationName"] || selectedNode["destinationName"];
// TODO ignore for queue/topic
if (destinationName && (nodeType !== "queue" && nodeType !== "topic")) {
var destinationTypeName = getDestinationTypeName(value);
properties.splice(0, 0, {key: destinationTypeName, value: destinationName});
var html = createDestinationLink(destinationName, destinationTypeName);
properties.splice(0, 0, {key: destinationTypeName, value: html});
}


var typeLabel = selectedNode["typeLabel"];
var name = selectedNode["name"] || selectedNode["id"] || selectedNode['objectName'];
if (typeLabel) {
var typeProperty = {key: typeLabel, value: name};
var html = name;
if (nodeType === "queue" || nodeType === "topic") {
html = createDestinationLink(name, nodeType);
}
var typeProperty = {key: typeLabel, value: html};
if (isBroker && brokerProperty) {
typeProperty = brokerProperty;
}
Expand All @@ -196,6 +214,17 @@ module Fabric {
Core.$apply($scope);
}


/**
* Generates the HTML for a link to the destination
*/
function createDestinationLink(destinationName, destinationType = "queue") {
return $compile('<a target="destination" ng-click="connectToDestination()">' +
//'<img title="View destination" src="app/activemq/img/' + destinationType + '.png"> ' +
destinationName +
'</a>')($scope);
}

$scope.$watch("searchFilter", (newValue, oldValue) => {
redrawGraph();
});
Expand Down
5 changes: 4 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/js/fabricHelpers.ts
Expand Up @@ -1076,8 +1076,11 @@ module Fabric {
/**
* Connects to the broker in a new window
*/
export function connectToBroker($scope, container) {
export function connectToBroker($scope, container, postfix = null) {
var view = "/jmx/attributes?tab=activemq";
if (postfix) {
view += "&" + postfix;
}
$scope.doConnect(container, view);
}

Expand Down

0 comments on commit 02490d7

Please sign in to comment.