diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 7cfeaa96cc..a3ef0a3242 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -123,6 +123,11 @@ angular.module('Tower', [ controller: 'JobDetailController' }). + when('/jobs/:id/stdout', { + templateUrl: urlPrefix + 'partials/job_stdout.html', + controller: 'JobStdoutController' + }). + when('/job_events/:id', { templateUrl: urlPrefix + 'partials/job_events.html', controller: 'JobEventsList' diff --git a/awx/ui/static/js/controllers/JobStdout.js b/awx/ui/static/js/controllers/JobStdout.js new file mode 100644 index 0000000000..72123175b8 --- /dev/null +++ b/awx/ui/static/js/controllers/JobStdout.js @@ -0,0 +1,46 @@ +/************************************ + * Copyright (c) 2014 AnsibleWorks, Inc. + * + * JobStdout.js + * + */ + +'use strict'; + +function JobStdoutController ($scope, $compile, $routeParams, ClearScope, GetBasePath, Wait, Rest, ProcessErrors) { + + ClearScope(); + + var job_id = $routeParams.id; + + Wait('start'); + + if ($scope.removeLoadStdout) { + $scope.removeLoadStdout(); + } + $scope.removeLoadStdout = $scope.$on('LoadStdout', function(e, url) { + Rest.setUrl(url + '?format=html'); + Rest.get() + .success(function(data) { + Wait('stop'); + $('#stdout-container').empty().html(data); + }) + .error(function(data, status) { + ProcessErrors($scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status }); + }); + }); + + Rest.setUrl(GetBasePath('jobs') + job_id + '/'); + Rest.get() + .success(function(data) { + $scope.job = data; + $scope.$emit('LoadStdout', data.related.stdout); + }) + .error(function(data, status) { + ProcessErrors($scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to retrieve job: ' + job_id + '. GET returned: ' + status }); + }); +} + +JobStdoutController.$inject = [ '$scope', '$compile', '$routeParams', 'ClearScope', 'GetBasePath', 'Wait', 'Rest', 'ProcessErrors']; \ No newline at end of file diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index e7c6f72781..53279fdecc 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -217,7 +217,6 @@ function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcr choicesCount++; if (choicesCount === 2) { setHeight(); - console.log('rows: ' + max_rows); $scope.$emit('buildJobsList'); } }); @@ -255,7 +254,7 @@ function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcr page_row = Math.max($('.page-row:eq(0)').outerHeight(), 33); header = Math.max($('#completed_jobs_table thead').height(), 41); height = Math.floor(available_height / 2) - header - page_row - search_row - 15; - row_height = (docw < 1415) ? 47 : 27; + row_height = (docw < 1415) ? 47 : 27; //$('.jobs-list-container tbody tr:eq(0)').height(); <-- only works if data is loaded max_rows = Math.floor(height / row_height); } diff --git a/awx/ui/static/js/helpers/JobDetail.js b/awx/ui/static/js/helpers/JobDetail.js index 50b057011d..9988a4f8a7 100644 --- a/awx/ui/static/js/helpers/JobDetail.js +++ b/awx/ui/static/js/helpers/JobDetail.js @@ -114,7 +114,8 @@ function(UpdatePlayStatus, UpdateHostStatus, UpdatePlayChild, AddHostResult, Sel play_id: event.parent, failed: true, changed: false, - modified: event.modified + modified: event.modified, + status_text: 'failed- no hosts matched' }); } if (event.event === 'playbook_on_task_start') { @@ -392,7 +393,8 @@ function(UpdatePlayStatus, UpdateHostStatus, UpdatePlayChild, AddHostResult, Sel changed = params.changed, id = params.play_id, modified = params.modified, - no_hosts = params.no_hosts; + no_hosts = params.no_hosts, + status_text = params.status_text; scope.plays.every(function(play,idx) { if (play.id === id) { if (failed) { @@ -412,6 +414,7 @@ function(UpdatePlayStatus, UpdateHostStatus, UpdatePlayChild, AddHostResult, Sel start: play.created, end: modified }); + scope.plays[idx].status_text = (status_text) ? status_text : scope.plays[idx].status; UpdateJobStatus({ scope: scope, failed: null, diff --git a/awx/ui/static/less/job-details.less b/awx/ui/static/less/job-details.less index fff88d56a6..db2b619fcd 100644 --- a/awx/ui/static/less/job-details.less +++ b/awx/ui/static/less/job-details.less @@ -161,7 +161,7 @@ border: 1px solid @grey; border-radius: 4px; background-color: @white; - padding-left: 3px; + /*padding-left: 3px; */ .row { border-top: 1px solid @grey; } diff --git a/awx/ui/static/partials/job_detail.html b/awx/ui/static/partials/job_detail.html index b258e2e8e1..e66b4f23b7 100644 --- a/awx/ui/static/partials/job_detail.html +++ b/awx/ui/static/partials/job_detail.html @@ -21,7 +21,7 @@
{{ job_status.status }}
{{ job_status.explanation }}
- +
@@ -58,7 +58,8 @@ -
+
{{ play.name }}
@@ -82,8 +83,9 @@ -
- {{ task.role }} {{ task.name }} +
+ {{ task.role }} {{ task.name }}
\ No newline at end of file diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 44592a451f..4b9f8977dd 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -73,7 +73,8 @@ - + +