summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Houseknecht <chouse@ansibleworks.com>2013-11-12 17:11:39 +0100
committerChris Houseknecht <chouse@ansibleworks.com>2013-11-12 17:11:39 +0100
commit4e93a5c6e23bd313328db745f8f4d0526a89191c (patch)
tree6fb4fc8744935f97ca0b571451f384bd0181b192
parentAC-502 Finally figured out how to fix the awToolTip directive so that it watc... (diff)
downloadawx-4e93a5c6e23bd313328db745f8f4d0526a89191c.tar.xz
awx-4e93a5c6e23bd313328db745f8f4d0526a89191c.zip
AC-502 added group ID as a parameter on 'job failure' links from /home/hosts. This causes the tree to load with the appropriate group selected.
-rw-r--r--awx/ui/static/js/controllers/Home.js3
-rw-r--r--awx/ui/static/js/controllers/Hosts.js27
-rw-r--r--awx/ui/static/js/helpers/Groups.js12
3 files changed, 29 insertions, 13 deletions
diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js
index 9060fbab6c..ad863752dc 100644
--- a/awx/ui/static/js/controllers/Home.js
+++ b/awx/ui/static/js/controllers/Home.js
@@ -75,7 +75,8 @@ function HomeGroups ($location, $routeParams, HomeGroupList, GenerateList, Proce
msg = HostsStatusMsg({
active_failures: scope.groups[i].hosts_with_active_failures,
total_hosts: scope.groups[i].total_hosts,
- inventory_id: scope.groups[i].inventory
+ inventory_id: scope.groups[i].inventory,
+ group_id: scope.groups[i].id
});
update_status = UpdateStatusMsg({ status: scope.groups[i].summary_fields.inventory_source.status });
diff --git a/awx/ui/static/js/controllers/Hosts.js b/awx/ui/static/js/controllers/Hosts.js
index 912ccfd63c..3662dbefb8 100644
--- a/awx/ui/static/js/controllers/Hosts.js
+++ b/awx/ui/static/js/controllers/Hosts.js
@@ -137,13 +137,26 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
});
// Load the tree. See TreeSelector.js
- BuildTree({
- scope: scope,
- inventory_id: id,
- emit_on_select: 'refreshHost',
- target_id: 'search-tree-container'
- });
-
+ var group_id = ($routeParams['group'] !== undefined) ? $routeParams['group'] : null;
+ if (group_id !== null) {
+ // group was passed as a search parameter. load the tree with the group selected.
+ BuildTree({
+ scope: scope,
+ inventory_id: id,
+ emit_on_select: 'refreshHost',
+ target_id: 'search-tree-container',
+ refresh: true,
+ group_id: group_id
+ });
+ }
+ else {
+ BuildTree({
+ scope: scope,
+ inventory_id: id,
+ emit_on_select: 'refreshHost',
+ target_id: 'search-tree-container'
+ });
+ }
}
InventoryHosts.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryHostsForm',
diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js
index daf62ae6cf..bf28beb401 100644
--- a/awx/ui/static/js/helpers/Groups.js
+++ b/awx/ui/static/js/helpers/Groups.js
@@ -127,6 +127,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
var active_failures = params.active_failures;
var total_hosts = params.total_hosts;
var inventory_id = params.inventory_id;
+ var group_id = params.group_id;
var tips, link, html_class;
// Return values for use on host status indicator
@@ -135,28 +136,28 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
tip = "Contains " + active_failures +
[ (active_failures == 1) ? ' host' : ' hosts' ] + ' with failed jobs. Click to view the offending ' +
[ (active_failures == 1) ? ' host' : ' hosts' ] + '.';
- link = '/#/inventories/' + inventory_id + '/hosts?has_active_failures=true';
+ link = '/#/inventories/' + inventory_id + '/hosts?group=' + group_id + '&has_active_failures=true';
html_class = 'true';
}
else {
if (total_hosts == 0) {
// no hosts
tip = "There are no hosts in this group. It's a sad empty shell. Click to view the hosts page and add a host.";
- link = '/#/inventories/' + inventory_id + '/hosts';
+ link = '/#/inventories/' + inventory_id + '/hosts/?group=' + group_id;
html_class = 'na';
}
else if (total_hosts == 1) {
// on host with 0 failures
tip = "The 1 host in this group is happy! It does not have a job failure. " +
" Click to view the host.";
- link = '/#/inventories/' + inventory_id + '/hosts';
+ link = '/#/inventories/' + inventory_id + '/hosts/?group=' + group_id;
html_class = 'false';
}
else {
// many hosts with 0 failures
tip = "All " + total_hosts + " hosts in this group are happy! None of them have " +
" a recent job failure. Click to view the hosts.";
- links = '/#/inventories/' + inventory_id + '/hosts';
+ links = '/#/inventories/' + inventory_id + '/hosts/?group=' + group_id;
html_class = 'false';
}
}
@@ -353,7 +354,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
msg = HostsStatusMsg({
active_failures: scope.groups[i].hosts_with_active_failures,
total_hosts: scope.groups[i].total_hosts,
- inventory_id: scope['inventory_id']
+ inventory_id: scope['inventory_id'],
+ group_id: scope['groups'][i]['id']
});
update_status = UpdateStatusMsg({ status: scope.groups[i].summary_fields.inventory_source.status });