Skip to content

Commit

Permalink
#790 update the URL with bookmarkable views when you show/hide broker…
Browse files Browse the repository at this point in the history
…s/queues/topics etc...
  • Loading branch information
jstrachan committed Dec 9, 2013
1 parent bd6d034 commit 2b6fcb8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
33 changes: 29 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/js/brokerDiagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,38 @@ module Fabric {

var graphBuilder = new ForceGraph.GraphBuilder();

Core.bindModelToSearchParam($scope, $location, "searchFilter", "q", "");

angular.forEach($scope.showFlags, (value, key) => {
var watch = "showFlags." + key;
//log.info("Watching " + watch);
$scope.$watch(watch, redrawGraph);
var modelName = "showFlags." + key;

// bind model values to search params...
//Core.bindModelToSearchParam($scope, $location, watch, key, "");
function currentValue() {
var answer = $location.search()[paramName] || defaultFlags[key];
return answer === "false" ? false : answer;
}

var paramName = key;
var value = currentValue();
Core.pathSet($scope, modelName, value);

$scope.$watch(modelName, () => {
var current = Core.pathGet($scope, modelName);
var old = currentValue();
if (current !== old) {
var defaultValue = defaultFlags[key];
if (current !== defaultValue) {
if (!current) {
current = "false";
}
$location.search(paramName, current);
} else {
$location.search(paramName, null);
}
}
redrawGraph();
});

});

$scope.$watch("searchFilter", (newValue, oldValue) => {
Expand Down
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Fabric {
angular.module('fabric', ['bootstrap', 'ui.bootstrap', 'ui.bootstrap.dialog', 'ngResource', 'ngGrid', 'hawtio-forms', 'hawtioCore', 'ngDragDrop', 'wiki']).config(($routeProvider) => {
$routeProvider.
when('/createFabric', {templateUrl: templatePath + 'createFabric.html'}).
when('/fabric/containers/createContainer', {templateUrl: templatePath + 'createContainer.html' , reloadOnSearch: false }).
when('/fabric/containers/createContainer', {templateUrl: templatePath + 'createContainer.html', reloadOnSearch: false }).
when('/fabric/map', {templateUrl: templatePath + 'map.html'}).
when('/fabric/clusters/*page', {templateUrl: templatePath + 'clusters.html'}).
when('/fabric/containers', {templateUrl: templatePath + 'containers.html', reloadOnSearch: false}).
Expand All @@ -28,7 +28,7 @@ module Fabric {
when('/fabric/migrate', { templateUrl: templatePath + 'migrateVersions.html' }).
when('/fabric/patching', { templateUrl: templatePath + 'patching.html' }).
when('/fabric/mq/brokers', { templateUrl: templatePath + 'brokers.html' }).
when('/fabric/mq/brokerDiagram', { templateUrl: templatePath + 'brokerDiagram.html' }).
when('/fabric/mq/brokerDiagram', { templateUrl: templatePath + 'brokerDiagram.html', reloadOnSearch: false }).
when('/fabric/mq/brokerNetwork', { templateUrl: templatePath + 'brokerNetwork.html' }).
when('/fabric/mq/createBroker', { templateUrl: templatePath + 'createBroker.html' }).
when('/fabric/api', { templateUrl: templatePath + 'apis.html' }).
Expand Down

0 comments on commit 2b6fcb8

Please sign in to comment.