diff --git a/awx/ui/static/js/widgets/InventorySyncStatus.js b/awx/ui/static/js/widgets/InventorySyncStatus.js index 7c7c80e6a3..61b00ab92b 100644 --- a/awx/ui/static/js/widgets/InventorySyncStatus.js +++ b/awx/ui/static/js/widgets/InventorySyncStatus.js @@ -47,7 +47,7 @@ angular.module('InventorySyncStatusWidget', ['RestServices', 'Utilities']) html += "\n"; return html; } - + html += makeRow({ label: 'Inventories', count: [(dashboard.inventories && dashboard.inventories.total_with_inventory_source) ? dashboard.inventories.total_with_inventory_source : '?'], @@ -56,9 +56,18 @@ angular.module('InventorySyncStatusWidget', ['RestServices', 'Utilities']) fail_link: '/#/inventories/?inventory_sources_with_failures=true' }); + var group_total = 0; + var group_fail = 0; + if (dashboard.inventory_sources) { + for (var src in dashboard.inventory_sources) { + group_total += (dashboard.inventory_sources[src].total) ? dashboard.inventory_sources[src].total : 0; + group_fail += (dashboard.inventory_sources[src].failed) ? dashboard.inventory_sources[src].failed : 0; + } + } + html += makeRow({ label: 'Groups', - count: [(dashboard.groups && dashboard.groups.total_with_inventory_source) ? dashboard.groups.total_with_inventory_source : '?'], - fail: [(dashboard.groups && dashboard.groups.inventory_failed) ? dashboard.groups.inventory_failed : 0], + count: group_total, + fail: group_fail, link: '/#/home/groups/?has_external_source=true', fail_link: '/#/home/groups/?status=failed' }); diff --git a/awx/ui/static/js/widgets/SCMSyncStatus.js b/awx/ui/static/js/widgets/SCMSyncStatus.js index 347114a824..1654afdd20 100644 --- a/awx/ui/static/js/widgets/SCMSyncStatus.js +++ b/awx/ui/static/js/widgets/SCMSyncStatus.js @@ -47,13 +47,16 @@ angular.module('SCMSyncStatusWidget', ['RestServices', 'Utilities']) return html; } - var tot = 0; - for (var type in dashboard.scm_types) { - tot += dashboard.scm_types[type].total; + var total_count = 0; + if (dashboard.scm_types) { + for (var type in dashboard.scm_types) { + total_count += (dashboard.scm_types[type].total) ? dashboard.scm_types[type].total : 0; + } } + html += makeRow({ label: 'Projects', link: '/#/projects', - count: tot, + count: total_count, fail: [(dashboard.projects && dashboard.projects.failed) ? dashboard.projects.failed : 0], fail_link: '/#/projects/?status=failed' });