Skip to content

Commit

Permalink
fix the source URL on the camel editor UI (and other UIs)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Dec 4, 2013
1 parent 3c9fe19 commit 246ec98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/wiki/js/navbar.ts
Expand Up @@ -14,7 +14,7 @@ module Wiki {
$scope.sourceLink = () => {
var path = $location.path();
var answer = null;
angular.forEach(Wiki.customViewLinks, (link) => {
angular.forEach(Wiki.customViewLinks($scope), (link) => {
if (path.startsWith(link)) {
answer = Core.createHref($location, Wiki.startLink($scope.branch) + "/view" + path.substring(link.length))
}
Expand Down Expand Up @@ -72,7 +72,7 @@ module Wiki {
last.name = Wiki.hideFineNameExtensions(last.name);

var swizzled = false;
angular.forEach(Wiki.customViewLinks, (link) => {
angular.forEach(Wiki.customViewLinks($scope), (link) => {
if (!swizzled && loc.startsWith(link)) {
// lets swizzle the view to the current link
switchFromViewToCustomLink($scope.breadcrumbs.last(), Core.trimLeading(link, "/"));
Expand Down
19 changes: 17 additions & 2 deletions hawtio-web/src/main/webapp/app/wiki/js/wikiHelpers.ts
Expand Up @@ -11,11 +11,14 @@ module Wiki {
export var dozerNamespaces = ["http://dozer.sourceforge.net"];
export var activemqNamespaces = ["http://activemq.apache.org/schema/core"];

export var customViewLinks = ["/wiki/formTable", "/wiki/camel/diagram", "/wiki/camel/canvas", "/wiki/camel/properties", "/wiki/dozer/mappings"];


export var excludeAdjustmentPrefixes = ["http://", "https://", "#"];

/**
* The custom views within the wiki namespace; either "/wiki/$foo" or "/wiki/branch/$branch/$foo"
*/
export var customWikiViewPages = ["/formTable", "/camel/diagram", "/camel/canvas", "/camel/properties", "/dozer/mappings"];

/**
* Which extensions do we wish to hide in the wiki file listing
* @property hideExtentions
Expand Down Expand Up @@ -100,6 +103,18 @@ module Wiki {
export function isWikiEnabled(workspace:Workspace, jolokia, localStorage) {
return Git.createGitRepository(workspace, jolokia, localStorage) !== null;
}

/**
* Returns all the links for the given branch for the custom views, starting with "/"
* @param $scope
* @returns {string[]}
*/
export function customViewLinks($scope) {
var branch = $scope.branch;
var prefix = Core.trimLeading(Wiki.startLink(branch), "#");
return customWikiViewPages.map(path => prefix + path);
}

/**
* Returns a new create document wizard tree
* @method createWizardTree
Expand Down

0 comments on commit 246ec98

Please sign in to comment.