mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 08:37:48 -02:30
Wrap up AC-649, provide an api for the dashboard view
This commit is contained in:
@@ -161,11 +161,18 @@ class DashboardView(APIView):
|
||||
'failed': ec2_inventory_failed.count()})
|
||||
|
||||
user_groups = get_user_queryset(request.user, Group)
|
||||
failed_group_inventory = [g.inventory for g in user_groups if g.inventory.has_active_failures]
|
||||
group_with_job_failure = 0
|
||||
for i in failed_group_inventory:
|
||||
for j in i.jobs:
|
||||
if j.failed:
|
||||
group_with_job_failure += 1
|
||||
break
|
||||
data['groups'] = SortedDict({'url': reverse('api:group_list'),
|
||||
'failures_url': '__fill__',
|
||||
'failures_url': reverse('api:group_list') + "?has_active_failures=True",
|
||||
'total': user_groups.count(),
|
||||
'job_failed': '__fill__', # # of groups with job failures
|
||||
'inventory_failed': '__fill__'}) # # of groups with failed cloud updates
|
||||
'job_failed': group_with_job_failure,
|
||||
'inventory_failed': len(failed_group_inventory)})
|
||||
|
||||
user_hosts = get_user_queryset(request.user, Host)
|
||||
user_hosts_failed = user_hosts.filter(has_active_failures=True)
|
||||
|
||||
Reference in New Issue
Block a user