mirror of
https://github.com/ansible/awx.git
synced 2026-03-14 07:27:28 -02:30
Wired up stdout to job detail page. More to do, but you can at least get to it now.
This commit is contained in:
@@ -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'
|
||||
|
||||
46
awx/ui/static/js/controllers/JobStdout.js
Normal file
46
awx/ui/static/js/controllers/JobStdout.js
Normal file
@@ -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'];
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-4 status-column"><i class="fa icon-job-{{ job_status.status }}"></i> {{ job_status.status }}</div>
|
||||
<div class="col-lg-7 col-md-7 col-sm-4 col-xs-4">{{ job_status.explanation }}</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right">
|
||||
<button type="button" class="btn btn-default btn-xs" aw-tool-tip="View standard out" data-placement="top"><i class="fa fa-external-link"></i></button>
|
||||
<a href="/#/jobs/{{ job_id }}/stdout" target="_blank" type="button" class="btn btn-default btn-xs" aw-tool-tip="View standard out. Opens in new tab or window." data-placement="top"><i class="fa fa-external-link"></i></a>
|
||||
<button type="button" id="summary-button" class="btn btn-default btn-xs" ng-click="toggleSummary()" aw-tool-tip="View summary" data-placement="top"><i class="fa fa-arrow-circle-left fa-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,7 +58,8 @@
|
||||
<div class="col-lg-1 col-md-1 hidden-sm hidden-xs" aw-tool-tip="Completed at {{ play.finished | date:'HH:mm:ss' }}"
|
||||
data-placement="top">{{ play.elapsed }}
|
||||
</div>
|
||||
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12 status-column">
|
||||
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12 status-column" aw-tool-tip="Event Id: {{ play.id }}<br />Status: {{ play.status_text }}"
|
||||
data-placement="top">
|
||||
<i class="fa icon-job-{{ play.status }}"></i> {{ play.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,8 +83,9 @@
|
||||
<div class="col-lg-1 col-md-1 hidden-sm hidden-xs" aw-tool-tip="Completed at {{ task.finished | date:'HH:mm:ss' }}"
|
||||
data-placement="top">{{ task.elapsed }}
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-10 col-xs-12 status-column" aw-tool-tip="Event Id: {{ task.id }} Status: {{ task.status }}" data-placement="top">
|
||||
<i class="fa icon-job-{{ task.status }}"></i><span ng-show="hasRoles"> {{ task.role }} </span> {{ task.name }}
|
||||
<div class="col-lg-5 col-md-5 col-sm-10 col-xs-12 status-column" aw-tool-tip="Event Id: {{ task.id }} Status: {{ task.status }}"
|
||||
data-placement="top">
|
||||
<i class="fa icon-job-{{ task.status }}"></i><span ng-show="hasRoles"> {{ task.role }} </span> {{ task.name }}
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 hidden-sm hidden-xs">
|
||||
<div class="status-bar"><div class="successful-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-successful-bar" aw-tool-tip="{{ task.successfulCount}} hosts OK" aw-tip-watch="task.successfulCount" data-placement="top" ng-style="task.successfulStyle">{{ task.successfulCount }}</div><div class="changed-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-changed-bar" aw-tool-tip="{{ task.changedCount}} hosts changed" aw-tip-watch="task.changedCount" data-placement="top" ng-style="task.changedStyle">{{ task.changedCount }}</div><div class="skipped-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-skipped-bar" aw-tool-tip="{{ task.skippedCount}} hosts skipped" aw-tip-watch="task.skippedCount" data-placement="top" ng-style="task.skippedStyle">{{ task.skippedCount }}</div><div class="failed-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-failed-bar" aw-tool-tip="{{ task.failedCount}} hosts failed" aw-tip-watch="task.failedCount" data-placement="top" ng-style="task.failedStyle">{{ task.failedCount }}</div><div class="no-matching-hosts inner-bar" id="{{ task.id }}-{{ task.play_id }}-no-matching-hosts-bar" aw-tool-tip="No matching hosts were found" data-placement="top" style="width: 100%;" ng-show="task.status === 'no-m atching-hosts'">No matching hosts</div></div>
|
||||
|
||||
23
awx/ui/static/partials/job_stdout.html
Normal file
23
awx/ui/static/partials/job_stdout.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="tab-pane" id="jobs-stdout">
|
||||
<div ng-cloak id="htmlTemplate">
|
||||
|
||||
<div class="row">
|
||||
<div id="breadcrumb-container" class="col-md-12" style="position: relative;">
|
||||
<div class="nav-path">
|
||||
<ul class="breadcrumb" id="breadcrumb-list">
|
||||
<li><a href="/#/jobs">Jobs</a></li>
|
||||
<li><a href="/#/jobs/{{ job.id }}"><strong>{{ job.id }}</strong> - {{ job.name }}</a></li>
|
||||
<li>Standard Out</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="stdout-container"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,7 +73,8 @@
|
||||
<script src="{{ STATIC_URL }}js/controllers/Home.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Teams.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Credentials.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/JobTemplates.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/JobStdout.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Sockets.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Projects.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/Jobs.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/controllers/JobDetail.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user