Skip to content

Commit

Permalink
#790 tidied up the detail panel so we sort the properties a little be…
Browse files Browse the repository at this point in the history
…tter; showing important stuff near the top; remove redundant properties
  • Loading branch information
jstrachan committed Dec 10, 2013
1 parent ae09e65 commit 6f9acde
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
8 changes: 0 additions & 8 deletions hawtio-web/src/main/webapp/app/fabric/html/brokerDiagram.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,6 @@
</div>
<div ng-show="viewSettings.panel" class="span4">
<div ng-show="selectedNode">
<dl class="dl-horizontal">
<dt>{{selectedNode.typeLabel}}:</dt>
<dd>{{selectedNode.name}}</dd>
</dl>
<dl ng-show="selectedNode.brokerName && selectedNode.type !== 'broker'" class="dl-horizontal">
<dt>Broker:</dt>
<dd>{{selectedNode.brokerName}}</dd>
</dl>
<dl ng-repeat="property in selectedNodeProperties" class="dl-horizontal">
<dt>{{property.key | humanize}}:</dt>
<dd>{{property.value}}</dd>
Expand Down
49 changes: 41 additions & 8 deletions hawtio-web/src/main/webapp/app/fabric/js/brokerDiagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,57 @@ module Fabric {
$scope.unregisterFn = Core.register(jolokia, $scope, {
type: 'read', mbean: mbean
}, onSuccess(renderNodeAttributes));
} else {
renderNodeAttributes({value: node.panelProperties || {}});
}
}
});

function getDestinationTypeName(attributes) {
var prefix = attributes["DestinationTemporary"] ? "Temporary " : "";
return prefix + (attributes["DestinationTopic"] ? "Topic" : "Queue");
}

var ignoreNodeAttributes = ["Connection", "DestinationName", "DestinationQueue", "DestinationTemporary", "DestinationTopic"];

function renderNodeAttributes(response) {
$scope.selectedNodeProperties = [];
var properties = [];
if (response) {
var value = response.value;
log.info("Got Node attributes! " + value);
log.info(angular.toJson(value));
var value = response.value || {};
$scope.selectedNodeAttributes = value;
var selectedNode = $scope.selectedNode || {};
var nodeType = selectedNode["type"];
var brokerName = selectedNode["brokerName"];
if (brokerName && nodeType !== "broker" && nodeType !== "brokerSlave") {
properties.splice(0, 0, {key: "Broker", value: brokerName});
}

angular.forEach(value, (v, k) => {
var formattedValue = humanizeValue(v);
$scope.selectedNodeProperties.push({key: k, value: formattedValue});
if (ignoreNodeAttributes.indexOf(k) < 0
&& (!brokerName || !k.startsWith("Broker"))
&& (nodeType !== "producer" || !k.startsWith("Producer"))) {
var formattedValue = humanizeValue(v);
properties.push({key: k, value: formattedValue});
}
});
$scope.selectedNodeProperties = $scope.selectedNodeProperties.sortBy("key");
Core.$apply($scope);
properties = properties.sortBy("key");


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 typeLabel = selectedNode["typeLabel"];
var name = selectedNode["name"] || selectedNode["id"] || selectedNode['objectName'];
if (typeLabel) {
properties.splice(0, 0, {key: typeLabel, value: name});
}
}
$scope.selectedNodeProperties = properties;
Core.$apply($scope);
}

$scope.$watch("searchFilter", (newValue, oldValue) => {
Expand Down

0 comments on commit 6f9acde

Please sign in to comment.