From 657b41510c57fa7173b3cec0d251e2dab4f8c30c Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Thu, 28 May 2015 09:42:01 -0400 Subject: [PATCH] Add breadcrumbs to system tracking page --- .../js/shared/breadcrumbs/breadcrumbs.controller.js | 5 +++-- .../shared/route-extensions/model-listener.config.js | 6 ++++++ .../js/system-tracking/system-tracking.controller.js | 8 ++++++-- .../js/system-tracking/system-tracking.partial.html | 6 ++++++ .../js/system-tracking/system-tracking.route.js | 12 ++++++------ 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/awx/ui/static/js/shared/breadcrumbs/breadcrumbs.controller.js b/awx/ui/static/js/shared/breadcrumbs/breadcrumbs.controller.js index 62e892b8e3..bc6bd7e661 100644 --- a/awx/ui/static/js/shared/breadcrumbs/breadcrumbs.controller.js +++ b/awx/ui/static/js/shared/breadcrumbs/breadcrumbs.controller.js @@ -11,10 +11,11 @@ export default $scope.breadcrumbs = []; - this.addBreadcrumb = function(title, path) { + this.addBreadcrumb = function(title, path, isCurrent) { var breadcrumb = { title: title, - path: path + path: path, + isCurrent: isCurrent }; if ($rootScope.enteredPath === path) { diff --git a/awx/ui/static/js/shared/route-extensions/model-listener.config.js b/awx/ui/static/js/shared/route-extensions/model-listener.config.js index 78feebb8f9..bf4bb5feba 100644 --- a/awx/ui/static/js/shared/route-extensions/model-listener.config.js +++ b/awx/ui/static/js/shared/route-extensions/model-listener.config.js @@ -4,10 +4,16 @@ * All Rights Reserved *************************************************/ +import {wrapDelegate} from './route-params.decorator'; + export default [ '$rootScope', '$routeParams', function($rootScope, $routeParams) { + $rootScope.$on('$routeChangeStart', function(e, newRoute) { + wrapDelegate(newRoute.params); + }); + $rootScope.$on('$routeChangeSuccess', function(e, newRoute) { if (angular.isUndefined(newRoute.model)) { var keys = Object.keys(newRoute.params); diff --git a/awx/ui/static/js/system-tracking/system-tracking.controller.js b/awx/ui/static/js/system-tracking/system-tracking.controller.js index 493bdc5118..8244874bbf 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.controller.js +++ b/awx/ui/static/js/system-tracking/system-tracking.controller.js @@ -19,6 +19,10 @@ function controller($rootScope, _) { // var inventoryId = $routeParams.id; var hostIds = $routeParams.hosts.split(','); + var hosts = $routeParams.model.hosts; + + $scope.hostIds = $routeParams.hosts; + $scope.inventory = $routeParams.model.inventory; $scope.factModulePickersLabelLeft = "Compare facts collected on"; $scope.factModulePickersLabelRight = "To facts collected on"; @@ -68,8 +72,8 @@ function controller($rootScope, $scope.comparisonLeftHeader = $scope.leftDate; $scope.comparisonRightHeader = $scope.rightDate; } else { - $scope.comparisonLeftHeader = hostIds[0]; - $scope.comparisonRightHeader = hostIds[1]; + $scope.comparisonLeftHeader = hosts[0].name; + $scope.comparisonRightHeader = hosts[1].name; } } diff --git a/awx/ui/static/js/system-tracking/system-tracking.partial.html b/awx/ui/static/js/system-tracking/system-tracking.partial.html index a05967ef5d..cfa2ff6d7b 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.partial.html +++ b/awx/ui/static/js/system-tracking/system-tracking.partial.html @@ -1,3 +1,9 @@ + + + + + +
{{ factModulePickersLabelLeft }} diff --git a/awx/ui/static/js/system-tracking/system-tracking.route.js b/awx/ui/static/js/system-tracking/system-tracking.route.js index ca78ed6b61..fa4fa07d47 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.route.js +++ b/awx/ui/static/js/system-tracking/system-tracking.route.js @@ -48,8 +48,8 @@ export default { 'Rest', 'GetBasePath', function($route, $q, rest, getBasePath) { - if ($route.current.params.inventory) { - return $q.when(true); + if ($route.current.params.hasModelKey('inventory')) { + return $q.when($route.current.params.model.inventory); } var inventoryId = $route.current.params.inventory; @@ -62,17 +62,17 @@ export default { }); } ], - filters: + hosts: [ '$route', '$q', 'Rest', 'GetBasePath', function($route, $q, rest, getBasePath) { - if ($route.current.params.hosts) { - return $q.when(true); + if ($route.current.params.hasModelKey('hosts')) { + return $q.when($route.current.params.model.hosts); } - var hostIds = $route.current.params.filters.split(','); + var hostIds = $route.current.params.hosts.split(','); var hosts = hostIds.map(function(hostId) {