Skip to content

Commit

Permalink
Passing filter parameter in routeParams so we can stick them on the d…
Browse files Browse the repository at this point in the history
…ashboard if we wanted.
  • Loading branch information
atooni committed Oct 7, 2013
1 parent 290f6e6 commit 9ba0c98
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/osgi/js/osgiPlugin.ts
Expand Up @@ -11,7 +11,7 @@ module Osgi {
when('/osgi/configurations', {templateUrl: 'app/osgi/html/configurations.html'}).
when('/osgi/pid/:pid', {templateUrl: 'app/osgi/html/pid.html'}).
when('/osgi/fwk', {templateUrl: 'app/osgi/html/framework.html'}).
when('/osgi/dependencies', {templateUrl: 'app/osgi/html/svc-dependencies.html'})
when('/osgi/dependencies', {templateUrl: 'app/osgi/html/svc-dependencies.html', reloadOnSearch: false })
}).
run((workspace:Workspace, viewRegistry) => {

Expand Down
66 changes: 50 additions & 16 deletions hawtio-web/src/main/webapp/app/osgi/js/svc-dependencies.ts
@@ -1,26 +1,59 @@
module Osgi {

export function ServiceDependencyController($scope, workspace:Workspace, osgiDataService: OsgiDataService) {
export function ServiceDependencyController($scope, $routeParams, workspace:Workspace, osgiDataService: OsgiDataService) {

$scope.bundleFilter = "";
$scope.packageFilter = "";
$scope.selectView = "services";
$scope.hideUnused = true;
$scope.disablePkg = true;
$scope.init = () => {

if ($routeParams["bundleFilter"]) {
$scope = $routeParams["bundleFilter"];
} else {
$scope.bundleFilter = "";
}

if ($routeParams["pkgFilter"]) {
$scope.packageFilter = $routeParams["pkgFilter"];
} else {
$scope.packageFilter = "";
}

if ($routeParams["view"] == "packages") {
$scope.selectView = "packages";
} else {
$scope.selectView = "services";
}

if ($routeParams['hideUnused']) {
$scope.hideUnused = $routeParams['hideUnused'] == "true";
} else {
$scope.hideUnused = true;
}

$scope.updatePkgFilter();
}

$scope.addToDashboardLink = () => {
var href="#/osgi/dependencies";
var title="OSGi Dependencies";
var size = angular.toJson({
size_x: 2,
size_y: 2
});
return "#/dashboard/add?tab=dashboard" +
"&href=" + encodeURIComponent(href) +
"&size=" + encodeURIComponent(size) +
"&title=" + encodeURIComponent(title);

var routeParams = angular.toJson($routeParams);

var href="#/osgi/dependencies";
var title="OSGi Dependencies";

var size = angular.toJson({
size_x: 2,
size_y: 2
});
return "#/dashboard/add?tab=dashboard" +
"&href=" + encodeURIComponent(href) +
"&routeParams=" + encodeURIComponent(routeParams) +
"&size=" + encodeURIComponent(size) +
"&title=" + encodeURIComponent(title);
};

$scope.$on('$routeUpdate', () => {
$scope.init();
$scope.updateGraph();
});

$scope.updateGraph = () => {

var graphBuilder = new OsgiGraphBuilder(
Expand All @@ -45,6 +78,7 @@ module Osgi {
}
}

$scope.init();
$scope.updateGraph();
}
}

0 comments on commit 9ba0c98

Please sign in to comment.