Skip to content

Commit

Permalink
#801: Fixed Camel plugin empty sources tab when selected the routes n…
Browse files Browse the repository at this point in the history
…ode in the tree.
  • Loading branch information
davsclaus committed Dec 11, 2013
1 parent cf065c1 commit 0d388db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
24 changes: 18 additions & 6 deletions hawtio-web/src/main/webapp/app/camel/js/source.ts
Expand Up @@ -41,16 +41,28 @@ module Camel {
}

function updateRoutes() {
// did we select a single route
var routeXmlNode = getSelectedRouteNode(workspace);
$scope.mbean = getSelectionCamelContextMBean(workspace);
if (routeXmlNode) {
$scope.source = getSource(routeXmlNode);
Core.$apply($scope);
} else if ($scope.mbean) {
var jolokia = workspace.jolokia;
jolokia.request(
{type: 'exec', mbean: $scope.mbean, operation: 'dumpRoutesAsXml()'},
onSuccess(populateTable));
} else {
// no then try to find the camel context and get all the routes code
$scope.mbean = getSelectionCamelContextMBean(workspace);
if (!$scope.mbean) {
// maybe the parent is the camel context folder (when we have selected the routes folder),
// then grab the object name from parent
var parent = workspace.selection.parent;
if (parent && parent.title === "context") {
$scope.mbean = parent.children[0].objectName;
}
}
if ($scope.mbean) {
var jolokia = workspace.jolokia;
jolokia.request(
{type: 'exec', mbean: $scope.mbean, operation: 'dumpRoutesAsXml()'},
onSuccess(populateTable));
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions hawtio-web/src/main/webapp/app/camel/js/tree.ts
Expand Up @@ -52,6 +52,7 @@ module Camel {
if (routesNode) {
var routesFolder = new Folder("Routes");
routesFolder.addClass = "org-apache-camel-routes-folder";
routesFolder.parent = contextsFolder;
routesFolder.children = routesNode.children;
angular.forEach(routesFolder.children, (n) => n.addClass = "org-apache-camel-routes");
folder.children.push(routesFolder);
Expand All @@ -62,6 +63,7 @@ module Camel {
if (endpointsNode) {
var endpointsFolder = new Folder("Endpoints");
endpointsFolder.addClass = "org-apache-camel-endpoints-folder";
endpointsFolder.parent = contextsFolder;
endpointsFolder.children = endpointsNode.children;
angular.forEach(endpointsFolder.children, (n) => {
n.addClass = "org-apache-camel-endpoints";
Expand Down

0 comments on commit 0d388db

Please sign in to comment.