Skip to content

Commit

Permalink
Fix #582
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Oct 22, 2013
1 parent 684269b commit 21a71a1
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 18 deletions.
3 changes: 3 additions & 0 deletions hawtio-karaf-terminal/src/main/webapp/app/doc/help.md
@@ -0,0 +1,3 @@
## Karaf Terminal

This plugin contains a web-based terminal that connects to the current Karaf instance that's serving out the web console.
3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/app/camin/doc/help.md
@@ -0,0 +1,3 @@
## Camin plugin

This plugin is used to render Gantt sequence diagrams of Camel routes.
73 changes: 58 additions & 15 deletions hawtio-web/src/main/webapp/app/core/js/helpRegistry.ts
Expand Up @@ -23,6 +23,28 @@ module Core {
faq: 'FAQ'
};

// map plugin names to their path in the app
private pluginNameMappings = {
hawtioCore: 'core',
'hawtio-branding': 'branding',
forceGraph: 'forcegraph',
'hawtio-ui': 'ui',
'hawtio-forms': 'forms',
elasticjs: 'elasticsearch'
};

// let's not auto-discover help files in these plugins
private ignoredPlugins = [
'core',
'branding',
'datatable',
'forcegraph',
'forms',
'perspective',
'tree',
'ui'
];

private topics = {};

constructor(public $rootScope) {
Expand Down Expand Up @@ -67,24 +89,45 @@ module Core {
return this.topics;
}

public disableAutodiscover(name) {
this.ignoredPlugins.push(name);
}

public discoverHelpFiles(plugins) {
var self = this;
var self:HelpRegistry = this;

console.log("Ignored plugins: ", self.ignoredPlugins);

plugins.forEach(function(plugin) {
angular.forEach(self.discoverableDocTypes, (value, key) => {
var target = 'app/' + plugin + '/doc/' + value;
// avoid trying to discover these if plugins register them
if (!angular.isDefined(self['plugin'])
|| !angular.isDefined(self['plugin'][key])) {
$.ajax(target, {
type: 'HEAD',
statusCode: {
200: function() {
self.getOrCreateTopic(plugin)[key] = target

var pluginName = self.pluginNameMappings[plugin];
if (!angular.isDefined(pluginName)) {
pluginName = plugin;
}

if (!self.ignoredPlugins.any((p) => { return p === pluginName; })) {

angular.forEach(self.discoverableDocTypes, (value, key) => {
// avoid trying to discover these if plugins register them
if (!angular.isDefined(self[pluginName]) ||
!angular.isDefined(self[pluginName][key])) {

var target = 'app/' + pluginName + '/doc/' + value;
console.log("checking: ", target);

$.ajax(target, {
type: 'HEAD',
statusCode: {
200: function() {
self.getOrCreateTopic(plugin)[key] = target
}
}
}
});
}
});
});
}
});

}

});
}

Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/forcegraph/README.md
@@ -1,3 +1,3 @@
### A D3 force graph directive.

Refer to the [user guide](doc/README.md) or to [this blog](http://www.wayofquality.de/index.php/blog/entry/creating-a-directive-for-hawtio) if you are interested to read a bit about the inner workings of the directive code.
Refer to the [user guide](doc/developer.md) or to [this blog](http://www.wayofquality.de/index.php/blog/entry/creating-a-directive-for-hawtio) if you are interested to read a bit about the inner workings of the directive code.
Expand Up @@ -41,7 +41,7 @@ The div with the id `pop-up` is used to style the tooltips for the nodes.

The image below shows the force graph directive being used to render the service / bundle dependencies within an OSGI container.

![Force Graph in Action](../img/dependencies.png)
![Force Graph in Action](app/forcegraph/doc/img/dependencies.png)

#### Building a Graph

Expand Down
Expand Up @@ -5,7 +5,10 @@ module ForceGraph {

directive('hawtioForceGraph', function () {
return new ForceGraph.ForceGraphDirective();
})
.run((helpRegistry) => {
helpRegistry.addDevDoc('Force Graph', 'app/forcegraph/doc/developer.md');
});

hawtioPluginLoader.addModule(pluginName);
}
}

0 comments on commit 21a71a1

Please sign in to comment.