From 77b823f43f809daa1507f354913966a61f1717bd Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Wed, 22 May 2013 18:06:39 -0400 Subject: [PATCH] Host name is now on the Job Events page and links to Host detail page. --- .../ui/static/js/controllers/JobEvents.js | 18 ++++++++++++++++++ ansibleworks/ui/static/js/lists/JobEvents.js | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/ansibleworks/ui/static/js/controllers/JobEvents.js b/ansibleworks/ui/static/js/controllers/JobEvents.js index 9f2fb9e972..4d3ac2e6b1 100644 --- a/ansibleworks/ui/static/js/controllers/JobEvents.js +++ b/ansibleworks/ui/static/js/controllers/JobEvents.js @@ -35,12 +35,30 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest, scope.PostRefreshRemove = scope.$on('PostRefresh', function() { for (var i=0; i < scope.jobevents.length; i++) { scope.jobevents[i].status = (scope.jobevents[i].failed) ? 'error' : 'success'; + if (scope.jobevents[i].host !== null) { + scope.jobevents[i].host_name = scope.jobevents[i].summary_fields.host.name; + } } }); scope.editJobEvent = function(id) { $location.path($location.path() + '/' + id); } + + scope.viewHost = function(id) { + if (id !== undefined && id !== null) { + Rest.setUrl(GetBasePath('jobs') + $routeParams.id + '/'); + Rest.get() + .success( function(data, status, headers, config) { + LoadBreadCrumbs({ path: '/inventories/' + data.inventory, title: data.summary_fields.inventory.name }); + $location.path('/inventories/' + data.inventory + /hosts/ + id); + }) + .error( function(data, status, headers, config) { + ProcessErrors(scope, data, status, null, + { hdr: 'Error!', msg: 'Failed to lookup job record for job ' + $routeParams.id + ' GET returned status: ' + status }); + }); + }; + } } JobEventsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobEventList', diff --git a/ansibleworks/ui/static/js/lists/JobEvents.js b/ansibleworks/ui/static/js/lists/JobEvents.js index 199bebb923..02346af3bb 100644 --- a/ansibleworks/ui/static/js/lists/JobEvents.js +++ b/ansibleworks/ui/static/js/lists/JobEvents.js @@ -30,6 +30,13 @@ angular.module('JobEventsListDefinition', []) created: { label: 'Creation Date', }, + host: { + label: 'Host', + ngClick: "viewHost(\{\{ jobevent.host \}\})", + ngBind: 'jobevent.host_name', + sourceModel: 'host', + sourceField: 'name' + }, status: { label: 'Status', icon: 'icon-circle',