From dc670e86aa1faee04aa4bb06d0f6e472b1f4d26d Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Mon, 1 Jul 2013 13:24:25 -0400 Subject: [PATCH] AC-177 Added status field to Host Summary page. Field shows red/green icon indicating if host failed or succeeded. --- awx/ui/static/js/controllers/JobHosts.js | 5 +++-- awx/ui/static/js/helpers/search.js | 11 ++++++++--- awx/ui/static/js/lists/JobHosts.js | 10 +++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/awx/ui/static/js/controllers/JobHosts.js b/awx/ui/static/js/controllers/JobHosts.js index 3f50b4d258..af915e5031 100644 --- a/awx/ui/static/js/controllers/JobHosts.js +++ b/awx/ui/static/js/controllers/JobHosts.js @@ -28,8 +28,9 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, } scope.PostRefershRemove = scope.$on('PostRefresh', function() { for( var i=0; i < scope.jobhosts.length; i++) { - scope.jobhosts[i].host_name = scope.jobhosts[i].summary_fields.host.name; - } + scope.jobhosts[i].host_name = scope.jobhosts[i].summary_fields.host.name; + scope.jobhosts[i].status = (scope.jobhosts[i].failed) ? 'error' : 'success'; + } }); SearchInit({ scope: scope, set: 'jobhosts', list: list, url: defaultUrl }); diff --git a/awx/ui/static/js/helpers/search.js b/awx/ui/static/js/helpers/search.js index 1f18858eac..09789e232b 100644 --- a/awx/ui/static/js/helpers/search.js +++ b/awx/ui/static/js/helpers/search.js @@ -196,11 +196,16 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper']) } // Set the sorder order value and call the API to refresh the list with the new order - if (list.fields[fld].sourceModel) { - sort_order = direction + list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField; + if (list.fields[fld].searchField) { + sort_order = direction + list.fields[fld].searchField; } else { - sort_order = direction + fld; + if (list.fields[fld].sourceModel) { + sort_order = direction + list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField; + } + else { + sort_order = direction + fld; + } } scope.search(list.iterator); } diff --git a/awx/ui/static/js/lists/JobHosts.js b/awx/ui/static/js/lists/JobHosts.js index 6e6af4f472..eb86a05d67 100644 --- a/awx/ui/static/js/lists/JobHosts.js +++ b/awx/ui/static/js/lists/JobHosts.js @@ -25,7 +25,15 @@ angular.module('JobHostDefinition', []) ngBind: 'jobhost.host_name', ngClick:"showEvents('\{\{ jobhost.summary_fields.host.name \}\}','\{\{ jobhost.related.job \}\}')" }, - ok: { + status: { + label: 'Status', + icon: 'icon-circle', + "class": 'job-\{\{ jobhost.status \}\}', + searchField: 'failed', + searchType: 'boolean', + searchOptions: [{ name: "success", value: 0 }, { name: "error", value: 1 }] + }, + ok: { label: 'Success', searchable: false },