Navigation Menu

Skip to content

Commit

Permalink
add a diagram tab for the camel viewer/editor for #228
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Apr 9, 2013
1 parent fbf0478 commit 2236ae2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
22 changes: 15 additions & 7 deletions hawtio-web/src/main/webapp/app/camel/js/camel.ts
Expand Up @@ -2,6 +2,7 @@
module Camel {
export function CamelController($scope, $element, workspace:Workspace, jolokia) {
$scope.routes = [];
$scope.routeNodes = {};

$scope.$on("$routeChangeSuccess", function (event, current, previous) {
// lets do this asynchronously to avoid Error: $digest already in progress
Expand All @@ -13,8 +14,13 @@ module Camel {
updateRoutes();
});

$scope.$watch('nodeXmlNode', function () {
if (workspace.moveIfViewInvalid()) return;
updateRoutes();
});

function updateRoutes() {
var routeXmlNode = getSelectedRouteNode(workspace);
var routeXmlNode = getSelectedRouteNode(workspace) || $scope.nodeXmlNode;
$scope.mbean = getSelectionCamelContextMBean(workspace);
if (routeXmlNode) {
// lets show the remaining parts of the diagram of this route node
Expand All @@ -38,7 +44,7 @@ module Camel {
$scope.routes = data;
// nodes and routeNodes is the GUI nodes for the processors and routes shown in the diagram
$scope.nodes = {};
$scope.routeNodes = {}
$scope.routeNodes = {};
var nodes = [];
var links = [];
var selectedRouteId = getSelectedRouteId(workspace);
Expand Down Expand Up @@ -70,11 +76,13 @@ module Camel {
var svg = canvasDiv.children("svg")[0];
$scope.graphData = Core.dagreLayoutGraph(nodes, links, width, height, svg);

Core.register(jolokia, $scope, {
type: 'exec', mbean: $scope.mbean,
operation: 'dumpRoutesStatsAsXml',
arguments: [true, true]
}, onSuccess(statsCallback));
if ($scope.mbean) {
Core.register(jolokia, $scope, {
type: 'exec', mbean: $scope.mbean,
operation: 'dumpRoutesStatsAsXml',
arguments: [true, true]
}, onSuccess(statsCallback));
}
return width;
}

Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/wiki/html/camelDiagram.html
@@ -1 +1 @@
<h1>Diagram</h1>
<div ng-include="diagramTemplate"></div>
2 changes: 2 additions & 0 deletions hawtio-web/src/main/webapp/app/wiki/js/camel.ts
Expand Up @@ -32,6 +32,7 @@ module Wiki {

$scope.onNodeSelect = (treeNode) => {
$scope.propertiesTemplate = null;
$scope.diagramTemplate = null;
$scope.nodeXmlNode = null;
var routeXmlNode = treeNode["routeXmlNode"];
if (routeXmlNode) {
Expand All @@ -43,6 +44,7 @@ module Wiki {
if ($scope.nodeModel) {
$scope.propertiesTemplate = "app/wiki/html/camelPropertiesEdit.html";
}
$scope.diagramTemplate = "app/camel/html/routes.html";
Core.$apply($scope);
}
};
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/wiki/js/wikiPlugin.ts
@@ -1,6 +1,6 @@
module Wiki {
var pluginName = 'wiki';
angular.module(pluginName, ['bootstrap', 'ngResource', 'hawtioCore', 'tree']).
angular.module(pluginName, ['bootstrap', 'ngResource', 'hawtioCore', 'tree', 'camel']).
config(($routeProvider) => {
$routeProvider.
when('/wiki/view/*page', {templateUrl: 'app/wiki/html/viewPage.html'}).
Expand Down

0 comments on commit 2236ae2

Please sign in to comment.