Skip to content

Commit

Permalink
fixes #532 so we can navigate into the configuration of a fabric with…
Browse files Browse the repository at this point in the history
… 1 click from the top level nav bar. Also renamed the 2 main tabs for Fabric "Runtime" and "Configuration" though we could maybe use "Containers" and "Profiles" too? But I guess longer term "Runtime" could include "Gears/Applications" and Configuration could include other stuff not just Profiles?
  • Loading branch information
jstrachan committed Sep 11, 2013
1 parent 2891429 commit 5bb2052
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
13 changes: 11 additions & 2 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricPlugin.ts
Expand Up @@ -45,12 +45,21 @@ module Fabric {
});

workspace.topLevelTabs.push( {
content: "Fabric",
title: "Manage your containers and middleware in a fabric",
content: "Runtime",
title: "Manage your containers in this fabric",
isValid: (workspace) => Fabric.hasFabric(workspace),
href: () => "#/fabric/view",
isActive: (workspace: Workspace) => workspace.isLinkActive("fabric")
});
workspace.topLevelTabs.push( {
content: "Configuration",
title: "Manage the configuration of your profiles in Fabric",
isValid: (workspace) => Fabric.hasFabric(workspace),
href: () => {
return "#/wiki/branch/" + Fabric.activeVersion($location) + "/view/";
},
isActive: (workspace: Workspace) => workspace.isLinkActive("wiki")
});

helpRegistry.addDevDoc("fabric", 'app/fabric/doc/developer.md');

Expand Down
5 changes: 5 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/helpers.ts
Expand Up @@ -137,6 +137,11 @@ module Fabric {
doAction('deleteVersion(java.lang.String)', jolokia, [id], success, error);
}

// TODO cache the current active version? Then clear the cached value if we delete it
export function activeVersion($location) {
return $location.search()['cv'] || "1.0";
}

export function deleteProfile(jolokia, version, id, success, error) {
doAction('deleteProfile(java.lang.String, java.lang.String)', jolokia, [version, id], success, error);
}
Expand Down
24 changes: 17 additions & 7 deletions hawtio-web/src/main/webapp/app/fabric/js/navbar.ts
@@ -1,6 +1,11 @@
module Fabric {
export function NavBarController($scope, $location, jolokia, workspace:Workspace) {

$scope.activeVersion = "1.0";

// update the active version whenever query parameters change
$scope.$on('$routeUpdate', reloadVersion);

$scope.isActive = (href) => {
return workspace.isLinkActive(href);
};
Expand All @@ -10,18 +15,23 @@ module Fabric {
return Core.createHref($location, "#/fabric/clusters/fabric/registry/clusters", ["cv", "cp", "pv"]);
};

function reloadData() {
var containerId = null;
Fabric.containerWebAppURL(jolokia, "org.fusesource.insight.insight-kibana3", containerId, onKibanaUrl, onKibanaUrl);
Fabric.containerWebAppURL(jolokia, "drools-wb-distribution-wars", containerId, onDroolsUrl, onDroolsUrl);
$scope.hasMetrics = workspace.treeContainsDomainAndProperties('org.elasticsearch', {service: 'restjmx'});
$scope.canUpload = workspace.treeContainsDomainAndProperties('io.hawt.jmx', {type: 'UploadManager'});
function reloadVersion() {
$scope.activeVersion = Fabric.activeVersion($location);
}

function reloadData() {
// TODO should probably load the default version here
reloadVersion();
$scope.hasFabric = Fabric.hasFabric(workspace);
if (!$scope.hasFabric) {
$location.url("/fabric/create");
} else {
var containerId = null;
Fabric.containerWebAppURL(jolokia, "org.fusesource.insight.insight-kibana3", containerId, onKibanaUrl, onKibanaUrl);
Fabric.containerWebAppURL(jolokia, "drools-wb-distribution-wars", containerId, onDroolsUrl, onDroolsUrl);
$scope.hasMetrics = workspace.treeContainsDomainAndProperties('org.elasticsearch', {service: 'restjmx'});
$scope.canUpload = workspace.treeContainsDomainAndProperties('io.hawt.jmx', {type: 'UploadManager'});
}

}

reloadData();
Expand Down
3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/app/perspective/js/metadata.ts
Expand Up @@ -9,6 +9,9 @@ module Perspective {
{
href: "#/fabric"
},
{
href: "#/wiki/branch/"
},
{
href: "#/dashboard"
}
Expand Down

0 comments on commit 5bb2052

Please sign in to comment.