Changed status flags on Invnentory, Groups and Hosts pages

This commit is contained in:
chouseknecht
2013-10-17 07:49:11 +00:00
parent 5bd3d8456b
commit 47261bd069
8 changed files with 154 additions and 60 deletions

View File

@@ -36,23 +36,73 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
} }
scope.projectsPostRefresh = scope.$on('PostRefresh', function() { scope.projectsPostRefresh = scope.$on('PostRefresh', function() {
for (var i=0; i < scope.inventories.length; i++) { for (var i=0; i < scope.inventories.length; i++) {
// Set values for Failed Hosts column
scope.inventories[i].failed_hosts = scope.inventories[i].hosts_with_active_failures + ' / ' + scope.inventories[i].total_hosts;
if (scope.inventories[i].hosts_with_active_failures > 0) { if (scope.inventories[i].hosts_with_active_failures > 0) {
scope.inventories[i].active_failures_params = "/?has_active_failures=true"; scope.inventories[i].failed_hosts_tip = "Contains " + scope.inventories[i].hosts_with_active_failures +
} [ (scope.inventories[i].hosts_with_active_failures == 1) ? ' host' : ' hosts' ] + ' where the latest job failed. Click to view the ' +
if (scope.inventories[i].has_inventory_sources) { [ (scope.inventories[i].hosts_with_active_failures == 1) ? ' offending host.' : ' hosts with failed jobs.' ];
//scope.inventories[i].inventory_source = 'external'; scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts?has_active_failures=true';
scope.inventories[i].has_inv_sources_tip = 'Has one or more external sources. Click to view details.'; scope.inventories[i].failed_hosts_class = 'true';
scope.inventories[i].has_inv_sources_link = '/#/inventories/' + scope.inventories[i].id +
'/groups?has_external_source=true';
scope.inventories[i].inventory_sources = 'yes';
} }
else { else {
//scope.inventories[i].inventory_source = 'manual'; if (scope.inventories[i].total_hosts == 0) {
scope.inventories[i].has_inv_sources_tip = 'Has no external sources.'; // no hosts
scope.inventories[i].has_inv_sources_link = '/#/inventories/' + scope.inventories[i].id + scope.inventories[i].failed_hosts_tip = "There are no hosts in this inventory. It's a sad empty shell. Click to view the hosts page and add a host.";
'/groups'; scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts';
scope.inventories[i].inventory_sources = 'no'; scope.inventories[i].failed_hosts_class = 'na';
}
else if (scope.inventories[i].total_hosts == 1) {
// on host with 0 failures
scope.inventories[i].failed_hosts_tip = "The 1 host contained in this inventory does not have a current job failure. It's happy!" +
" Click to view the host.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts';
scope.inventories[i].failed_hosts_class = 'false';
}
else {
// many hosts with 0 failures
scope.inventories[i].failed_hosts_tip = "All " + scope.inventories[i].total_hosts + " hosts are happy! None of them have " +
" a recent job failure. Click to view the hosts.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts';
scope.inventories[i].failed_hosts_class = 'false';
}
} }
// Set values for Status column
scope.inventories[i].status = scope.inventories[i].inventory_sources_with_failures + ' / ' + scope.inventories[i].total_inventory_sources;
if (scope.inventories[i].inventory_sources_with_failures > 0) {
scope.inventories[i].status_tip = "Contains " + scope.inventories[i].inventory_sources_with_failures +
[ (scope.inventories[i].inventory_sources_with_failures == 1) ? ' group' : ' groups' ] + ' where the latest inventory update failed. ' +
'Click to view the ' +
[ (scope.inventories[i].inventory_sources_with_failures == 1) ? ' offending group.' : ' groups with failures.' ];
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups?status=failed';
scope.inventories[i].status_class = 'failed';
}
else {
if (scope.inventories[i].total_inventory_sources == 0) {
// no groups are reporting a source
scope.inventories[i].status_tip = "There are no groups configured for an external inventory source. Click to view groups and " +
"and add an inventory source.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups';
scope.inventories[i].status_class = 'na';
}
else if (scope.inventories[i].total_inventory_sources == 1) {
// on host with 0 failures
scope.inventories[i].status_tip = "The 1 group configured with an inventory source was updated successfully. It's happy!" +
" Click to view the group.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups?has_external_source=true';
scope.inventories[i].status_class = 'successful';
}
else {
// many hosts with 0 failures
scope.inventories[i].status_tip = "The " + scope.inventories[i].total_inventory_sources + " groups with an inventory source are happy! " +
" The most recent update of each group was successful. Click to view the groups.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups?has_external_source=true';
scope.inventories[i].status_class = 'successful';
}
}
} }
}); });

View File

@@ -22,7 +22,7 @@ angular.module('InventoryHostsFormDefinition', [])
ngClick: "editHost(\{\{ host.id \}\}, '\{\{ host.name \}\}')" ngClick: "editHost(\{\{ host.id \}\}, '\{\{ host.name \}\}')"
}, },
active_failures: { active_failures: {
label: 'Current<br>Job Status?', label: 'Job Status?',
ngHref: "\{\{ host.activeFailuresLink \}\}", ngHref: "\{\{ host.activeFailuresLink \}\}",
awToolTip: "\{\{ host.badgeToolTip \}\}", awToolTip: "\{\{ host.badgeToolTip \}\}",
dataPlacement: 'top', dataPlacement: 'top',
@@ -34,7 +34,7 @@ angular.module('InventoryHostsFormDefinition', [])
searchable: false, searchable: false,
nosort: true nosort: true
}, },
inventory_sources: { /*inventory_sources: {
label: 'External<br>Source?', label: 'External<br>Source?',
ngHref: "\{\{ host.has_inv_source_link \}\}", ngHref: "\{\{ host.has_inv_source_link \}\}",
badgeNgHref: "\{\{ host.has_inv_source_link \}\}", badgeNgHref: "\{\{ host.has_inv_source_link \}\}",
@@ -46,7 +46,7 @@ angular.module('InventoryHostsFormDefinition', [])
badgeTipPlacement: 'top', badgeTipPlacement: 'top',
searchable: false, searchable: false,
nosort: true nosort: true
}, },*/
groups: { groups: {
label: 'Groups', label: 'Groups',
searchable: true, searchable: true,
@@ -55,7 +55,7 @@ angular.module('InventoryHostsFormDefinition', [])
nosort: true nosort: true
}, },
has_active_failures: { has_active_failures: {
label: 'Current job failed?', label: 'Has failed job?',
searchSingleValue: true, searchSingleValue: true,
searchType: 'boolean', searchType: 'boolean',
searchValue: 'true', searchValue: 'true',
@@ -90,7 +90,7 @@ angular.module('InventoryHostsFormDefinition', [])
icon: 'icon-plus' icon: 'icon-plus'
}, },
help: { help: {
dataPlacement: 'left', dataPlacement: 'top',
icon: "icon-question-sign", icon: "icon-question-sign",
mode: 'all', mode: 'all',
'class': 'btn-xs btn-info btn-help', 'class': 'btn-xs btn-info btn-help',

View File

@@ -232,6 +232,39 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
else { else {
scope.groups[i].active_failures_params = "/?has_active_failures=false"; scope.groups[i].active_failures_params = "/?has_active_failures=false";
} }
// Set values for Failed Hosts column
scope.groups[i].failed_hosts = scope.groups[i].hosts_with_active_failures + ' / ' + scope.groups[i].total_hosts;
if (scope.groups[i].hosts_with_active_failures > 0) {
scope.groups[i].failed_hosts_tip = "Contains " + scope.groups[i].hosts_with_active_failures +
[ (scope.groups[i].hosts_with_active_failures == 1) ? ' host' : ' hosts' ] + ' where the latest job failed. Click to view the ' +
[ (scope.groups[i].hosts_with_active_failures == 1) ? ' offending host.' : ' hosts with failed jobs.' ];
scope.groups[i].failed_hosts_link = '/#/inventories/' + scope.groups[i].inventory + '/hosts?has_active_failures=true';
scope.groups[i].failed_hosts_class = 'true';
}
else {
if (scope.groups[i].total_hosts == 0) {
// no hosts
scope.groups[i].failed_hosts_tip = "There are no hosts in this inventory. It's a sad empty shell. Click to view the hosts page and add a host.";
scope.groups[i].failed_hosts_link = '/#/inventories/' + scope.groups[i].inventory + '/hosts';
scope.groups[i].failed_hosts_class = 'na';
}
else if (scope.groups[i].total_hosts == 1) {
// on host with 0 failures
scope.groups[i].failed_hosts_tip = "The 1 host contained in this inventory does not have a current job failure. It's happy!" +
" Click to view the host.";
scope.groups[i].failed_hosts_link = '/#/inventories/' + scope.groups[i].inventory + '/hosts';
scope.groups[i].failed_hosts_class = 'false';
}
else {
// many hosts with 0 failures
scope.groups[i].failed_hosts_tip = "All " + scope.groups[i].total_hosts + " hosts are happy! None of them have " +
" a recent job failure. Click to view the hosts.";
scope.groups[i].failed_hosts_link = '/#/inventories/' + scope.groups[i].inventory + '/hosts';
scope.groups[i].failed_hosts_class = 'false';
}
}
scope.groups[i].status = stat; scope.groups[i].status = stat;
scope.groups[i].source = scope.groups[i].summary_fields.inventory_source.source; scope.groups[i].source = scope.groups[i].summary_fields.inventory_source.source;
@@ -263,7 +296,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
scope[list.iterator + 'SearchField'] = 'status'; scope[list.iterator + 'SearchField'] = 'status';
scope[list.iterator + 'SelectShow'] = true; scope[list.iterator + 'SelectShow'] = true;
scope[list.iterator + 'SearchSelectOpts'] = list.fields['status'].searchOptions; scope[list.iterator + 'SearchSelectOpts'] = list.fields['status'].searchOptions;
scope[list.iterator + 'SearchFieldLabel'] = list.fields['status'].label; scope[list.iterator + 'SearchFieldLabel'] = list.fields['status'].label.replace(/\<br\>/g,' ');
for (var opt in list.fields['status'].searchOptions) { for (var opt in list.fields['status'].searchOptions) {
if (list.fields['status'].searchOptions[opt].value == $routeParams['status']) { if (list.fields['status'].searchOptions[opt].value == $routeParams['status']) {
scope[list.iterator + 'SearchSelectValue'] = list.fields['status'].searchOptions[opt]; scope[list.iterator + 'SearchSelectValue'] = list.fields['status'].searchOptions[opt];

View File

@@ -263,6 +263,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
if (list.fields[fld].searchField) { if (list.fields[fld].searchField) {
sort_order = direction + list.fields[fld].searchField; sort_order = direction + list.fields[fld].searchField;
} }
else if (list.fields[fld].sortField) {
sort_order = direction + list.fields[fld].sortField;
}
else { else {
if (list.fields[fld].sourceModel) { if (list.fields[fld].sourceModel) {
sort_order = direction + list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField; sort_order = direction + list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField;

View File

@@ -31,29 +31,33 @@ angular.module('InventoriesListDefinition', [])
sourceField: 'name', sourceField: 'name',
excludeModal: true excludeModal: true
}, },
hosts_with_active_failures: { failed_hosts: {
label: 'Hosts with<br>Failed Job?', label: 'Failed Hosts',
ngHref: '/#/inventories/{{ inventory.id }}/hosts{{ inventory.active_failures_params }}', ngHref: "\{\{ inventory.failed_hosts_link \}\}",
type: 'badgeCount', badgeIcon: "\{\{ 'icon-failures-' + inventory.failed_hosts_class \}\}",
"class": "{{ 'failures-' + inventory.has_active_failures }}", badgeNgHref: "\{\{ inventory.failed_hosts_link \}\}",
awToolTip: '# of hosts with failed jobs. Click to view hosts.',
dataPlacement: 'top',
searchable: false,
excludeModal: true
},
inventory_sources: {
label: 'External<br>Sources?',
ngHref: '\{\{ inventory.has_inv_sources_link \}\}',
badgeNgHref: '\{\{ inventory.has_inv_sources_link \}\}',
badgeIcon: "\{\{ 'icon-cloud-' + inventory.has_inventory_sources \}\}",
badgePlacement: 'left', badgePlacement: 'left',
badgeToolTip: "\{\{ inventory.has_inv_sources_tip \}\}", badgeToolTip: "\{\{ inventory.failed_hosts_tip \}\}",
awToolTip: "\{\{ inventory.has_inv_sources_tip \}\}",
dataPlacement: "top",
badgeTipPlacement: 'top', badgeTipPlacement: 'top',
awToolTip: "\{\{ inventory.failed_hosts_tip \}\}",
dataPlacement: "top",
searchable: false, searchable: false,
excludeModal: true, excludeModal: true,
nosort: true sortField: "hosts_with_active_failures"
},
status: {
label: 'Status',
ngHref: "\{\{ inventory.status_link \}\}",
badgeIcon: "\{\{ 'icon-cloud-' + inventory.status_class \}\}",
badgeNgHref: "\{\{ inventory.status_link \}\}",
badgePlacement: 'left',
badgeTipPlacement: 'top',
badgeToolTip: "\{\{ inventory.status_tip \}\}",
awToolTip: "\{\{ inventory.status_tip \}\}",
dataPlacement: "top",
searchable: false,
excludeModal: true,
sortField: "inventory_sources_with_failures"
}, },
has_inventory_sources: { has_inventory_sources: {
label: 'Has external sources?', label: 'Has external sources?',
@@ -63,7 +67,7 @@ angular.module('InventoriesListDefinition', [])
searchOnly: true searchOnly: true
}, },
has_active_failures: { has_active_failures: {
label: 'Has hosts with failed jobs?', label: 'Has failed hosts?',
searchSingleValue: true, searchSingleValue: true,
searchType: 'boolean', searchType: 'boolean',
searchValue: 'true', searchValue: 'true',

View File

@@ -25,18 +25,22 @@ angular.module('InventorySummaryDefinition', [])
ngClick: "\{\{ 'GroupsEdit(' + group.id + ')' \}\}", ngClick: "\{\{ 'GroupsEdit(' + group.id + ')' \}\}",
columnClass: 'col-lg-3 col-md3 col-sm-2' columnClass: 'col-lg-3 col-md3 col-sm-2'
}, },
hosts_with_active_failures: { failed_hosts: {
label: 'Hosts with<br>Job Failures?', label: 'Failed Hosts',
ngHref: '/#/inventories/{{ inventory_id }}/hosts{{ group.active_failures_params }}', ngHref: "\{\{ group.failed_hosts_link \}\}",
type: 'badgeCount', badgeIcon: "\{\{ 'icon-failures-' + group.failed_hosts_class \}\}",
"class": "{{ 'failures-' + group.has_active_failures }}", badgeNgHref: "\{\{ group.failed_hosts_link \}\}",
awToolTip: '# of hosts with job failures. Click to view hosts.', badgePlacement: 'left',
dataPlacement: 'top', badgeToolTip: "\{\{ group.failed_hosts_tip \}\}",
badgeTipPlacement: 'top',
awToolTip: "\{\{ group.failed_hosts_tip \}\}",
dataPlacement: "top",
searchable: false, searchable: false,
nosort: false excludeModal: true,
sortField: "hosts_with_active_failures"
}, },
status: { status: {
label: 'Update<br>Status', label: 'Status',
ngClick: "viewUpdateStatus(\{\{ group.id \}\})", ngClick: "viewUpdateStatus(\{\{ group.id \}\})",
searchType: 'select', searchType: 'select',
badgeIcon: "\{\{ 'icon-cloud-' + group.status_badge_class \}\}", badgeIcon: "\{\{ 'icon-cloud-' + group.status_badge_class \}\}",
@@ -69,7 +73,8 @@ angular.module('InventorySummaryDefinition', [])
{ name: "none", value: "" }, { name: "none", value: "" },
{ name: "rackspace", value: "rackspace" }], { name: "rackspace", value: "rackspace" }],
sourceModel: 'inventory_source', sourceModel: 'inventory_source',
sourceField: 'source' sourceField: 'source',
searchOnly: true
}, },
has_external_source: { has_external_source: {
label: 'Has external source?', label: 'Has external source?',
@@ -80,7 +85,7 @@ angular.module('InventorySummaryDefinition', [])
sourceField: 'source' sourceField: 'source'
}, },
has_active_failures: { has_active_failures: {
label: 'Hosts have job failures?', label: 'Has failed hosts?',
searchSingleValue: true, searchSingleValue: true,
searchType: 'boolean', searchType: 'boolean',
searchValue: 'true', searchValue: 'true',
@@ -110,7 +115,7 @@ angular.module('InventorySummaryDefinition', [])
dataPlacement: 'top' dataPlacement: 'top'
}, },
help: { help: {
dataPlacement: 'left', dataPlacement: 'top',
icon: "icon-question-sign", icon: "icon-question-sign",
mode: 'all', mode: 'all',
'class': 'btn-xs btn-info btn-help', 'class': 'btn-xs btn-info btn-help',

View File

@@ -689,7 +689,8 @@ select.field-mini-height {
color: @red; color: @red;
} }
.icon-failures-none { .icon-failures-none,
.icon-failures-na {
color: @grey; color: @grey;
} }
@@ -698,6 +699,7 @@ select.field-mini-height {
} }
.icon-failures-none:before, .icon-failures-none:before,
.icon-failures-na:before,
.icon-failures-false:before { .icon-failures-false:before {
content: "\f111"; content: "\f111";
} }
@@ -733,17 +735,14 @@ select.field-mini-height {
content: "\f06a"; content: "\f06a";
} }
.icon-cloud-na { .icon-cloud-na,
color: #888;
}
.icon-cloud-never { .icon-cloud-never {
color: #888; color: @grey;
} }
.icon-cloud-updating, .icon-cloud-updating,
.icon-cloud-successful { .icon-cloud-successful {
color: #5bb75b; color: @green;
} }
.icon-cloud-failed { .icon-cloud-failed {
@@ -1041,7 +1040,7 @@ select.field-mini-height {
.field-badge { .field-badge {
font-size: 10px; font-size: 10px;
line-height: normal; line-height: normal;
vertical-align: middle; vertical-align: baseline;
} }
} }

View File

@@ -1280,7 +1280,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
html += SearchWidget({ iterator: form.iterator, template: form, mini: true, size: 'col-md-5 col-lg-5'}); html += SearchWidget({ iterator: form.iterator, template: form, mini: true, size: 'col-md-5 col-lg-5'});
html += "<div class=\"col-md-5 col-lg-5\">\n" html += "<div class=\"col-md-6 col-lg-6\">\n"
html += "<div class=\"list-actions\">\n"; html += "<div class=\"list-actions\">\n";
// Add actions(s) // Add actions(s)
for (var action in form.actions) { for (var action in form.actions) {