-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial spike of #790 - needs some CSS polish and so far only shows t…
…he groups / profiles / brokers / containers; doens't show clients/producers/consumers
- Loading branch information
Showing
4 changed files
with
236 additions
and
2 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
hawtio-web/src/main/webapp/app/fabric/html/brokerDiagram.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<style type="text/css"> | ||
|
||
div#pop-up { | ||
display: none; | ||
position:absolute; | ||
color: white; | ||
font-size: 14px; | ||
background: rgba(0,0,0,0.6); | ||
padding: 5px 10px 5px 10px; | ||
-moz-border-radius: 8px 8px; | ||
border-radius: 8px 8px; | ||
} | ||
|
||
div#pop-up-title { | ||
font-size: 15px; | ||
margin-bottom: 4px; | ||
font-weight: bolder; | ||
} | ||
div#pop-up-content { | ||
font-size: 12px; | ||
} | ||
|
||
rect.graphbox { | ||
fill: #DDD; | ||
} | ||
|
||
rect.graphbox.frame { | ||
stroke: #222; | ||
stroke-width: 2px | ||
} | ||
|
||
path.link { | ||
fill: none; | ||
stroke: #666; | ||
stroke-width: 1.5px; | ||
} | ||
|
||
path.link.group { | ||
} | ||
|
||
path.link.broker { | ||
stroke: #444; | ||
} | ||
|
||
path.link.container { | ||
stroke-dasharray: 0,2 1; | ||
} | ||
|
||
circle { | ||
fill: #black; | ||
} | ||
|
||
circle.service { | ||
fill: blue; | ||
} | ||
|
||
circle.bundle { | ||
fill: black; | ||
} | ||
|
||
circle.package { | ||
fill: gray; | ||
} | ||
|
||
text { | ||
font: 10px sans-serif; | ||
pointer-events: none; | ||
} | ||
|
||
text.shadow { | ||
stroke: #fff; | ||
stroke-width: 3px; | ||
stroke-opacity: .8; | ||
} | ||
|
||
</style> | ||
|
||
|
||
<div class="row-fluid mq-page" ng-controller="Fabric.FabricBrokerDiagramController"> | ||
|
||
<div ng-hide="inDashboard" class="span12 page-padded"> | ||
<div class="section-header"> | ||
|
||
<div class="section-filter"> | ||
<input type="text" class="search-query" placeholder="Filter..." ng-model="searchFilter"> | ||
<i class="icon-remove clickable" title="Clear Filter" ng-click="searchFilter = ''"></i> | ||
</div> | ||
|
||
<div class="section-controls"> | ||
<a ng-href="#/fabric/mq/brokers{{hash}}" title="View the broker and container diagram"> | ||
<i class="icon-edit"></i> Configuration | ||
</a> | ||
<a href="" title="Create a new broker configuration" ng-click="createBroker(null)"> | ||
<i class="icon-plus"></i> Broker | ||
</a> | ||
<a href="" title="Create a new container" ng-click="createContainer()"> | ||
<i class="icon-plus"></i> Container | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div id="pop-up"> | ||
<div id="pop-up-title"></div> | ||
<div id="pop-up-content"></div> | ||
</div> | ||
|
||
<div class="row-fluid"> | ||
<div class="span12 canvas"> | ||
<div hawtio-force-graph graph="graph" link-distance="100" charge="-300" nodesize="10" style="min-height: 800px"></div> | ||
</div> | ||
</div> | ||
|
||
<div ng-include="'app/fabric/html/connectToContainerDialog.html'"></div> | ||
|
||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
hawtio-web/src/main/webapp/app/fabric/js/brokerDiagram.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
module Fabric { | ||
|
||
export function FabricBrokerDiagramController($scope, localStorage, $routeParams, $location, jolokia, workspace, $compile, $templateCache) { | ||
|
||
Fabric.initScope($scope, $location, jolokia, workspace); | ||
|
||
var graphBuilder = new ForceGraph.GraphBuilder(); | ||
|
||
if (Fabric.hasMQManager) { | ||
Core.register(jolokia, $scope, {type: 'exec', mbean: Fabric.mqManagerMBean, operation: "loadBrokerStatus()"}, onSuccess(onBrokerData)); | ||
} | ||
|
||
function onBrokerData(response) { | ||
if (response) { | ||
var responseJson = angular.toJson(response.value); | ||
if ($scope.responseJson === responseJson) { | ||
return; | ||
} | ||
|
||
$scope.responseJson = responseJson; | ||
|
||
var brokers = response.value; | ||
|
||
$scope.groups = []; | ||
|
||
function getOrAddNode(kind:string, id, createFn) { | ||
var nodeId = ""; | ||
if (id) { | ||
nodeId = kind + "_" + id; | ||
var node = graphBuilder.getNode(nodeId); | ||
if (!node) { | ||
node = createFn(); | ||
node['id'] = nodeId; | ||
node['type'] = kind; | ||
if (!node['name']) { | ||
node['name'] = id; | ||
} | ||
if (node) { | ||
graphBuilder.addNode(node); | ||
} | ||
} | ||
} | ||
return nodeId; | ||
} | ||
|
||
function addLink(id1, id2, linkType) { | ||
if (id1 && id2) { | ||
graphBuilder.addLink(id1, id2, linkType); | ||
} | ||
} | ||
|
||
angular.forEach(brokers, (brokerStatus) => { | ||
var groupId = brokerStatus.group; | ||
var profileId = brokerStatus.profile; | ||
var brokerId = brokerStatus.brokerName; | ||
var containerId = brokerStatus.container; | ||
var versionId = brokerStatus.version || "1.0"; | ||
|
||
var groupNodeId = getOrAddNode("group", groupId, () => { | ||
return { | ||
/* | ||
navUrl: , | ||
image: { | ||
url: "/hawtio/app/osgi/img/bundle.png", | ||
width: 32, | ||
height:32 | ||
}, | ||
*/ | ||
popup: { | ||
title: "Broker Group: " + groupId, | ||
content: "<p>" + groupId + "</p>" | ||
} | ||
}; | ||
}); | ||
|
||
var profileNodeId = getOrAddNode("profile", profileId, () => { | ||
return { | ||
popup: { | ||
title: "Profile: " + profileId, | ||
content: "<p>" + profileId + "</p>" | ||
} | ||
}; | ||
}); | ||
|
||
var brokerNodeId = getOrAddNode("broker", brokerId, () => { | ||
return { | ||
popup: { | ||
title: "Broker: " + brokerId, | ||
content: "<p>" + brokerId + "</p>" | ||
} | ||
}; | ||
}); | ||
|
||
var containerNodeId = getOrAddNode("container", containerId, () => { | ||
return { | ||
popup: { | ||
title: "Container: " + containerId, | ||
content: "<p>" + containerId + " version: " + versionId + "</p>" | ||
} | ||
}; | ||
}); | ||
|
||
// add the links... | ||
addLink(groupNodeId, profileNodeId, "group"); | ||
addLink(profileNodeId, brokerNodeId, "broker"); | ||
addLink(brokerNodeId, containerNodeId, "container"); | ||
}); | ||
|
||
$scope.graph = graphBuilder.buildGraph(); | ||
Core.$apply($scope); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters