Created a way to remove table row borders. Created a way to add an 'active-row' class to selected table border. Injecting hosts list into same scope as groups list. Streamlined host/job status message.

This commit is contained in:
Chris Houseknecht
2014-01-09 16:18:02 +00:00
parent ec5686770b
commit e6c0032444
8 changed files with 67 additions and 41 deletions

View File

@@ -137,41 +137,37 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
var inventory_id = params.inventory_id;
var group_id = params.group_id;
var tip, link, html_class;
var tip, failures, html_class;
// Return values for use on host status indicator
if (active_failures > 0) {
tip = "Contains " + active_failures +
[ (active_failures == 1) ? ' host' : ' hosts' ] + ' with failed jobs. Click to view the offending ' +
[ (active_failures == 1) ? ' host' : ' hosts' ] + ' with failed jobs.' +
[ (active_failures == 1) ? ' host' : ' hosts' ] + '.';
link = '/#/inventories/' + inventory_id + '/hosts?group=' + group_id + '&has_active_failures=true';
html_class = 'true';
failures = true;
}
else {
failures = false;
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/?group=' + group_id;
tip = "There are no hosts in this group.";
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/?group=' + group_id;
tip = "The host in this group does not have a recent job failure.";
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.";
link = '/#/inventories/' + inventory_id + '/hosts/?group=' + group_id;
tip = "None of the " + total_hosts + " hosts in this group have a recent job failure.";
html_class = 'false';
}
}
return { tooltip: tip, url: link, 'class': html_class };
return { tooltip: tip, failures: failures, 'class': html_class };
}
}])

View File

@@ -26,12 +26,6 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
var url = ( !Empty(group_id) ) ? GetBasePath('groups') + group_id + '/all_hosts/' :
GetBasePath('inventory') + inventory_id + '/hosts/';
for (var i=0; i < scope.groups.length; i++) {
scope.groups[i].selected_class = (scope.groups[i].id == tree_id) ? 'selected' : '';
if (scope.groups[i].id == tree_id) {
scope.selected_group_name = scope.groups[i].name;
}
}
scope.search_place_holder='Search ' + scope.selected_group_name;
SearchInit({ scope: scope, set: 'hosts', list: InventoryHosts, url: url });
@@ -50,7 +44,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
var tree_id = params.tree_id;
var generator = GenerateList;
generator.inject(InventoryHosts, { mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' });
generator.inject(InventoryHosts, { scope: scope, mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' });
HostsReload({ scope: scope, group_id: group_id, tree_id: tree_id, inventory_id: inventory_id });
}
}])