Add breadcrumbs to system tracking page

This commit is contained in:
Joe Fiorini
2015-05-28 09:42:01 -04:00
parent 0507fd74b9
commit 657b41510c
5 changed files with 27 additions and 10 deletions

View File

@@ -11,10 +11,11 @@ export default
$scope.breadcrumbs = []; $scope.breadcrumbs = [];
this.addBreadcrumb = function(title, path) { this.addBreadcrumb = function(title, path, isCurrent) {
var breadcrumb = var breadcrumb =
{ title: title, { title: title,
path: path path: path,
isCurrent: isCurrent
}; };
if ($rootScope.enteredPath === path) { if ($rootScope.enteredPath === path) {

View File

@@ -4,10 +4,16 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
import {wrapDelegate} from './route-params.decorator';
export default export default
[ '$rootScope', [ '$rootScope',
'$routeParams', '$routeParams',
function($rootScope, $routeParams) { function($rootScope, $routeParams) {
$rootScope.$on('$routeChangeStart', function(e, newRoute) {
wrapDelegate(newRoute.params);
});
$rootScope.$on('$routeChangeSuccess', function(e, newRoute) { $rootScope.$on('$routeChangeSuccess', function(e, newRoute) {
if (angular.isUndefined(newRoute.model)) { if (angular.isUndefined(newRoute.model)) {
var keys = Object.keys(newRoute.params); var keys = Object.keys(newRoute.params);

View File

@@ -19,6 +19,10 @@ function controller($rootScope,
_) { _) {
// var inventoryId = $routeParams.id; // var inventoryId = $routeParams.id;
var hostIds = $routeParams.hosts.split(','); 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.factModulePickersLabelLeft = "Compare facts collected on";
$scope.factModulePickersLabelRight = "To facts collected on"; $scope.factModulePickersLabelRight = "To facts collected on";
@@ -68,8 +72,8 @@ function controller($rootScope,
$scope.comparisonLeftHeader = $scope.leftDate; $scope.comparisonLeftHeader = $scope.leftDate;
$scope.comparisonRightHeader = $scope.rightDate; $scope.comparisonRightHeader = $scope.rightDate;
} else { } else {
$scope.comparisonLeftHeader = hostIds[0]; $scope.comparisonLeftHeader = hosts[0].name;
$scope.comparisonRightHeader = hostIds[1]; $scope.comparisonRightHeader = hosts[1].name;
} }
} }

View File

@@ -1,3 +1,9 @@
<breadcrumbs>
<breadcrumb path="/inventories" title="Inventories"></breadcrumb>
<breadcrumb path="/inventories/{{inventory.id}}/manage" title="{{inventory.name}}"></breadcrumb>
<breadcrumb path="/inventories/{{inventory.id}}/system-tracking/{{hostIds}}" title="System Tracking" current="true"></breadcrumb>
</breadcrumbs>
<div class="FactModulePickers"> <div class="FactModulePickers">
<div class="FactModulePickers-dateContainer FactModulePickers-dateContainer--left"> <div class="FactModulePickers-dateContainer FactModulePickers-dateContainer--left">
<span class="FactModulePickers-label">{{ factModulePickersLabelLeft }}</span> <span class="FactModulePickers-label">{{ factModulePickersLabelLeft }}</span>

View File

@@ -48,8 +48,8 @@ export default {
'Rest', 'Rest',
'GetBasePath', 'GetBasePath',
function($route, $q, rest, getBasePath) { function($route, $q, rest, getBasePath) {
if ($route.current.params.inventory) { if ($route.current.params.hasModelKey('inventory')) {
return $q.when(true); return $q.when($route.current.params.model.inventory);
} }
var inventoryId = $route.current.params.inventory; var inventoryId = $route.current.params.inventory;
@@ -62,17 +62,17 @@ export default {
}); });
} }
], ],
filters: hosts:
[ '$route', [ '$route',
'$q', '$q',
'Rest', 'Rest',
'GetBasePath', 'GetBasePath',
function($route, $q, rest, getBasePath) { function($route, $q, rest, getBasePath) {
if ($route.current.params.hosts) { if ($route.current.params.hasModelKey('hosts')) {
return $q.when(true); return $q.when($route.current.params.model.hosts);
} }
var hostIds = $route.current.params.filters.split(','); var hostIds = $route.current.params.hosts.split(',');
var hosts = var hosts =
hostIds.map(function(hostId) { hostIds.map(function(hostId) {