Skip to content

Commit

Permalink
Implement #634 anyways, could be handy
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Oct 10, 2013
1 parent f302bef commit b0b2c3b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/html/test.html
@@ -1,5 +1,30 @@
<div ng-controller="Fabric.TestController">

<div class="row-fluid">
<h3>Profile Link</h3>
<p>A simple widget that automatically links to a profile given just the profile name, or can link to a file inside a profile</p>
<script type="text/ng-template" id="profileLinkTemplate">
<ul>
<li>
<a fabric-profile-link="default">Click me! (use the back button to get back)</a>
</li>
<li>
<a fabric-profile-link="default" file="org.fusesource.fabric.agent.properties">Me too!</a>
</li>
<li>
<a href="http://www.google.com" fabric-profile-link="hawtio">Hey, this link's been overwritten!</a>
</li>
</ul>
</script>
<div hawtio-editor="profileLink" mode="html"></div>
<div class="directive-example">
<div compile="profileLink"></div>
</div>


</div>


<div class="row-fluid">
<h3>Container List</h3>
<p>A widget to display a list of containers</p>
Expand Down
21 changes: 21 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricPlugin.ts
Expand Up @@ -40,6 +40,27 @@ module Fabric {
directive('fabricActiveProfileList', () => {
return new Fabric.ActiveProfileList();
}).
directive('fabricProfileLink', (workspace, jolokia, localStorage) => {
return {
restrict: 'A',
link: ($scope, $element, $attrs) => {
var profileId = $attrs['fabricProfileLink'];

if (profileId && !profileId.isBlank()) {
var container = Fabric.getCurrentContainer(jolokia, ['versionId']);
var versionId = container['versionId'];
if (versionId && !versionId.isBlank()) {
var url = '#' + Fabric.profileLink(workspace, jolokia, localStorage, versionId, profileId);
if (angular.isDefined($attrs['file'])) {
url = url + "/" + $attrs['file'];
}

$element.attr('href', url);
}
}
}
}
}).

run(($location: ng.ILocationService, workspace: Workspace, jolokia, viewRegistry, pageTitle:Core.PageTitle, helpRegistry, layoutFull) => {

Expand Down
1 change: 1 addition & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/test.ts
Expand Up @@ -10,6 +10,7 @@ module Fabric {
$scope.profileIncludes = $templateCache.get("profile-includes");
$scope.profileExcludes = $templateCache.get("profile-excludes");
$scope.containerList = $templateCache.get("containerListTemplate");
$scope.profileLink = $templateCache.get("profileLinkTemplate");

$scope.version = {};
$scope.versionId = '';
Expand Down

0 comments on commit b0b2c3b

Please sign in to comment.