Skip to content

Commit

Permalink
fixes #727 - also removes generated ids from the XML as well (in came…
Browse files Browse the repository at this point in the history
…l 2.13 or the redhat distro of camel 2.12)
  • Loading branch information
jstrachan committed Nov 20, 2013
1 parent 35c140d commit 77c4613
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions hawtio-web/src/main/webapp/app/camel/js/source.ts
Expand Up @@ -18,11 +18,27 @@ module Camel {
};
$scope.codeMirrorOptions = CodeEditor.createEditorSettings(options);

function getSource(routeXmlNode) {
function removeCrappyHeaders(idx, e) {
var answer = e.getAttribute("customId");
e.removeAttribute("customId");
if (!answer || answer !== "true") {
e.removeAttribute("id");
}
e.removeAttribute("_cid");
}
var copy = $(routeXmlNode).clone();
copy.each(removeCrappyHeaders);
copy.find("*").each(removeCrappyHeaders);
var newNode = (copy && copy.length) ? copy[0] : routeXmlNode;
return Core.xmlNodeToString(newNode);
}

function updateRoutes() {
var routeXmlNode = getSelectedRouteNode(workspace);
$scope.mbean = getSelectionCamelContextMBean(workspace);
if (routeXmlNode) {
$scope.source = Core.xmlNodeToString(routeXmlNode);
$scope.source = getSource(routeXmlNode);
Core.$apply($scope);
} else if ($scope.mbean) {
var jolokia = workspace.jolokia;
Expand All @@ -41,7 +57,7 @@ module Camel {
if (routes && routes.length) {
var selectedRoute = routes[0];
// TODO turn into XML?
var routeXml = Core.xmlNodeToString(selectedRoute);
var routeXml = getSource(selectedRoute);
if (routeXml) {
data = routeXml;
}
Expand Down

0 comments on commit 77c4613

Please sign in to comment.