Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#790 - add a bit more colour and css class names on the nodes so we c…
…an more easily grok what is a consumer/producer/topic/queue/broker
  • Loading branch information
jstrachan committed Nov 28, 2013
1 parent ff2dd17 commit db6cb1e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
14 changes: 13 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/html/brokerDiagram.html
Expand Up @@ -162,8 +162,20 @@
stroke: #ccc;
}

circle.topic {
fill: #c0c;
}

circle.queue {
fill: #00c;
}

circle.consumer {
fill: #cfc;
}

path.link.producer {
stroke: #ccc;
stroke: #ccf;
}

path.link.consumer {
Expand Down
19 changes: 15 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/js/brokerDiagram.ts
Expand Up @@ -10,6 +10,16 @@ module Fabric {
Core.register(jolokia, $scope, {type: 'exec', mbean: Fabric.mqManagerMBean, operation: "loadBrokerStatus()"}, onSuccess(onBrokerData));
}

/**
* Avoid the JMX type property clashing with the ForceGraph type property; used for associating css classes with nodes on the graph
*
* @param properties
*/
function renameTypeProperty(properties) {
properties.mbeanType = properties['type'];
delete properties['type'];
}

function onBrokerData(response) {
if (response) {
var responseJson = angular.toJson(response.value);
Expand All @@ -29,9 +39,9 @@ module Fabric {
angular.forEach(brokers, (brokerStatus) => {
// only query master brokers which are provisioned correctly
brokerStatus.validContainer = brokerStatus.alive && brokerStatus.master && brokerStatus.provisionStatus === "success";

// don't use type field so we can use it for the node types..
renameTypeProperty(brokerStatus);
log.info("Broker status: " + angular.toJson(brokerStatus, true));

function getOrAddNode(typeName:string, id, properties, createFn) {
var node = null;
if (id) {
Expand Down Expand Up @@ -142,14 +152,15 @@ module Fabric {
container.jolokia = containerJolokia;

function configureDestinationProperties(properties) {
renameTypeProperty(properties);
var destinationType = properties.destinationType || "Queue";
var typeName = destinationType.toLowerCase();
properties.isQueue = !typeName.startsWith("t");
properties['type'] = typeName;
properties['destType'] = typeName;
}

function getOrAddDestination(properties) {
var typeName = properties['type'];
var typeName = properties.destType
var destinationName = properties.destinationName;
return getOrAddNode(typeName, destinationName, properties, () => {
return {
Expand Down

0 comments on commit db6cb1e

Please sign in to comment.