From f7b5772ebafe3b6e85734643cb4db03d6958ebe0 Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Mon, 2 May 2016 23:59:39 -0400 Subject: [PATCH] add /#/home/hosts/?active-failures=true, resolves #1678 --- .../counts/dashboard-counts.directive.js | 2 +- .../dashboard/hosts/dashboard-hosts.list.js | 2 +- .../dashboard/hosts/dashboard-hosts.route.js | 58 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) 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 3dafe1f13e..64c8b3216e 100644 --- a/awx/ui/client/src/dashboard/counts/dashboard-counts.directive.js +++ b/awx/ui/client/src/dashboard/counts/dashboard-counts.directive.js @@ -38,7 +38,7 @@ export default label: "Hosts" }, { - url: "/#/home/hosts?has_active_failures=true", + url: "/#/home/hosts?active-failures=true", number: scope.data.hosts.failed, label: "Failed Hosts", isFailureCount: true diff --git a/awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js index 9ad52a7899..63ec02e404 100644 --- a/awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js @@ -15,7 +15,7 @@ export default function(){ index: false, hover: true, well: true, - + emptyListText: 'NO ACTIVE FAILURES FOUND', fields: { status: { basePath: 'unified_jobs', diff --git a/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js index 4b8b95b0a6..1d1f0fde4c 100644 --- a/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js @@ -9,14 +9,14 @@ import listController from './dashboard-hosts-list.controller'; import editController from './dashboard-hosts-edit.controller'; var dashboardHostsList = { - name: 'dashboardHosts', - url: '/home/hosts', - controller: listController, - templateUrl: templateUrl('dashboard/hosts/dashboard-hosts-list'), - data: { - activityStream: true, - activityStreamTarget: 'host' - }, + name: 'dashboardHosts', + url: '/home/hosts?:active-failures', + controller: listController, + templateUrl: templateUrl('dashboard/hosts/dashboard-hosts-list'), + data: { + activityStream: true, + activityStreamTarget: 'host' + }, ncyBreadcrumb: { parent: 'dashboard', label: "HOSTS" @@ -25,39 +25,39 @@ var dashboardHostsList = { features: ['FeaturesService', function(FeaturesService) { return FeaturesService.get(); }], - hosts: ['Rest', 'GetBasePath', function(Rest, GetBasePath){ - var defaultUrl = GetBasePath('hosts') + '?page_size=10'; - Rest.setUrl(defaultUrl); - return Rest.get().then(function(res){ - var results = _.map(res.data.results, function(value){ - value.inventory_name = value.summary_fields.inventory.name; - value.inventory_id = value.summary_fields.inventory.id; - return value; - }); + hosts: ['Rest', 'GetBasePath', '$stateParams', function(Rest, GetBasePath, $stateParams){ + var defaultUrl = GetBasePath('hosts') + '?page_size=10' + ($stateParams['active-failures'] ? '&has_active_failures=true' : '' ); + Rest.setUrl(defaultUrl); + return Rest.get().then(function(res){ + var results = _.map(res.data.results, function(value){ + value.inventory_name = value.summary_fields.inventory.name; + value.inventory_id = value.summary_fields.inventory.id; + return value; + }); res.data.results = results; return res.data; - }); + }); }] } }; var dashboardHostsEdit = { - name: 'dashboardHosts.edit', - url: '/:id', - controller: editController, - templateUrl: templateUrl('dashboard/hosts/dashboard-hosts-edit'), + name: 'dashboardHosts.edit', + url: '/:id', + controller: editController, + templateUrl: templateUrl('dashboard/hosts/dashboard-hosts-edit'), ncyBreadcrumb: { parent: 'dashboardHosts', label: "{{host.name}}" }, resolve: { - host: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ - var defaultUrl = GetBasePath('hosts') + '?id=' + $stateParams.id; - Rest.setUrl(defaultUrl); - return Rest.get().then(function(res){ - return res.data.results[0]; - }); - }] + host: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ + var defaultUrl = GetBasePath('hosts') + '?id=' + $stateParams.id; + Rest.setUrl(defaultUrl); + return Rest.get().then(function(res){ + return res.data.results[0]; + }); + }] } };