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.inventory = JSON.stringify($scope.inventory);
$scope.hostsSelectedItems = JSON.stringify($scope.hostsSelectedItems);
$state.go('systemTracking',
var hostIds = _.map($scope.hostsSelectedItems, function(x){
return x.id;
});
$state.transitionTo('systemTracking',
{ 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.$on('InventoryLoaded', function() {
var e, rows;
var rows;
// Add groups view
generateList.inject(InventoryGroups, {

View File

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

View File

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

View File

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