From 6b0e0de041c0a0abd5257a783a82f581bb85d97b Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Thu, 26 May 2016 01:44:05 -0400 Subject: [PATCH] fix $stateParams coming from dashboard -> inventory/project w/ sync failures, resolves #1792 --- awx/ui/client/src/app.js | 2 +- awx/ui/client/src/controllers/Projects.js | 3 +-- .../client/src/dashboard/counts/dashboard-counts.directive.js | 4 ++-- .../client/src/inventories/list/inventory-list.controller.js | 2 +- awx/ui/client/src/inventories/list/inventory-list.route.js | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 1fbd283e79..e2ceccf65b 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -269,7 +269,7 @@ var tower = angular.module('Tower', [ }). state('projects', { - url: '/projects', + url: '/projects?{status}', templateUrl: urlPrefix + 'partials/projects.html', controller: ProjectsList, data: { diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 033328f838..163f468765 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -22,8 +22,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, Wait('start'); var list = ProjectList, - defaultUrl = GetBasePath('projects'), - view = GenerateList, + defaultUrl = GetBasePath('projects') + ($stateParams.status ? '?status=' + $stateParams.status : ''), view = GenerateList, base = $location.path().replace(/^\//, '').split('/')[0], mode = (base === 'projects') ? 'edit' : 'select', url = (base === 'teams') ? GetBasePath('teams') + $stateParams.team_id + '/projects/' : defaultUrl, diff --git a/awx/ui/client/src/dashboard/counts/dashboard-counts.directive.js b/awx/ui/client/src/dashboard/counts/dashboard-counts.directive.js index 868742154a..6d6f2934f8 100644 --- a/awx/ui/client/src/dashboard/counts/dashboard-counts.directive.js +++ b/awx/ui/client/src/dashboard/counts/dashboard-counts.directive.js @@ -49,7 +49,7 @@ export default label: "Inventories", }, { - url: "/#/inventories/?inventory_sources_with_failures", + url: "/#/inventories?status=sync-failed", number: scope.data.inventories.inventory_failed, label: "Inventory Sync Failures", isFailureCount: true @@ -60,7 +60,7 @@ export default label: "Projects" }, { - url: "/#/projects/?status=failed", + url: "/#/projects?status=failed", number: scope.data.projects.failed, label: "Project Sync Failures", isFailureCount: true diff --git a/awx/ui/client/src/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories/list/inventory-list.controller.js index 947b1c0341..f38e99239f 100644 --- a/awx/ui/client/src/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories/list/inventory-list.controller.js @@ -17,7 +17,7 @@ function InventoriesList($scope, $rootScope, $location, $log, Find, Empty, $state) { var list = InventoryList, - defaultUrl = GetBasePath('inventory'), + defaultUrl = GetBasePath('inventory') + ($stateParams.status === 'sync-failed' ? '?not__inventory_sources_with_failures=0' : ''), view = generateList, paths = $location.path().replace(/^\//, '').split('/'), mode = (paths[0] === 'inventories') ? 'edit' : 'select'; diff --git a/awx/ui/client/src/inventories/list/inventory-list.route.js b/awx/ui/client/src/inventories/list/inventory-list.route.js index 65709dd512..af1cc1853b 100644 --- a/awx/ui/client/src/inventories/list/inventory-list.route.js +++ b/awx/ui/client/src/inventories/list/inventory-list.route.js @@ -9,7 +9,7 @@ import InventoriesList from './inventory-list.controller'; export default { name: 'inventories', - route: '/inventories', + route: '/inventories?{status}', templateUrl: templateUrl('inventories/inventories'), controller: InventoriesList, data: {