fixing system tracking route

This commit is contained in:
Jared Tabor
2016-01-05 13:53:28 -05:00
parent 95240e03ab
commit 87b0a9abab
4 changed files with 30 additions and 23 deletions

View File

@@ -843,11 +843,14 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
}); });
$scope.systemTracking = function() { $scope.systemTracking = function() {
$scope.inventory = JSON.stringify($scope.inventory); var hostIds = _.map($scope.hostsSelectedItems, function(x){
$scope.hostsSelectedItems = JSON.stringify($scope.hostsSelectedItems); return x.id;
$state.go('systemTracking', });
$state.transitionTo('systemTracking',
{ inventory: $scope.inventory, { inventory: $scope.inventory,
hosts: $scope.hostsSelectedItems inventoryId: $scope.inventory.id,
hosts: $scope.hostsSelectedItems,
hostIds: hostIds
}); });
}; };
@@ -922,7 +925,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
$scope.removeInventoryLoaded(); $scope.removeInventoryLoaded();
} }
$scope.removeInventoryLoaded = $scope.$on('InventoryLoaded', function() { $scope.removeInventoryLoaded = $scope.$on('InventoryLoaded', function() {
var e, rows; var rows;
// Add groups view // Add groups view
generateList.inject(InventoryGroups, { generateList.inject(InventoryGroups, {

View File

@@ -8,6 +8,7 @@ export default function($stateProvider){
controller: state.controller, controller: state.controller,
templateUrl: state.templateUrl, templateUrl: state.templateUrl,
resolve: state.resolve, resolve: state.resolve,
params: state.params,
ncyBreadcrumb: state.ncyBreadcrumb ncyBreadcrumb: state.ncyBreadcrumb
}); });
} }

View File

@@ -16,20 +16,21 @@ function controller($rootScope,
$q, $q,
$state, $state,
moduleOptions, moduleOptions,
inventory,
hosts,
getDataForComparison, getDataForComparison,
waitIndicator, waitIndicator,
moment, moment,
_) { _) {
// var inventoryId = $stateParams.id; // var inventoryId = $stateParams.id;
var hostIds = $stateParams.hosts.split(','); var hostIds = $stateParams.hostIds.split(',');
var hosts = $stateParams.model.hosts;
var moduleParam = $stateParams.module || 'packages'; var moduleParam = $stateParams.module || 'packages';
$scope.compareMode = $scope.compareMode =
hostIds.length === 1 ? 'single-host' : 'host-to-host'; hostIds.length === 1 ? 'single-host' : 'host-to-host';
$scope.hostIds = $stateParams.hosts; $scope.hostIds = $stateParams.hosts;
$scope.inventory = $stateParams.model.inventory; $scope.inventory = inventory;
$scope.noModuleData = false; $scope.noModuleData = false;
// this means no scans have been run // this means no scans have been run
@@ -320,6 +321,8 @@ export default
'$q', '$q',
'$state', '$state',
'moduleOptions', 'moduleOptions',
'inventory',
'hosts',
'getDataForComparison', 'getDataForComparison',
'Wait', 'Wait',
'moment', 'moment',

View File

@@ -8,20 +8,20 @@ import {templateUrl} from '../shared/template-url/template-url.factory';
export default { export default {
name: 'systemTracking', name: 'systemTracking',
route: '/inventories/:inventory/system-tracking/:hosts', route: '/inventories/:inventoryId/system-tracking/:hostIds',
controller: 'systemTracking', controller: 'systemTracking',
templateUrl: templateUrl('system-tracking/system-tracking'), templateUrl: templateUrl('system-tracking/system-tracking'),
params: {hosts: null, inventory: null},
reloadOnSearch: false, reloadOnSearch: false,
resolve: { resolve: {
moduleOptions: moduleOptions:
[ 'getModuleOptions', [ 'getModuleOptions',
'lodashAsPromised', 'lodashAsPromised',
'ProcessErrors', 'ProcessErrors',
'$state',
'$stateParams', '$stateParams',
function(getModuleOptions, _, ProcessErrors, $state, $stateParams) { function(getModuleOptions, _, ProcessErrors, $stateParams) {
var hostIds = JSON.parse($stateParams.hosts);
// hostIds = hostIds.split(','); var hostIds = $stateParams.hostIds.split(',');
var data = var data =
getModuleOptions(hostIds[0]) getModuleOptions(hostIds[0])
@@ -39,18 +39,18 @@ export default {
} }
], ],
inventory: inventory:
[ '$state', [ '$stateParams',
'$q', '$q',
'Rest', 'Rest',
'GetBasePath', 'GetBasePath',
'ProcessErrors', 'ProcessErrors',
function($state, $q, rest, getBasePath, ProcessErrors) { function($stateParams, $q, rest, getBasePath, ProcessErrors) {
if ($state.current.hasModelKey('inventory')) { if ($stateParams.inventory) {
return $q.when($state.current.params.model.inventory); return $q.when($stateParams.inventory);
} }
var inventoryId = $state.current.params.inventory; var inventoryId = $stateParams.inventoryId;
var url = getBasePath('inventory') + inventoryId + '/'; var url = getBasePath('inventory') + inventoryId + '/';
rest.setUrl(url); rest.setUrl(url);
@@ -67,17 +67,17 @@ export default {
} }
], ],
hosts: hosts:
[ '$state', [ '$stateParams',
'$q', '$q',
'Rest', 'Rest',
'GetBasePath', 'GetBasePath',
'ProcessErrors', 'ProcessErrors',
function($state, $q, rest, getBasePath, ProcessErrors) { function($stateParams, $q, rest, getBasePath, ProcessErrors) {
if ($state.current.hasModelKey('hosts')) { if ($stateParams.hosts) {
return $q.when($state.current.params.model.hosts); return $q.when($stateParams.hosts);
} }
var hostIds = $state.current.params.hosts.split(','); var hostIds = $stateParams.hostIds.split(',');
var hosts = var hosts =
hostIds.map(function(hostId) { hostIds.map(function(hostId) {